how to add more team to a commands?
#1

hey i want to add more team to use this command is /rob and only thied can use it how can i make rapist terrorist to use it?

Quote:

d(rob, playerid, params[])
{
new ID; new string[120];
if(gTeam[playerid] != Team_Steal)
return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command.");
if(GetPVarInt(playerid, "Jailed") == 1)
return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail.");
if(GetPVarInt(playerid, "Cuffed") == 1)
return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command while cuffed.");
if(sscanf(params, "u", ID))
return SendClientMessage(playerid, COLOR_ERROR, "Usage: /rob (ID)");
if(!IsPlayerConnected(ID))
return SendClientMessage(playerid, COLOR_ERROR, "Invalid Player ID.");
if(GetDistanceBetweenPlayers(playerid, ID) > 5)
return SendClientMessage(playerid, COLOR_ERROR, "That player is too far away.");
if(IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command while in a vehicle.");
if(IsPlayerInAnyVehicle(ID))
return SendClientMessage(playerid, COLOR_ERROR, "You cannot rob them when they are in a vehicle.");
if(GetPVarInt(playerid, "RobbedPlayerRecent") >= 1)
return SendClientMessage(playerid, COLOR_ERROR, "You must wait before robbing a player again.");
new chance = random(10);
if(chance == 1)
return SendClientMessage(playerid, COLOR_ERROR, "You failed the robbery.");
new mrand = random(GetPlayerMoney(ID));
if(GetPlayerMoney(ID) <=0)
return SendClientMessage(playerid, COLOR_ERROR, "That player doesn't have any money.");
new current_zone = player_zone[playerid];
if(IsCop(ID))
{
format(string, 120, "[ROBBED] %s has robbed $%d from you!", PlayerInfo(playerid), mrand);
SendClientMessage(ID, COLOR_RED, string);
format(string, 120, "[ROBBERY] You robbed $%d from %s!", mrand, PlayerInfo(ID));
SendClientMessage(playerid, COLOR_RED, string);
format(string, 120, "[ROBBERY] %s robbed $%d from %s!", PlayerInfo(playerid), mrand, PlayerInfo(ID));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
CNR_PrintString(string);
format(string, 120, "[DISPATCH] %s has been robbed by %s. Location: %s", PlayerInfo(ID), PlayerInfo(playerid), playerid,zones[current_zone][zone_name]);
SendCopMessage(string);
format(string, 120, "Type /radioof to turn off the Police Radio.");
SendCopMessage(string);
IncreaseWantedLevel(playerid, 2);
IncreaseScore(playerid, 2);
if(GetPVarInt(playerid, "RobSkill") <= 3)
{
SetPVarInt(playerid, "RobSkill", GetPVarInt(playerid, "RobSkill") +1);
format(string, 120, "[SKILL UPGRADE] Your robbing skill has increased. Read /robjob.");
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
format(string, 120, "[ROBBED] %s has robbed $%d from you!", PlayerInfo(playerid), mrand);
SendClientMessage(ID, COLOR_RED, string);
format(string, 120, "[ROBBERY] You robbed $%d from %s!", mrand, PlayerInfo(ID));
SendClientMessage(playerid, COLOR_RED, string);
format(string, 120, "[ROBBERY] %s robbed $%d from %s!", PlayerInfo(playerid), mrand, PlayerInfo(ID));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
CNR_PrintString(string);
format(string, 120, "[DISPATCH] %s has been robbed by %s. Location: %s", PlayerInfo(ID), PlayerInfo(playerid), playerid,zones[current_zone][zone_name]);
SendCopMessage(string);
format(string, 120, "Type /radioof to turn off the Police Radio.");
SendCopMessage(string);
IncreaseWantedLevel(playerid, 1);
IncreaseScore(playerid, 1);
if(GetPVarInt(playerid, "RobSkill") <= 3)
{
SetPVarInt(playerid, "RobSkill", GetPVarInt(playerid, "RobSkill") +1);
format(string, 120, "[SKILL UPGRADE] Your robbing skill has increased. Read /robjob.");
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;

Reply
#2

that line:
Код:
if(gTeam[playerid] != Team_Steal)
return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command.");
right now, you allow only the team "Steal".
to allow another team, do it like this:
Код:
if(gTeam[playerid] != Team_Steal && gTeam[playerid] != Team_Terrorists && gTeam[playerid] != Team_Rapists)
return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command.");
Reply
#3

Quote:
Originally Posted by CutX
Посмотреть сообщение
that line:
Код:
if(gTeam[playerid] != Team_Steal)
return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command.");
right now, you allow only the team "Steal".
to allow another team, do it like this:
Код:
if(gTeam[playerid] != Team_Steal && gTeam[playerid] != Team_Terrorists && gTeam[playerid] != Team_Rapists)
return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command.");
thanks alot i have problem i can rob my self and i want it to say you cannot rob your self
Reply
#4

just add
Код:
if(playerid == ID) return SendClientMessage(playerid,COLOR_ERROR,"You can't rob yourself... lol?");
to the top
Reply
#5

it dint work now if i type /rob id ill say the message u put and if i put just /rob ill say it as well
Reply
#6

where exactly did you put it?
before
Код:
new ID; new string[120];
? cuz that's wrong.
you could place it at that line with "if(!IsPlayerConnected(ID))"


ps: goin 2 sleep now, i wont answer any more, gn
Reply
#7

Quote:
Originally Posted by CutX
Посмотреть сообщение
where exactly did you put it?
before
Код:
new ID; new string[120];
? cuz that's wrong.
you could place it at that line with "if(!IsPlayerConnected(ID))"


ps: goin 2 sleep now, i wont answer any more, gn
i try both way but still this were i put it on

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)
    return 
SendClientMessage(playeridCOLOR_RED"You Must be a Civil to use this command.");
    if(
playerid == ID) return SendClientMessage(playerid,COLOR_ERROR,"You can't rob yourself... lol?");// here it **
    
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(
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));
    if(
GetPlayerMoney(ID) <=0)
        return 
SendClientMessage(playeridCOLOR_RED"That player doesn't have any money.");
    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);
        
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;
    }
     
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


Forum Jump:


Users browsing this thread: 1 Guest(s)