14.04.2017, 14:14
Hello there,
For a woodcutting script i need to create something which respawns the tree after a certain period of time when it has been cut down. So there has to be some kind of timer for each tree, i am really stuck on this.
The timer needs to activate at the moment the tree gets cut down.
How can i do this?
Current code:
For a woodcutting script i need to create something which respawns the tree after a certain period of time when it has been cut down. So there has to be some kind of timer for each tree, i am really stuck on this.
The timer needs to activate at the moment the tree gets cut down.
How can i do this?
Current code:
PHP код:
g_Object_Woodcutting[0] = CreateTree(-1975.4630, -2465.3850, 29.7474, 0, 0, 700);
stock CreateTree(Float:X, Float:Y, Float:Z, world,interior,modelid)
{
for(new i = 0; i < sizeof(TreeInfo); i++)
{
if(TreeInfo[i][TreePosX] == 0.0 && TreeInfo[i][TreePosY] == 0.0 && TreeInfo[i][TreePosZ] == 0.0)
{
TreeInfo[i][TreePosX] = X;
TreeInfo[i][TreePosY] = Y;
TreeInfo[i][TreePosZ] = Z;
TreeInfo[i][TreeVWorld] = world;
TreeInfo[i][TreeInterior] = interior;
TreeInfo[i][TreeModelID] = modelid;
Label3[i] = Create3DTextLabel("Tree (Use chainsaw)", ORANGE,X,Y,Z+2.0, 10.0,world, 0);
Tree[i] = CreateDynamicObject(modelid, X, Y, Z,0,0,0, world);
return 1;
}
}
return 1;
}
//cutting down a tree:
TreeInfo[i][Toggled] = 1;
Delete3DTextLabel(Label3[i]);
DestroyDynamicObject(Tree[i]);