SA-MP Forums Archive
Objects - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Objects (/showthread.php?tid=372746)



Objects - trapstar2020 - 28.08.2012

If i create a command for a player to create this object when he does this command its creates this object and after a while the object gets delete??


Re: Objects - Lukks90 - 28.08.2012

Some code?


Re: Objects - Benzke - 28.08.2012

Please post the code before asking for a problem.
Anyway.. Is it a toy ?..


Re: Objects - Jarnu - 28.08.2012

To delete that object after a while.
you need to set up a timer and ofc.. define that object

Example:
pawn Код:
new Xyz;
CMD:blab(playerid, params[])
{
Xyz = CreateObject(...);
SetTimer("Delete",15000, false);//15000 = 15 seconds.. you can increase it too like 30000 or more...
return 1;
}

forward Delete();
public Delete()
{
DestroyObject(Xyz);
return 1;
}



Re: Objects - Benzke - 28.08.2012

Quote:
Originally Posted by Jarnu
Посмотреть сообщение
To delete that object after a while.
you need to set up a timer and ofc.. define that object

Example:
pawn Код:
new Xyz;
CMD:blab(playerid, params[])
{
Xyz = CreateObject(...);
SetTimer("Delete",15000, false);//15000 = 15 seconds.. you can increase it too like 30000 or more...
return 1;
}

forward Delete();
public Delete()
{
DestroyObject(Xyz);
return 1;
}
He said that it gets deleted, He doesn't want it to get deleted.


Respuesta: Objects - Siralos - 28.08.2012

Well, the question is not very clear...
For deleting the object I would do:
Код:
CMD:createobject(playerid, params[])
{
    new object = CreateObject(...);
    SetTimerEx("DeleteObject", 15000, 0, "i", object);
}

forward DeleteObject(object);
public DeleteObject(object)
{
    DestroyObject(object);
}