SA-MP Forums Archive
Mini timer help nedded - 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: Mini timer help nedded (/showthread.php?tid=308080)



Mini timer help nedded - Gooday - 02.01.2012

pawn Код:
CMD:ar1(playerid, params[])
{
    new id;
    if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288)
    if (sscanf(params, "u", id)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /ar1 [ID]");
    else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[INFO]Player not found");
    else
    {
        SetPlayerPos(id, 264.29998779297, 77.800003051758, 1000.5999755859);
        SetPlayerVirtualWorld(id, -1);
        SetPlayerInterior(id, 6);
        GivePlayerMoney(id, -1500);
        ResetPlayerWeapons(id);
        SendClientMessage(id, COLOR_GOLD, "[INFO]You have been Arrested, Your Sentence is 60 Seconds.");
        SendClientMessage(playerid, COLOR_GOLD, "[INFO]Player Arrested succesfully. (Arrest Type: 1)");
    }
    return 1;
}
How i can free the id after 60 secs? (spawn him in a coord after 60 secs) +REP1!!1!!1!!!!!


Re: Mini timer help nedded - Dark_Kostas - 02.01.2012

Create a global var which will store the seconds of the arrest and then make a timer which each second will reduce by 1 your var. Then make it if it's equal to 0, free him.


Re: Mini timer help nedded - Gooday - 02.01.2012

hOW?!?!'!' post a example please....


Re: Mini timer help nedded - Kaperstone - 02.01.2012

pawn Код:
new ArrestedPlayerID[MAX_PLAYERS];
forward SpawnTime(playerid)
public SpawnTime(playerid)
{
SpawnPlayer(ArrestedPlayerID[playerid]);
}
CMD:ar1(playerid, params[])
{
    new id;
    if(GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288)
    if (sscanf(params, "u", id)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /ar1 [ID]");
    else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[INFO]Player not found");
    else
    {
        SetPlayerPos(id, 264.29998779297, 77.800003051758, 1000.5999755859);
        SetPlayerVirtualWorld(id, -1);
        SetPlayerInterior(id, 6);
        GivePlayerMoney(id, -1500);
        ResetPlayerWeapons(id);
        SendClientMessage(id, COLOR_GOLD, "[INFO]You have been Arrested, Your Sentence is 60 Seconds.");
        SendClientMessage(playerid, COLOR_GOLD, "[INFO]Player Arrested succesfully. (Arrest Type: 1)");
        SetTimer("SpawnTime",60000,false);
        ArrestedPlayerID[playerid] = id;
    }
    return 1;
}