Cuberite Forum

Full Version: Countdown
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13

okey. Have you found a mistake in protocols for my client crashes.
(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.
(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.
Yea try the OnPlayerSpawned hook.
(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?
Yes, it should be.
How can i make a list?
I will add/remove there players who are alive. (for a minigame)
Use a Lua table, index by number.
(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 ??
-- 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
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13