Create/Destroy object timer
#1

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
Reply
#2

Just give a object at name like
Код:
new TestObjeckt;
Код:
TestObjeckt = CreateObjeckt(...)
At the timer just

Код:
DestroyObjeckt(TestObjeckt);
I think that should do it.
Reply
#3

KillTimer..
Reply
#4

Quote:
Originally Posted by _Ч§hмf†ҐЧ™_
KillTimer..
Not waht he asked for tho.
Reply
#5

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
Reply
#6

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)