10-29-2016, 05:42 AM
(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