[SOLVED] How do i make a timer in lua?
#5
(10-29-2016, 04:05 AM)xoft Wrote: You should put it wherever you want the task to be started - if it is by a reaction to a player command, then the player command handler is the right place. If it should be done, say, if a player is killed, then the HOOK_KILLED is the right place.

As for the current world, "current for whom?" Each player has a world assigned to them, accessible via cPlayer:GetWorld(). Similarly, entities have a cEntity:GetWorld().

There is no task waiting to be started, i want it to be real time
I will tell you what i need to do, i want to spawn a minecart every second if i use WorldTicks
it will spawn a minecart  20 times a second and i don't want that


As for the current world i want to get a specific player for example player name = "Steve"
it will get his world then spawn a minecart in steve's world every second

also how can i get a class for example i would do
Note: This code is obliviously wrong because function GetClass doesn't exist  
Code:
--Gets the player
player1 = GetClass(player)
if( player1:GetName() == 'Steve' ) then
    --Defines item as redstone
    Redstone = cItem(E_ITEM_REDSTONE)
    Redstoneitem = cItems:Add(Redstone)
    --Get the player's current world
    world = player1:GetWorld()
    --Spawn the item
    world:SpawnItemPickups(Redstoneitem,0,0,0,3000,0)
end
This would solve my problem.
Reply
Thanks given by:


Messages In This Thread
[SOLVED] How do i make a timer in lua? - by denwo - 10-19-2016, 10:49 PM
RE: How do i make a timer in lua? - by NiLSPACE - 10-19-2016, 10:53 PM
RE: How do i make a timer in lua? - by denwo - 10-29-2016, 03:16 AM
RE: How do i make a timer in lua? - by xoft - 10-29-2016, 04:05 AM
RE: How do i make a timer in lua? - by denwo - 10-29-2016, 05:42 AM
RE: How do i make a timer in lua? - by PureTryOut - 10-29-2016, 08:49 AM



Users browsing this thread: 1 Guest(s)