Cuberite Forum
Countdown - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Countdown (/thread-1314.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Countdown - daniel0916 - 01-15-2014

@STR_Warrior
okey. Have you found a mistake in protocols for my client crashes.


RE: Countdown - NiLSPACE - 01-15-2014

(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.


RE: Countdown - daniel0916 - 01-15-2014

(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.


RE: Countdown - NiLSPACE - 01-15-2014

Yea try the OnPlayerSpawned hook.


RE: Countdown - daniel0916 - 01-15-2014

(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?


RE: Countdown - xoft - 01-15-2014

Yes, it should be.


RE: Countdown - daniel0916 - 01-15-2014

How can i make a list?
I will add/remove there players who are alive. (for a minigame)


RE: Countdown - xoft - 01-15-2014

Use a Lua table, index by number.


RE: Countdown - daniel0916 - 01-15-2014

(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 ??


RE: Countdown - NiLSPACE - 01-15-2014

-- 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