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



commands /robbank - sscarface - 10.02.2013

I added robbank recent system if someone robbank so 2nd player need wait 3min for robbing again. But if someone robbed lv bank and 2nd player can't rob sf bank they need wait 3 mins , i want they should for lv bank because player robbed lv bank not sf.

here is cmd:

PHP код:
CMD:robbank(playeridparams[])
{
    if(
GetTeam{playerid} != CLASS_CIV) return SendClientMessage(playeridRED"Only civilians can rob places.");
    if(
IsRobbingBank1{playerid} == true) return SendClientMessage(playeridRED"Your already robbing the joint.");
    if(
IsRobbingBank2{playerid} == true) return SendClientMessage(playeridRED"Your already robbing the joint.");
    if(
IsRobbingBank3{playerid} == true) return SendClientMessage(playeridRED"Your already robbing the joint.");
    if(
IsRobbingBank4{playerid} == true) return SendClientMessage(playeridRED"Your already robbing the joint.");
    if(
alreadyrob == 1){ }else return SendClientMessage(playeridRED"This Bank Has Been Robbed Recently. Please Wait Before Robbing It Again.");
    if(
IsPlayerHoldingAGun(playerid) == || HasBeenCuffed{playerid} == true) return SendClientMessage(playeridRED"You must be holding a gun to rob places.");
    if((
gettime() - 5) < TimerInfo[playerid][CMD_timer23]) return SendClientMessage(playeridRED"Please wait before using this command again.");
    
TimerInfo[playerid][CMD_timer23] = gettime();
    if(
IsPlayerInRangeOfPoint(playerid,1.0,2316.6169,-7.3947,26.7422) && GetPlayerVirtualWorld(playerid) == 1)
    {
        new 
chance random(3);
        if(
chance == 0)
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            
format(fstrsizeof(fstr),  "%s (%d) has attempted to rob the Bank at Roco Escalante (LV)."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
SendClientMessage(playeridRED"You have failed to rob the Bank.");
            
GameTextForPlayer(playerid"~w~Robbery ~r~Failed"50005);
            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 4);
        }
        else
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            if((
gettime() - 5) < bank1robbed) return SendClientMessage(playeridRED"This place has been robbed recently, try again later.");
            
format(fstrsizeof(fstr), "%s (%d) is now robbing the Bank at Roco Escalante (LV)."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
format(fstrsizeof(fstr), "Committed A Crime: Post Bank Robbery - Wanted Level %d - Arrestable"WantedLevelStars);
            
SendClientMessage(playeridLIGHTGREEN"You're Robbing the Bank, DON'T LEAVE THE CHECKPOINT!");
            
IsRobbingBank1{playerid} = true;
            
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+6);
            
ApplyAnimation(playerid,"ped","ARRESTgun",4.1,0,1,1,1,1);
            
bank1robbed gettime();
            
banktimer{playerid} = SetTimerEx("BankRob"30000false"d"playerid);
            
CountDownRobbery(playerid30);
            
alreadyrob 0;
            
SetTimer("togglerob"300000false);
        }
    }
    else if(
IsPlayerInRangeOfPoint(playerid,1.0,2316.6169,-7.3947,26.7422) && GetPlayerVirtualWorld(playerid) == 2)
    {
        new 
chance random(3);
        if(
chance == 0)
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            
format(fstrsizeof(fstr),  "%s (%d) has attempted to rob the Bank at El Quebrados."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
SendClientMessage(playeridRED"You have failed to rob the Bank.");
            
GameTextForPlayer(playerid"~w~Robbery ~r~Failed"50005);
            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 4);
        }
        else
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            if((
gettime() - 5) < bank2robbed) return SendClientMessage(playeridRED"This place has been robbed recently, try again later.");
            
format(fstrsizeof(fstr), "%s (%d) is now robbing the Bank at El Quebrados."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
format(fstrsizeof(fstr), "Committed A Crime: Post Bank Robbery - Wanted Level %d - Arrestable"WantedLevelStars);
            
SendClientMessage(playeridLIGHTGREEN"You're Robbing the Bank, DON'T LEAVE THE CHECKPOINT!");
            
IsRobbingBank2{playerid} = true;
            
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+6);
            
ApplyAnimation(playerid,"ped","ARRESTgun",4.1,0,1,1,1,1);
            
bank2robbed gettime();
            
banktimer{playerid} = SetTimerEx("BankRob"30000false"d"playerid);
            
CountDownRobbery(playerid30);
            
alreadyrob 0;
            
