SA-MP Forums Archive
Bank anti-rob 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)
+--- Thread: Bank anti-rob timer. (/showthread.php?tid=455331)



Bank anti-rob timer. - Kapone21 - 01.08.2013

On my server for example:
Player 1 : /rob [ you need to go to the red checkpoint (SCM)]
Player 2: /ROB ! [ and work like to player 1]


how can i make after a rob all players need to wait 30 minutes to rob again ?


Re: Bank anti-rob timer. - RajatPawar - 01.08.2013

pawn Код:
new _timer = 0;

CMD:rob(..)
{
      if( (_timer - GetTickCount()) < TIME_YOU_WANT) dont allow robbery
      else
      _timer = GetTickCount();
}



Re: Bank anti-rob timer. - Amel_PAtomAXx - 01.08.2013

pawn Код:
new RobTimer[MAX_PLAYERS];

    if (strcmp("/rob", cmdtext, true) == 0)
    {
        if[RobTimer[playerid] == 0)
        {
            RobTimer[playerid] = 1;
            SetTimerEx("CanRobAgain",30*60000,false,"i",playerid);
            //    Rest of your code goes here (GivePlayerMoney, etc)
        }
        else
        {
            SendClientMessage(playerid,0xFFFFFFFF, "You have to wait 30 minutes to rob again.");
        }
        return 1;
    }

forward CanRobAgain (i);
public CanRobAgain (i)
{
    RobTimer[i] = 0;
    SendClientMessage(i, 0xFFFFFFFF, "You can now rob again.");
    return 1;
}



Re: Bank anti-rob timer. - Kapone21 - 01.08.2013

no good.
1)Don't understand nothing what he do
2)NEED FOR ALL PLAYERS NOT FOR ONLY ONE


Re: Bank anti-rob timer. - PrinceKumar - 01.08.2013

Make a loop
for(new i = 0; i < MAX_PLAYERS; i ){// Do stuff here}