SA-MP Forums Archive
timer - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: timer (/showthread.php?tid=84021)



timer - radi - 28.06.2009

how can i add a timer off 5 min on this cmd
so you can only use it in 5 minutes

pawn Код:
if(strcmp(cmd, "/hackpolice", true) == 0 && IsPlayerConnected(playerid))
    {
        if(PlayerToPoint(3.0, playerid, 2290.2595,2430.9697,10.8203) && PlayerInfo[playerid][pRank] >= -1 && IsPlayerConnected(playerid))
        {
            {
            GivePlayerMoney(playerid,5000);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "%s Has Hacked The police",sendername);
            SendClientMyessageToAll(COLOR_RED, string);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "YOU ARE NOT A HAXOR");
        }
        return 1;
    }



Re: timer - illay - 28.06.2009

SetTimerEx("HeliCMD",(((5*10)*10)*10),false,"i",pl ayerid);

public HeliCMD();

public HeliCMD(){
//command code
return 1;
}


Re: timer - Grim_ - 28.06.2009

Don't make the computer do calculations that you can do
300000 miliseconds = 5 minutes.


Re: timer - radi - 28.06.2009

Quote:
Originally Posted by David.
SetTimerEx("HeliCMD",(((5*10)*10)*10),false,"i",pl ayerid);

public HeliCMD();

public HeliCMD(){
//command code
return 1;
}
omg thats not what i need
i need that in my cmd because i am a noob scripter


Re: timer - radi - 28.06.2009

can some one help me ?


Re: timer - Grim_ - 28.06.2009

pawn Код:
//top
new CanUse[MAX_PLAYERS];

//onplayercommandtext
if(strcmp(cmd, "/hackpolice", true) == 0 && IsPlayerConnected(playerid))
{
if(PlayerToPoint(3.0, playerid, 2290.2595,2430.9697,10.8203) && PlayerInfo[playerid][pRank] >= -1 && IsPlayerConnected(playerid))
 {
   if(CanUse[playerid] == 1)

{
GivePlayerMoney(playerid,5000);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s Has Hacked The police",sendername);
SendClientMyessageToAll(COLOR_RED, string);
CanUse[playerid] = 0;
SetTimerEx("AbleToUse", 300000, 0, "i", playerid);
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "YOU ARE NOT A HAXOR");
}
return 1;
}

//bottom
forward AbleToUse(playerid);
public AbleToUse(playerid)
{
  CanUse[playerid] = 1;
}



Re: timer - radi - 28.06.2009

ehmm
i tested it
if i want to compile it
my pawno crashes
please show how many tabs and there most be
like my first post!!!!!!!!!!!


Re: timer - radi - 29.06.2009

ehmm
i tested it
if i want to compile it
my pawno crashes
please show how many tabs and there most be
like my first post!!!!!!!!!!!