SetTimer("togglerob"300000false);
        }
    }
    else if(
IsPlayerInRangeOfPoint(playerid,1.0,2316.6169,-7.3947,26.7422) && GetPlayerVirtualWorld(playerid) == 3)
    {
        new 
chance random(3);
        if(
chance == 0)
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            
format(fstrsizeof(fstr),  "%s (%d) has attempted to rob the Bank at Fort Carson."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
SendClientMessage(playeridRED"You have failed to rob the Bank.");
            
GameTextForPlayer(playerid"~w~Robbery ~r~Failed"50005);
            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 4);
        }
        else
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            if((
gettime() - 5) < bank3robbed) return SendClientMessage(playeridRED"This place has been robbed recently, try again later.");
            
format(fstrsizeof(fstr), "%s (%d) is now robbing the Bank at Fort Carson."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
format(fstrsizeof(fstr), "Committed A Crime: Post Bank Robbery - Wanted Level %d - Arrestable"WantedLevelStars);
            
SendClientMessage(playeridLIGHTGREEN"You're Robbing the Bank, DON'T LEAVE THE CHECKPOINT!");
            
IsRobbingBank3{playerid} = true;
            
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+6);
            
ApplyAnimation(playerid,"ped","ARRESTgun",4.1,0,1,1,1,1);
            
bank3robbed gettime();
            
banktimer{playerid} = SetTimerEx("BankRob"30000false"d"playerid);
            
CountDownRobbery(playerid30);
            
alreadyrob 0;
            
SetTimer("togglerob"300000false);
        }
    }
    else if(
IsPlayerInRangeOfPoint(playerid,1.0,2316.6169,-7.3947,26.7422) && GetPlayerVirtualWorld(playerid) == 4)
    {
        new 
chance random(3);
        if(
chance == 0)
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            
format(fstrsizeof(fstr),  "%s (%d) has attempted to rob the Bank at Tierra Robada."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
SendClientMessage(playeridRED"You have failed to rob the Bank.");
            
GameTextForPlayer(playerid"~w~Robbery ~r~Failed"50005);
            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 4);
        }
        else
        {
            if(
GetPlayerWantedLevel(playerid) >= 4) return SendClientMessage(playeridRED"You Have A Wanted Level For Your Arrest. You Can Not Rob A Bank.");
            if((
gettime() - 5) < bank4robbed) return SendClientMessage(playeridRED"This place has been robbed recently, try again later.");
            
format(fstrsizeof(fstr), "%s (%d) is now robbing the Bank at Tierra Robada."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
format(fstrsizeof(fstr), "Committed A Crime: Post Bank Robbery - Wanted Level %d - Arrestable"WantedLevelStars);
            
SendClientMessage(playeridLIGHTGREEN"You're Robbing the Bank, DON'T LEAVE THE CHECKPOINT!");
            
IsRobbingBank4{playerid} = true;
            
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+6);
            
ApplyAnimation(playerid,"ped","ARRESTgun",4.1,0,1,1,1,1);
            
bank4robbed gettime();
            
banktimer{playerid} = SetTimerEx("BankRob"30000false"d"playerid);
            
CountDownRobbery(playerid30);
            
alreadyrob 0;
            
SetTimer("togglerob"300000false);
        }
    }
    else
    {
        
SendClientMessage(playeridRED"Your not at the robbery checkpoint.");
    }
    new 
astring[100],pName[24];
    
GetPlayerName(playerid,(pName),sizeof(pName));
    
format(astring,sizeof(astring),"%s (%d) typed: /robbank",pName,playerid);
    
SendAdmin1Message(GREY,astring);
    return 
true;

and this is my robbing again timer:

PHP код:
            alreadyrob 0;
            
SetTimer("togglerob"300000false); 



Re: commands /robbank - sscarface - 10.02.2013

bump?


Re: commands /robbank - Misiur - 10.02.2013

Show your togglerob function.

pawn Код:
if(alreadyrob == 1){ }else return SendClientMessage(playerid, RED, "This Bank Has Been Robbed Recently. Please Wait Before Robbing It Again.");
Firstly, change it to something like
pawn Код:
if(alreadyrob != 1) return SendClientMessage(playerid, RED, "This Bank Has Been Robbed Recently. Please Wait Before Robbing It Again.");
Secondly, you have single alreadyrob variable, so no doubt that it will not recognize diffrence between lv/sf or any other bank. Change it to array or something


Re: commands /robbank - blackdragon1 - 10.02.2013

they dnt wnat like this num


Re: commands /robbank - sscarface - 10.02.2013

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Show your togglerob function.

pawn Код:
if(alreadyrob == 1){ }else return SendClientMessage(playerid, RED, "This Bank Has Been Robbed Recently. Please Wait Before Robbing It Again.");
Firstly, change it to something like
pawn Код:
if(alreadyrob != 1) return SendClientMessage(playerid, RED, "This Bank Has Been Robbed Recently. Please Wait Before Robbing It Again.");
Secondly, you have single alreadyrob variable, so no doubt that it will not recognize diffrence between lv/sf or any other bank. Change it to array or something
could you give me any tut? or some codes for example.?? thanks!