Countdown
#41
@STR_Warrior
okey. Have you found a mistake in protocols for my client crashes.
Reply
Thanks given by:
#42
(01-15-2014, 01:10 AM)daniel0916 Wrote: okey. Have you found a mistake in protocols for my client crashes.

No but it doesn't crash for me so I have no idea what's wrong.
Reply
Thanks given by:
#43
(01-15-2014, 01:12 AM)STR_Warrior Wrote:
(01-15-2014, 01:10 AM)daniel0916 Wrote: okey. Have you found a mistake in protocols for my client crashes.

No but it doesn't crash for me so I have no idea what's wrong.

For you Player:SetFoodLevel works?
Maybe PlayerJoined Hook haven't spawned the player so it comes a error. Maybe i should use the PlayerSpawned Hook? I will try it.
Reply
Thanks given by:
#44
Yea try the OnPlayerSpawned hook.
Reply
Thanks given by:
#45
(01-15-2014, 01:30 AM)STR_Warrior Wrote: Yea try the OnPlayerSpawned hook.

Works Smile.

Now i hope you fix custom names Wink:

Edit: When i change the world. Will the hook called?
Reply
Thanks given by:
#46
Yes, it should be.
Reply
Thanks given by: daniel0916
#47
How can i make a list?
I will add/remove there players who are alive. (for a minigame)
Reply
Thanks given by:
#48
Use a Lua table, index by number.
Reply
Thanks given by:
#49
(01-15-2014, 03:54 AM)xoft Wrote: Use a Lua table, index by number.

Yes, but what do you mean with index by number?
Because what should i add to the table?
Playername and ??
Reply
Thanks given by:
#50
-- Create table at startup:
g_Players = {}

function OnWorldStarted(World) -- Hook that gets called when the worlds are initialized
 g_Players[World:GetName()] = {}
end

-- Add to table:
table.insert(g_Players[cPlayer:GetWorld():GetName()], cPlayer:GetName())

-- Go through all the values. Assuming you need it every tick:
function OnWorldTick(World, TimeDelta)
 for Idx, PlayerName in ipairs(g_Players[World:GetName()])
  World:DoWithPlayer(PlayerName, function(Player)
   -- Do awesome stuff here
  end)
 end
end
Reply
Thanks given by:




Users browsing this thread: 6 Guest(s)