|
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; |
if(gTeam[playerid] != Team_Steal) return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command.");
if(gTeam[playerid] != Team_Steal && gTeam[playerid] != Team_Terrorists && gTeam[playerid] != Team_Rapists) return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command.");
|
that line:
Код:
if(gTeam[playerid] != Team_Steal) return SendClientMessage(playerid, COLOR_ERROR, "Only Theifs can use this command."); 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."); |
if(playerid == ID) return SendClientMessage(playerid,COLOR_ERROR,"You can't rob yourself... lol?");
new ID; new string[120];
|
where exactly did you put it?
before Код:
new ID; new string[120]; you could place it at that line with "if(!IsPlayerConnected(ID))" ps: goin 2 sleep now, i wont answer any more, gn ![]() |
cmd(rob, playerid, params[])
{
new ID; new string[120];
if(gTeam[playerid] != Team_Steal && gTeam[playerid] != Team_Terror && gTeam[playerid] != Team_Rape && gTeam[playerid] != Team_Civi)
return SendClientMessage(playerid, COLOR_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(playerid, COLOR_RED, "You cannot use this command in jail.");
if(GetPVarInt(playerid, "Cuffed") == 1)
return SendClientMessage(playerid, COLOR_RED, "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_RED, "Invalid Player ID.");
if(GetDistanceBetweenPlayers(playerid, ID) > 5)
return SendClientMessage(playerid, COLOR_RED, "That player is too far away.");
if(IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_RED, "You cannot use this command while in a vehicle.");
if(IsPlayerInAnyVehicle(ID))
return SendClientMessage(playerid, COLOR_RED, "You cannot rob them when they are in a vehicle.");
if(GetPVarInt(playerid, "RobbedPlayerRecent") >= 1)
return SendClientMessage(playerid, COLOR_RED, "You must wait before robbing a player again.");
new chance = random(10);
if(chance == 1)
return SendClientMessage(playerid, COLOR_RED, "You failed the robbery.");
new mrand = random(GetPlayerMoney(ID));
if(GetPlayerMoney(ID) <=0)
return SendClientMessage(playerid, COLOR_RED, "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;
}