Help Please
#3

bracket ~.~

PHP код:
COMMAND:rob(playeridparams[]){
    if(
PlayerInfo[playerid][pSpawned] == 1){
        new 
idx,giveplayerid,string[256],tmp[256],amount;
        
tmp strtok(paramsidx);
        if(!
strlen(tmp)){
            new 
Players;
            for(new 
0GetMaxPlayers(); i++){
                if(
IsPlayerConnected(i) && != playerid && PlayerInfo[i][pSpawned] == && GetDistanceBetweenPlayers(playerid,i) < 10){
                    
Players ++;
                    if(
Players 0giveplayerid i; break;
                }
            }
            if(
Players == 0) return SendClientMessage(playeridCOLOR_ERROR"No Players Close Enough To Rob.");
        } else {
            
giveplayerid strval(tmp);
            if(!
IsPlayerConnected(giveplayerid)){
                
format(stringsizeof(string), "That Player Is Not Connected.");
                
SendClientMessage(playeridCOLOR_ERRORstring);
                return 
1;
            }
        }
        if(
giveplayerid == playerid){
            
SendClientMessage(playeridCOLOR_ERROR"You Cannot Rob Yourself.");
            return 
1;
        }
        if(
PlayerInfo[playerid][pJailed] == 1){
            
SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command In Jail.");
            return 
1;
        }
        if(
GetDistanceBetweenPlayers(playerid,giveplayerid) > 3){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(giveplayerid)){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerState(giveplayerid) != PLAYER_STATE_ONFOOT){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT && GetPlayerState(giveplayerid) == PLAYER_STATE_ONFOOT){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
PlayerInfo[playerid][pRobTime] > 0){
            
SendClientMessage(playeridCOLOR_ERROR"Please Wait Before Attempting To Rob Someone Again.");
            return 
1;
        }
        if(
PlayerInfo[playerid][pJailed] == 1){
            
SendClientMessage(playeridCOLOR_ERROR"You Can't use this command In Jail.");
            return 
1;
        }
        switch(
random(10)){
            case 
1..5 : {
                
PlayerInfo[playerid][pRobTime] = 30;
                
amount GetPlayerMoney(giveplayerid)/4;
                if(
GetPlayerMoney(giveplayerid) >= 1500000){
                    
amount 500000;
                    
amount GetPlayerMoney(giveplayerid)/32;
                    
format(stringsizeof(string), "You Have Robbed $%d From %s(%d).",amount,PlayerInfo[giveplayerid][pName],giveplayerid);
                    
SendClientMessage(playeridCOLOR_SKYBLUEstring);
                    
format(stringsizeof(string), "ROBBED %s~N~~G~$%d",PlayerInfo[giveplayerid][pName],amount);
                    
GameTextForPlayer(playerid,string40003);
                    
format(stringsizeof(string), "%s(%d) Has Robbed $%d From You.",PlayerInfo[playerid][pName],playerid,amount);
                    
SendClientMessage(giveplayeridCOLOR_SKYBLUEstring);
                    
format(stringsizeof(string), "ROBBED BY %s~n~~G~$%d",PlayerInfo[playerid][pName],amount);
                    
GameTextForPlayer(giveplayerid,string40003);
                    
LastRobbed[playerid] = giveplayerid;
                    
GivePlayerMoney(giveplayerid, - amount);
                    
GivePlayerMoney(playeridamount);
                    
SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
                    
SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) - 1);
                }
            }
            case 
6..9 : {
                
PlayerInfo[playerid][pRobTime] = 20;
                
format(stringsizeof(string), "You Have Failed To Rob %s(%d).",PlayerInfo[playerid][pName],giveplayerid);
                
SendClientMessage(playeridCOLOR_SKYBLUEstring);
                
format(stringsizeof(string), "Robbery Attempt Failed"PlayerInfo[playerid][pName],amount);
                
GameTextForPlayer(playerid,string40003);
                
format(stringsizeof(string), "%s(%d) Has Failed To Rob You.",PlayerInfo[playerid][pName],playerid);
                
SendClientMessage(giveplayeridCOLOR_SKYBLUEstring);
            }
        }
    } else {
        
SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command When You're Dead.");
    }
    return 
1;

Reply


Messages In This Thread
Help Please - by CrazyPerry - 05.12.2015, 07:37
Re: Help Please - by TwinkiDaBoss - 05.12.2015, 08:08
Re: Help Please - by AbyssMorgan - 05.12.2015, 08:34
Re: Help Please - by CrazyPerry - 05.12.2015, 09:33

Forum Jump:


Users browsing this thread: 1 Guest(s)