Timer to destroy an object!!!
#1

FIXED!
Reply
#2

pawn Код:
if(strcmp("/spraycrips", cmdtext, true) == 0)
{
    if (gTeam[playerid] == TEAM_GROVE) {
        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerFacingAngle(playerid,a);
        GetPlayerPos(playerid, x, y, z);
        SetTimerEx("DestroyObject", 60000, false, "i", CreateObject(1524, x, y, z, 0.0, 0.0, a+90));
    }
    else {
        SendClientMessage(playerid,COLOR_RED, "[ERROR:] You are not in this gang!");
    }
    return 1;
}
Will destroy the object 60 seconds from creation.
Reply
#3

pawn Код:
// do like this

// this on your command
if (strcmp("/your command", cmdtext, true, 10) == 0)
SetTimer("destroy", 8000, false); // 1000 miliseconds (1 second)

// this on bottom of your gamemode or filterscript
forward destroy();
public destroy()
{
    DestroyObject(your object id);
}
LATE
Reply
#4

Thank you guys but i fixed it myself :P (like jiwan's way).
Reply
#5

Quote:
Originally Posted by Chrillzen
Посмотреть сообщение
Thank you guys but i fixed it myself :P (like jiwan's way).
Using that method you have to have a global id variable and a function when you can just use one line of code to create the object and destroy it.
Reply
#6

Quote:
Originally Posted by Norn
Посмотреть сообщение
Using that method you have to have a global id variable and a function when you can just use one line of code to create the object and destroy it.
yeah true
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)