SA-MP Forums Archive
ZCMD SetTimer Help! - 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: ZCMD SetTimer Help! (/showthread.php?tid=347980)



ZCMD SetTimer Help! - Tupuc - 03.06.2012

Hello all, Im trying to set a timer for this line " SetTimer("UnsetBankRob",21600,false);" to set the value of " BankRobbedRecently = 0;" Back to Zero

Код:
//START: Reset Bank Robbery Command

CMD:resetbankk(playerid, params[])
{
        if( PlayerInfo[ playerid ] [ pAdmin ] >= 99999 ) {
                                                BankRobbedRecently = 0;
                                                for(new i = 0; i < MAX_PLAYERS; i++)
{
     PlayerInfo[i][pRobTime] = 0;
}
                                 new string[128];
                          format( string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has reset the bank robbery timer.", GetPlayerNameEx( playerid ) );
                          ABroadCast( COLOR_YELLOW, string, 4 );
                }
                else {
                    SendClientMessageEx( playerid, COLOR_GREY, "Command is not in your authority to be used!" );
                }
        return 1;
}

//END: Reset Bank Robbery Command

//START: Bank Robbery Command

forward UnsetBankRob();
public UnsetBankRob()
{
        BankRobbedRecently = 0;
        return 1;
}
CMD:robbank(playerid, params[])
        {
            new success = random(2);
            if(BankRobbedRecently == 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* This location was robbed recently, try again later");
                    return 1;
                }
                if(PlayerInfo[playerid][pRobTime] >= 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* You already attempted or robbed a place recently, please wait.-jake is god");
                    return 1;
                }



     if(!IsAtRobBankPoint(playerid))
            {
                if(GetPlayerWeapon(playerid) >= 24 && GetPlayerWeapon(playerid) <= 40)
                        {
                        if(PlayerInfo[playerid][pDuty] == 0)
                                {
                                if(success == 1)
                                        {
                                        SendClientMessage(playerid, COLOR_ORANGE, "* You are now Robbing the Los Santos bank, please remain in the checkpoint for 500 Seconds!");
                            RobbingTime[playerid] = 30;
                                    WantedPoints[playerid] = 6;
                                    SetPlayerCriminal(playerid,255, "Robbing the Bank");
                                    PlayerInfo[playerid][pRobTime] = 0;
                                    BankRobbedRecently = 1;
                                                                        GivePlayerCash(playerid, 400000);
                                                                        SetTimer("UnsetBankRob",10,0);

                                        }
                                        else
                                        {
                                            SendClientMessage(playerid, COLOR_ORANGE, "* You failed to rob the Bank!");
                                            WantedPoints[playerid] = 2;
                                    SetPlayerCriminal(playerid,255, "Attempting to rob the Bank");
                                                PlayerInfo[playerid][pRobTime] = 0;
                                        }
                                }
                                else
                                {
                                    SendClientMessage(playerid, COLOR_GREY, "* Go Off duty first!");
                                    return 1;
                                }
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "* You need a deadly weapon to perform this Act!");
                            return 1;
                        }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "* You're not at the Bank Rob Point!");
                    return 1;
                }
                return 1;
        }

//END: Bank Robbery Command
If you can help me it would be very helpful, thanks.


Re: ZCMD SetTimer Help! - .FuneraL. - 03.06.2012

Use:

pawn Код:
SetTimerEx("UnsetBankRob", 21600, true, "i", playerid);
And try.


Re: ZCMD SetTimer Help! - Tupuc - 03.06.2012

Thanks trying it now, If it doesn't work ill come back for your help if you dont mind.


Re: ZCMD SetTimer Help! - Tupuc - 03.06.2012

I have got no errors adding it in, buts its letting me rob the bank constantly now?