if(!IsCop(playerid))
return SendClientMessage(playerid, COLOR_RED, "Only Cops/Army can use this command.");
new string[120], ID;
if(GetDistanceBetweenPlayers(playerid, ID) > 4)
{
return SendClientMessage(playerid, COLOR_RED, "That player is too far away to Ticket.");
}
new pwl = GetPlayerWantedLevel(ID);
if(pwl == 1)
{
format(string, 120, "[COP ACTION] You have been fined by officer %s. You have been charged $1,000", PlayerInfo(playerid));
SendClientMessage(ID, COLOR_DODGERBLUE, string);
format(string, 120, "[COP ACTION] You have fined %s. You have recieved a collection prize.", PlayerInfo(ID));
SendClientMessage(playerid, COLOR_DODGERBLUE, string);
format(string, 120, "[DISPATCH] Officer %s has fined %s. He is no longer wanted.", PlayerInfo(playerid), PlayerInfo(ID));
SendCopMessage(string);
SetPlayerWantedLevel(ID, 0);
IncreaseScore(playerid, 1);
GivePlayerMoney(playerid, 2500);
GivePlayerMoney(ID, -1000);
}
if(pwl == 2)
{
format(string, 120, "[COP ACTION] You have been fined by officer %s. You have been charged $2,000", PlayerInfo(playerid));
SendClientMessage(ID, COLOR_DODGERBLUE, string);
format(string, 120, "[COP ACTION] You have fined %s. You have recieved a collection prize.", PlayerInfo(ID));
SendClientMessage(playerid, COLOR_DODGERBLUE, string);
format(string, 120, "[DISPATCH] Officer %s has fined %s. He is no longer wanted.", PlayerInfo(playerid), PlayerInfo(ID));
SendCopMessage(string);
SetPlayerWantedLevel(ID, 0);
IncreaseScore(playerid, 1);
GivePlayerMoney(playerid, 2500);
GivePlayerMoney(ID, -2000);
}
if(pwl == 3)
{
format(string, 120, "[COP ACTION] You have been fined by officer %s. You have been charged $3,000", PlayerInfo(playerid));
SendClientMessage(ID, COLOR_DODGERBLUE, string);
format(string, 120, "[COP ACTION] You have fined %s. You have recieved a collection prize.", PlayerInfo(ID));
SendClientMessage(playerid, COLOR_DODGERBLUE, string);
format(string, 120, "[DISPATCH] Officer %s has fined %s. He is no longer wanted.", PlayerInfo(playerid), PlayerInfo(ID));
SendCopMessage(string);
SetPlayerWantedLevel(ID, 0);
IncreaseScore(playerid, 1);
GivePlayerMoney(playerid, 2500);
GivePlayerMoney(ID, -3000);
}
else
{
if(pwl == 0)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"player is innocent!");
}
if(pwl == 4)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
}
if(pwl == 5)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
}
if(pwl == 6)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
}
}
return 1;
}
command(ar, playerid, params[])
{
if(!IsCop(playerid))
{
return SendClientMessage(playerid, COLOR_RED, "You are not a Law Enforcement officer.");
}
new ID, string[200];
if(IsPlayerInAnyVehicle(playerid))
{
return SendClientMessage(playerid, COLOR_RED, "You cannot be in a vehicle to use this command.");
}
if(!IsPlayerConnected(ID))
{
return SendClientMessage(playerid, COLOR_RED, "Invalid ID.");
}
if(IsPlayerInAnyVehicle(ID))
{
return SendClientMessage(playerid, COLOR_RED, "You cannot arrest a player inside a vehicle.");
}
if(AccountInfo[ID][pJailed] == 1)
{
return SendClientMessage(playerid, COLOR_RED, "You cannot arrest a jailed person.");
}
if(GetDistanceBetweenPlayers(playerid, ID) > 4)
{
return SendClientMessage(playerid, COLOR_RED, "That player is too far away to arrest.");
}
if(GetPlayerWantedLevel(ID) <= 1)
{
return SendClientMessage(playerid, COLOR_RED, "The player must have a warrant before you arrest.");
}
new pwl = GetPlayerWantedLevel(ID);
new i;
if(pwl == 4)
{
format(string, sizeof(string), "Police Officer %s has arrested wanted suspect %s", PlayerInfo(playerid), PlayerInfo(ID));
SendClientMessageToAll(COLOR_BLUE, string);
CNR_PrintString(string);
format(string, sizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail", PlayerInfo(ID));
SendCopMessage(string);
new tdstring[120];
format(tdstring, sizeof(tdstring), "~g~+~g~~h~$~g~~h~~h~~h~4,000");
PlayerTextDrawSetString(playerid, WMoney[playerid], tdstring);
PlayerTextDrawShow(playerid, WMoney[playerid]);
SetTimerEx("HideWM", 7000, true, "i", playerid);
GivePlayerMoney(playerid, 4000);
IncreaseScore(playerid, 1);
AccountInfo[ID][pJailTime] = 60 ;
AccountInfo[ID][pJailed] = 1 ;
SetPlayerInterior(ID, 10);
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SendClientMessage(ID, COLOR_GREY, "**LOS SANTOS PRISON**");
SendClientMessage(ID, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
SetPlayerWantedLevel(ID, 0);
if(IsPlayerAttachedObjectSlotUsed(ID, i)) RemovePlayerAttachedObject(ID, i);
SetPlayerSpecialAction(ID, SPECIAL_ACTION_NONE);
AccountInfo[ID][pCuffed] = 0 ;
return 1;
}
if(pwl == 5)
{
format(string, sizeof(string), "Police Officer %s has arrested most wanted suspect %s", PlayerInfo(playerid), PlayerInfo(ID));
SendClientMessageToAll(COLOR_BLUE, string);
CNR_PrintString(string);
format(string, sizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail", PlayerInfo(ID));
SendCopMessage(string);
new tdstring[120];
format(tdstring, sizeof(tdstring), "~g~+~g~~h~$~g~~h~~h~~h~10,000");
PlayerTextDrawSetString(playerid, WMoney[playerid], tdstring);
PlayerTextDrawShow(playerid, WMoney[playerid]);
SetTimerEx("HideWM", 7000, true, "i", playerid);
GivePlayerMoney(playerid, 10000);
IncreaseScore(playerid, 2);
AccountInfo[ID][pJailTime] = 80 ;
AccountInfo[ID][pJailed] = 1 ;
SetPlayerInterior(ID, 10);
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
TogglePlayerControllable(ID, 1);
SetPlayerWantedLevel(ID, 0);
if(IsPlayerAttachedObjectSlotUsed(ID, i)) RemovePlayerAttachedObject(ID, i);
SetPlayerSpecialAction(ID, SPECIAL_ACTION_NONE);
AccountInfo[ID][pCuffed] = 0 ;
return 1;
}
if(pwl == 6)
{
format(string, sizeof(string), "Police Officer %s has arrested most wanted suspect %s", PlayerInfo(playerid), PlayerInfo(ID));
SendClientMessageToAll(COLOR_BLUE, string);
CNR_PrintString(string);
format(string, sizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail", PlayerInfo(ID));
SendCopMessage(string);
new tdstring[120];
format(tdstring, sizeof(tdstring), "~g~+~g~~h~$~g~~h~~h~~h~20,000");
PlayerTextDrawSetString(playerid, WMoney[playerid], tdstring);
PlayerTextDrawShow(playerid, WMoney[playerid]);
SetTimerEx("HideWM", 7000, true, "i", playerid);
GivePlayerMoney(playerid, 20000);
IncreaseScore(playerid, 2);
AccountInfo[ID][pJailTime] = 100 ;
AccountInfo[ID][pJailed] = 1 ;
SetPlayerInterior(ID, 10);
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
TogglePlayerControllable(ID, 1);
SetPlayerWantedLevel(ID, 0);
if(IsPlayerAttachedObjectSlotUsed(ID, i)) RemovePlayerAttachedObject(ID, i);
SetPlayerSpecialAction(ID, SPECIAL_ACTION_NONE);
AccountInfo[ID][pCuffed] = 0 ;
return 1;
}
return 1;
}
You only created a variable called 'ID' but you didnt store 'target' id in the variable 'ID'.
You just created 'ID' without storing anything in it, so its value is going to be 0. Use sscanf in both commands. |
if(sscanf(params, "u", ID))
if(sscanf(params, "u", ID)) return SendClientMessage(playerid,ANY COLOR,"[USAGE] /arrest[playerid]");
something like that.
pawn Код:
|
i dont want to do /ar [id] i want to do when player is close to cop
|
for(new ID; ID < MAX_PLAYERS;ID++)
{
}
or
foreach(new ID : Player)
{
}
if(ID != player) //this checks if the ID from the loop isnt you, if it was you it will avoid it.
{
}
Add This:
pawn Код:
|
cmd(tk, playerid, params[])
{
foreach(new ID : Player)
{
if(ID != playerid) //this checks if the ID from the loop isnt you, if it was you it will avoid it.
{
}
if(!IsCop(playerid))
return SendClientMessage(playerid, COLOR_RED, "Only Cops/Army can use this command.");
new string[120];
if(GetDistanceBetweenPlayers(playerid, ID) > 4)
{
return SendClientMessage(playerid, COLOR_RED, "That player is too far away to Ticket.");
}
new pwl = GetPlayerWantedLevel(ID);
if(pwl == 1)
{
format(string, 120, "[COP ACTION] You have been fined by officer %s. You have been charged $1,000", PlayerInfo(playerid));
SendClientMessage(ID, COLOR_DODGERBLUE, string);
format(string, 120, "[COP ACTION] You have fined %s. You have recieved a collection prize.", PlayerInfo(ID));
SendClientMessage(playerid, COLOR_DODGERBLUE, string);
format(string, 120, "[DISPATCH] Officer %s has fined %s. He is no longer wanted.", PlayerInfo(playerid), PlayerInfo(ID));
SendCopMessage(string);
SetPlayerWantedLevel(ID, 0);
IncreaseScore(playerid, 1);
GivePlayerMoney(playerid, 2500);
GivePlayerMoney(ID, -1000);
}
if(pwl == 2)
{
format(string, 120, "[COP ACTION] You have been fined by officer %s. You have been charged $2,000", PlayerInfo(playerid));
SendClientMessage(ID, COLOR_DODGERBLUE, string);
format(string, 120, "[COP ACTION] You have fined %s. You have recieved a collection prize.", PlayerInfo(ID));
SendClientMessage(playerid, COLOR_DODGERBLUE, string);
format(string, 120, "[DISPATCH] Officer %s has fined %s. He is no longer wanted.", PlayerInfo(playerid), PlayerInfo(ID));
SendCopMessage(string);
SetPlayerWantedLevel(ID, 0);
IncreaseScore(playerid, 1);
GivePlayerMoney(playerid, 2500);
GivePlayerMoney(ID, -2000);
}
if(pwl == 3)
{
format(string, 120, "[COP ACTION] You have been fined by officer %s. You have been charged $3,000", PlayerInfo(playerid));
SendClientMessage(ID, COLOR_DODGERBLUE, string);
format(string, 120, "[COP ACTION] You have fined %s. You have recieved a collection prize.", PlayerInfo(ID));
SendClientMessage(playerid, COLOR_DODGERBLUE, string);
format(string, 120, "[DISPATCH] Officer %s has fined %s. He is no longer wanted.", PlayerInfo(playerid), PlayerInfo(ID));
SendCopMessage(string);
SetPlayerWantedLevel(ID, 0);
IncreaseScore(playerid, 1);
GivePlayerMoney(playerid, 2500);
GivePlayerMoney(ID, -3000);
}
else
{
if(pwl == 0)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"player is innocent!");
}
if(pwl == 4)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
}
if(pwl == 5)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
}
if(pwl == 6)
{
return SendClientMessage(playerid, COLOR_YELLOW, "["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
}
}
}
return 1;
}