- Joined
- Sep 19, 2006
- Messages
- 152
This trigger creates a leaderboard, but doesn't add the players to it as needed. What am I doing wrong here?
JASS:
function GameStart_Action01 takes nothing returns nothing
local integer Pnum = 1
local player Plyr
local string Pnam
local leaderboard Lb = CreateLeaderboard ()
call DisableTrigger (gg_trg_GameStart)
call LeaderboardSetLabel (Lb, "Score")
set udg_Leaderboard = Lb
loop
exitwhen Pnum == 9
set Plyr = Player (Pnum)
if GetPlayerSlotState (Plyr) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController (Plyr) == MAP_CONTROL_USER then
set Pnam = GetPlayerName (Plyr)
call LeaderboardAddItem (Lb, Pnam, 1, Plyr)
call PlayerSetLeaderboard (Plyr, Lb)
endif
set Pnum = Pnum + 1
endloop
call LeaderboardDisplay (Lb, true)
call DestroyTrigger (gg_trg_GameStart)
endfunction
function InitTrig_GameStart takes nothing returns nothing
set gg_trg_GameStart = CreateTrigger ()
call TriggerAddAction (gg_trg_GameStart, function GameStart_Action01)
endfunction