Create/Destroy object timer - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Create/Destroy object timer (
/showthread.php?tid=151969)
Create/Destroy object timer -
reallifescript - 01.06.2010
Hello
I am in need of the following thing but don't know how to create it
A command wich create a object (i can do this), starts a timer (5 seconds) and when the timer is over the object is destroyed
Can someone help me with this?
-Reallifescript
Re: Create/Destroy object timer -
Naxix - 01.06.2010
Just give a object at name like
Код:
TestObjeckt = CreateObjeckt(...)
At the timer just
Код:
DestroyObjeckt(TestObjeckt);
I think that should do it.
Re: Create/Destroy object timer -
-Rebel Son- - 01.06.2010
KillTimer..
Re: Create/Destroy object timer -
Naxix - 01.06.2010
Quote:
Originally Posted by _Ч§hмf†ҐЧ™_
KillTimer..
|
Not waht he asked for tho.
Re: Create/Destroy object timer -
reallifescript - 01.06.2010
Just a timer wich can be called with something like /startkart
then it creates a object in front of all the players ( just 1 object, already found it) and then calls 5 seconds
after 5 seconds
the object = destroyed
Re: Create/Destroy object timer -
aircombat - 01.06.2010
That code will create a shark near the player then after 5 seconds , the shark get destroyed

top of script :
Код:
new Object[MAX_PLAYERS];
Under OnPlayerCommandText :
Код:
if (strcmp("/object", cmdtext, true, 7) == 0)
{
new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z);
Object[playerid] = CreateObject(1608,X+2,Y,Z,0,0,0);
SetTimerEx("DestroyObject",5000,0,"i",playerid);
return 1;
}
Bottom Of Script :
Код:
forward DestroyObject(playerid);
public DestroyObject(playerid)
{
DestroyObject(Object[playerid]);
return 1;
}