need some help from you
#1

Guyz, I'm using this. I want to add if player get arrested or get killed while robbing so robbery should be canceled. I tried but didn't get something cool. Can you help me? Thanks!

PHP код:
CMD:robbank(playerid,params[])
{
 if(
gTeam[playerid] == CIVILIANS)
 {
   if(
IsPlayerInDynamicCP(playeridBankRobbery)) // Checking if player is in the checkpoint
   
{
        if(
bankrobbedrecently1 == 0//checking if tatoo shop has been robbed recently
        
{
            new 
chances random(500);
            if(
chances >= && chances <= 400)
            {
               new 
string[250];
               
ROBBING_BANK1[playerid] = 30// setting the robbery timer
                 
bankrobbedrecently1 =200// Time the players needs to wait for starting an another robbery in the same place
                 
SetPlayerWantedLevel(playerid,4);
                 
format(stringsizeof(string), "Committed A Crime: Bank Robbery - Wanted Level 4 - Arrestable");
                 
SendClientMessage(playeridROJOstring);
               return 
true;
            }
            else if(
chances >= 401 && chances <= 500)
            {
               new 
copmsg[250], name;
                  
SendClientMessage(playeridCOLOR_RED"You failed to rob store.");
                
SetPlayerWantedLevel(playerid,4);
               
format(copmsgsizeof(copmsg), "Suspected: %s attemped to rob National Bank in Downtown San Fierro (SF)."name);
               
SendRadioMessageToCops(copmsg);
               return 
true;
            }
        }
        else if(
bankrobbedrecently1 0) return SendClientMessage(playeridROJO"Please wait before robbing this store again.");
   } 
PHP код:
if(ROBBING_BANK1[i] == 1// IF the timer reached 1
                
{
                    new 
string[256], pName[MAX_PLAYER_NAME];// getting player name
                    
GetPlayerName(i,pName,MAX_PLAYER_NAME);
                    
ROBBING_BANK1[i] =0// RESET timer
                    
new earning =random(95000);
                    
format(string,sizeof(string),"%s (%d) has stolen $%d from National Bank in Downtown San Fierro (SF)!",pName,i,earning);
                    
SendClientMessageToAll(COLOR_CYAN,string);
                    
format(string,sizeof(string),"ROBBERY COMPLETED");
                    
GameTextForPlayer(i,string10003);
                    
format(string,sizeof(string),"Gread Job! You completed the robbery, profit: $%d"earning); //sending message to the player that robbery was complete
                    
SendClientMessage(i,GREEN,string);
                    
GivePlayerCashEx(iearning);
                    
SetPlayerWantedLevel(iGetPlayerWantedLevel(i) + 1); //giving player 1 wanted level
                    
GivePlayerScore(i,1);
                    
pInfo[i][pStoreRobbed] ++;
                    
pInfo[i][pStoreRobbedMoney] = pInfo[i][pStoreRobbedMoney] +earning;
                }
                if(
ROBBING_BANK2[i] > // Checking if robbery time is above 1
                
{
                    
ROBBING_BANK2[i] --; // Decreasing time
                    
new time[256]; //adding time variable
                    
format(time,sizeof(time),"~y~Robbery Time: %d~n~~r~DO NOT MOVE UNTIL THE~n~ROBBERY IS COMPLETED",ROBBING_BANK2[i]);
                    
GameTextForPlayer(i,time,3000,3); //shows gametext showing the time remaining for the robbery
                
}
                if(
ROBBING_BANK2[i] == 1// IF the timer reached 1
                
{
                    new 
string[256], pName[MAX_PLAYER_NAME];// getting player name
                    
GetPlayerName(i,pName,MAX_PLAYER_NAME);
                    
ROBBING_BANK2[i] =0// RESET timer
                    
new earning =random(95000);
                    
format(string,sizeof(string),"%s (%d) has stolen $%d from National Bank in EL Quebrados (BC)!",pName,i,earning);
                    
SendClientMessageToAll(COLOR_CYAN,string);
                    
format(string,sizeof(string),"ROBBERY COMPLETED");
                    
GameTextForPlayer(i,string10003);
                    
format(string,sizeof(string),"Gread Job! You completed the robbery, profit: $%d"earning); //sending message to the player that robbery was complete
                    
SendClientMessage(i,GREEN,string);
                    
GivePlayerCashEx(iearning);
                    
SetPlayerWantedLevel(iGetPlayerWantedLevel(i) + 1); //giving player 1 wanted level
                    
GivePlayerScore(i,1);
                    
pInfo[i][pStoreRobbed] ++;
                    
pInfo[i][pStoreRobbedMoney] = pInfo[i][pStoreRobbedMoney] +earning;
                } 
Onleavecheckpoint

PHP код:
if(checkpointid == BankRobbery)
    {
       
TextDrawHideForPlayer(playeridbanktd);
       
TextDrawHideForPlayer(playeridbanktdbox);
       if(
ROBBING_BANK1[playerid] >= 1//checking if the person was robbing and his robbery timer was above 1
       
{
            
SendClientMessage(playeridROJO"You have left checkpoint. Robbery Failed"); //Error message that he failed
            
GameTextForPlayer(playerid,"~r~Robbery Failed"30005);
            
ROBBING_BANK1[playerid] =0// Setting Robbing_tatoo to 0. to stop the counter
            
HasDied{playerid} = true;
            return 
1;
       }
    }
    if(
checkpointid == BankRobbery2)
    {
       
TextDrawHideForPlayer(playeridbanktd);
       
TextDrawHideForPlayer(playeridbanktdbox);
       if(
ROBBING_BANK2[playerid] >= 1//checking if the person was robbing and his robbery timer was above 1
       
{
            
SendClientMessage(playeridROJO"You have left checkpoint. Robbery Failed");
            
GameTextForPlayer(playerid,"~r~Robbery Failed"30005); //Error message that he failed
            
ROBBING_BANK2[playerid] =0// Setting Robbing_tatoo to 0. to stop the counter
            
HasDied{playerid} = true;
            return 
1;
       }
    } 
Reply


Messages In This Thread
need some help from you - by STONEGOLD - 13.06.2015, 22:02
Re: need some help from you - by STONEGOLD - 14.06.2015, 01:10
Re: need some help from you - by WilliamOordt - 14.06.2015, 02:09

Forum Jump:


Users browsing this thread: 1 Guest(s)