SA-MP Forums Archive
Timer to destroy an object!!! - 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: Timer to destroy an object!!! (/showthread.php?tid=295978)



Timer to destroy an object!!! - Chrillzen - 09.11.2011

FIXED!


Re: Timer to destroy an object!!! - Norn - 09.11.2011

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.


Re: Timer to destroy an object!!! - jiwan - 09.11.2011

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


Re: Timer to destroy an object!!! - Chrillzen - 09.11.2011

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


Re: Timer to destroy an object!!! - Norn - 09.11.2011

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.


Re: Timer to destroy an object!!! - jiwan - 09.11.2011

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