SA-MP Forums Archive
timers - 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: timers (/showthread.php?tid=403531)



timers - Chrillzen - 30.12.2012

pawn Код:
COMMAND:ajail(playerid, params[])
{
    new id, name1[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME], reason[256], string[128];
   
    if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED,"You're not allowed to do this.");
   
    if(sscanf(params,"us[128]", id, reason)) return SCM(playerid, COLOR_GREY,"Usage: /ajail [playerid/partofname] [reason].");
    if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_RED,"That player is not online.");

            SetPlayerPos(id, 264.4829,77.8406,1001.0391);
            SetPlayerInterior(id, 6);
           
            GetPlayerName(playerid,name1,sizeof(name1));
            GetPlayerName(id,name2,sizeof(name2));
            SetTimer("ajail", 300000, false);
            format(string, sizeof(string), "AdmCmd: %s was adminjailed for 5 minutes by %s, reason: %s.",name2 ,name1, reason);
            SendClientMessageToAll(COLOR_LIGHTRED,string);
           
    return 1;
}
pawn Код:
public ajail(playerid)
{
    SCM(playerid, COLOR_WHITE, "You are free.");
    SetPlayerPos(playerid, 1545.8035,-1676.5547,13.5611);
    SetPlayerInterior(playerid, 0);
    return 1;
}
I never get out from ajail, seems like timer never starts.


Re: timers - RedCrossER - 30.12.2012

pawn Код:
SetTimer("ajail", 300000, false); <<< Wrong
Use This:
pawn Код:
SetTimerEx("ajail", 300000, false, "i", id);