Zcmd Rob command wont give cash help please
#1

hey i scriped this little rob (id) command but i am having a prolem were i i rob other people but it wont give the the a guy who robbed the money yes everything work as the player dont have cash , and all that, but when player have cash and the robber try to rob the player it will rob the player but the robber wont get money , and the player who got robbed wont lose the ammount of money the robber robbed here is my code can anyone see whats wrong thank you,

PHP код:
cmd(robplayeridparams[])
{
    new 
ID; new string[120];
     if(
gTeam[playerid] != Team_Steal && gTeam[playerid] != Team_Terror && gTeam[playerid] != Team_Rape && gTeam[playerid] != Team_Civi && gTeam[playerid] != TEAM_HITMAN)
        return 
SendClientMessage(playeridCOLOR_RED"You Must be a Civil to use this command.");
    if(
GetPVarInt(ID"HasSecureWallet") == 1)
     {
          
SendClientMessage(playeridCOLOR_RED"That player had a SecureWallet. You failed to rob them.");
        
SendClientMessage(IDCOLOR_RED"Your SecureWallet has protected you from a A robbery. You Have lost lost a Securewallet");
        return 
1;
    }
    if(
GetPVarInt(playerid"Jailed") == 1)
        return 
SendClientMessage(playeridCOLOR_RED"You cannot use this command in jail.");
    if(
GetPVarInt(playerid"Cuffed") == 1)
        return 
SendClientMessage(playeridCOLOR_RED"You cannot use this command while cuffed.");
    if(
sscanf(params"u"ID))
        return 
SendClientMessage(playeridCOLOR_ERROR"Usage: /rob (ID)");
    if(!
IsPlayerConnected(ID))
        return 
SendClientMessage(playeridCOLOR_RED"Invalid Player ID.");
    if(
GetPlayerMoney(ID) <=0)
        return 
SendClientMessage(playeridCOLOR_RED"That player doesn't have any money.");
    if(
GetDistanceBetweenPlayers(playeridID) > 5)
        return 
SendClientMessage(playeridCOLOR_RED"That player is too far away.");
    if(
IsPlayerInAnyVehicle(playerid))
        return 
SendClientMessage(playeridCOLOR_RED"You cannot use this command while in a vehicle.");
    if(
IsPlayerInAnyVehicle(ID))
        return 
SendClientMessage(playeridCOLOR_RED"You cannot rob them when they are in a vehicle.");
    if(
GetPVarInt(playerid"RobbedPlayerRecent") >= 1)
        return 
SendClientMessage(playeridCOLOR_RED"You must wait before robbing a player again.");
    new 
chance random(10);
    if(
chance == 1)
        return 
SendClientMessage(playeridCOLOR_RED"You failed the robbery.");
    new 
mrand random(GetPlayerMoney(ID));
    new 
current_zone player_zone[playerid];
    if(
IsCop(ID))
    {
        
format(string120"[ROBBED] %s has robbed $%d from you!"PlayerInfo(playerid), mrand);
        
SendClientMessage(IDCOLOR_REDstring);
        
format(string120"[ROBBERY] You robbed $%d from %s!"mrandPlayerInfo(ID));
        
SendClientMessage(playeridCOLOR_REDstring);
        
GivePlayerMoney(playerid,mrand);
        
format(string120"[ROBBERY] %s robbed $%d from %s!"PlayerInfo(playerid), mrandPlayerInfo(ID));
        
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
        
CNR_PrintString(string);
        
format(string120"[DISPATCH] %s has been robbed by %s. Location: %s"PlayerInfo(ID), PlayerInfo(playerid), playerid,zones[current_zone][zone_name]);
        
SendCopMessage(string);
        
format(string120"Type /radioof to turn off the Police Radio.");
        
SendCopMessage(string);
        
IncreaseWantedLevel(playerid2);
        
IncreaseScore(playerid2);
        if(
GetPVarInt(playerid"RobSkill") <= 3)
        {
            
SetPVarInt(playerid"RobSkill"GetPVarInt(playerid"RobSkill") +1);
            
format(string120"[SKILL UPGRADE] Your robbing skill has increased. Read /robjob.");
            
SendClientMessage(playeridCOLOR_GREYstring);
        }
        return 
1;
    }
    if(
AttemptedToRobRecently[playerid] >= 1)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You are too tired from your last rob attempt. Please wait before robbing again.");
        return 
1;
    }
    if(
HasRobbedRecently[playerid] >= 1)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"You are too tired from the last person you robbed. Please wait before robbing again.");
        return 
1;
    }
    if(
GetPlayerMoney(ID) <= 0)
    {
        
SendClientMessage(playerid,COLOR_ERROR,"That player has no money in their pockets. What would be the point in robbing them?");
        return 
1;
    }
     
format(string120"[ROBBED] %s has robbed $%d from you!"PlayerInfo(playerid), mrand);
    
SendClientMessage(IDCOLOR_REDstring);
    
format(string120"[ROBBERY] You robbed $%d from %s!"mrandPlayerInfo(ID));
    
SendClientMessage(playeridCOLOR_REDstring);
    
format(string120"[ROBBERY] %s robbed $%d from %s!"PlayerInfo(playerid), mrandPlayerInfo(ID));
    
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
    
CNR_PrintString(string);
    
format(string120"[DISPATCH] %s has been robbed by %s. Location: %s"PlayerInfo(ID), PlayerInfo(playerid), playerid,zones[current_zone][zone_name]);
    
SendCopMessage(string);
    
format(string120"Type /radioof to turn off the Police Radio.");
    
SendCopMessage(string);
    
IncreaseWantedLevel(playerid1);
    
IncreaseScore(playerid1);
    if(
GetPVarInt(playerid"RobSkill") <= 3)
    {
        
SetPVarInt(playerid"RobSkill"GetPVarInt(playerid"RobSkill") +1);
        
format(string120"[SKILL UPGRADE] Your robbing skill has increased. Read /robjob.");
        
SendClientMessage(playeridCOLOR_GREYstring);
    }
    return 
1;

Reply
#2

Do you have an anticheat that resets the GivePlayerMoney function?
Reply
#3

Quote:
Originally Posted by AaronKillz
Посмотреть сообщение
Probably because you never decreased anyones money. You just sent messages out that said someone was robbed. ZCMD won't magically decrease their money, it isn't even related to it.
jajaja lol omg thank you u rite i call this brain fart ill rate u *****


and yes
Reply
#4

i fix it i forgot to the funtion this

new ID;
GivePlayerMoney(playerid,mrand); // that will give the player who robed the money
AND
GivePlayerMoney(ID,mrand); // this will take away what the player robbed
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)