Objects
#1

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

Some code?
Reply
#3

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)