Author Topic: [0.26.1] Alliance onNewMember - allianceIndex is nil  (Read 19 times)

Rinart73

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    345
  • Discord: Rinart73#7304
    • View Profile
on: September 14, 2019, 06:14:47 AM
Avorion: 0.26.1

I'm trying to globally track whenever a player joins an alliance.
So I registered an "onNewMember" callback for every alliance in the "main.lua":
Code: [Select]
function onNewMember(playerIndex, rank)
    local player = Player(playerIndex)
    print(string.format("Player %i joined the alliance %s", playerIndex, tostring(player.allianceIndex)))
end

But "player.allianceIndex" is nil. So apparently this callback happens BEFORE player's allianceIndex gets a value.