dcmd_arrest(playerid,params[])
{
new randomspawn = random(6);
new string[128];
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"Use: /arrest (Player Name/ID)");
return 1;
}
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA && gTeam[playerid] != TEAM_FBI)
{
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can arrest wanted suspects.");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"Player is not connected. You cannot arrest him.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) > 4)
{
format(string,sizeof(string),"%s (%d) is too far away. You cannot reach him to arrest him.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect while you are in a vehicle. Exit the vehicle first.");
return 1;
}
if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect while he is in a vehicle.");
return 1;
}
if(playerid == ID)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself.");
return 1;
}
if(IsSpawned[ID] != 1)
{
format(string,sizeof(string),"%s (%d) is not spawned.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerWantedLevel(ID) < 4)
{
format(string,sizeof(string),"%s (%d)'s wanted level is too low. You cannot jail him. Use /ticket (Player ID).",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) <= 4)
{
format(string,sizeof(string),"You have been arrested by %s (%d)",PlayerName(playerid),playerid);
SendClientMessage(ID,COLOR_LIGHTBLUE,string);
//Give the Police Officer Reward
IncreasePlayerScore(playerid,2);
//Show the jail TextDraw for suspect
TextDrawShowForPlayer(ID,JailTimer[ID]);
//Others
ResetPlayerWeapons(ID);
//Send the suspect to jail
if(GetPlayerWantedLevel(ID) == 4)
{
format(string,sizeof(string),"%s (%d) has been arrested by %s (%d)",PlayerName(ID),ID,PlayerName(playerid),playerid);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
//Give the police officer reward
format(string,sizeof(string),"You have recieved $1000 for arresting %s (%d).",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid,1000);
JailTime[ID] =60;
TotalJailTime[ID] =60;
if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,6);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 264.29998779297, 82, 1000.5);
case 1: SetPlayerPos(playerid, 264.29998779297, 77.5, 1000.5);
case 2: SetPlayerPos(playerid, 264.29998779297, 86.599998474121, 1000.5);
}
}
else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,10);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 223.30000305176, 108.40000152588, 998.40002441406);
case 1: SetPlayerPos(playerid, 219.30000305176, 108.40000152588, 998.40002441406);
case 2: SetPlayerPos(playerid, 215.30000305176, 108.40000152588, 998.40002441406);
case 3: SetPlayerPos(playerid, 227.39999389648, 108.30000305176, 998.40002441406);
}
}
else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,3);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 194.19999694824, 162.10000610352, 1002.4000244141);
case 1: SetPlayerPos(playerid, 189.89999389648, 162.10000610352, 1002.4000244141);
case 2: SetPlayerPos(playerid, 198.39999389648, 162, 1002.4000244141);
case 3: SetPlayerPos(playerid, 193.39999389648, 174.69999694824, 1002.4000244141);
case 4: SetPlayerPos(playerid, 189, 174.80000305176, 1002.4000244141);
case 5: SetPlayerPos(playerid, 197.69999694824, 174.69999694824, 1002.4000244141);
}
}
TogglePlayerControllable(ID,1);
SetPlayerWantedLevel(ID,0);
SetPlayerToTeamColour(ID);
return 1;
}
if(GetPlayerWantedLevel(ID) == 5)
{
format(string,sizeof(string),"%s (%d) has been arrested by %s (%d)",PlayerName(ID),ID,PlayerName(playerid),playerid);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
//Give the police officer reward
format(string,sizeof(string),"You have recieved $3000 for arresting %s (%d).",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid,3000);
JailTime[ID] =180;
TotalJailTime[ID] =180;
if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,6);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 264.29998779297, 82, 1000.5);
case 1: SetPlayerPos(playerid, 264.29998779297, 77.5, 1000.5);
case 2: SetPlayerPos(playerid, 264.29998779297, 86.599998474121, 1000.5);
}
}
else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,10);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 223.30000305176, 108.40000152588, 998.40002441406);
case 1: SetPlayerPos(playerid, 219.30000305176, 108.40000152588, 998.40002441406);
case 2: SetPlayerPos(playerid, 215.30000305176, 108.40000152588, 998.40002441406);
case 3: SetPlayerPos(playerid, 227.39999389648, 108.30000305176, 998.40002441406);
}
}
else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,3);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 194.19999694824, 162.10000610352, 1002.4000244141);
case 1: SetPlayerPos(playerid, 189.89999389648, 162.10000610352, 1002.4000244141);
case 2: SetPlayerPos(playerid, 198.39999389648, 162, 1002.4000244141);
case 3: SetPlayerPos(playerid, 193.39999389648, 174.69999694824, 1002.4000244141);
case 4: SetPlayerPos(playerid, 189, 174.80000305176, 1002.4000244141);
case 5: SetPlayerPos(playerid, 197.69999694824, 174.69999694824, 1002.4000244141);
}
}
TogglePlayerControllable(ID,1);
SetPlayerWantedLevel(ID,0);
SetPlayerToTeamColour(ID);
return 1;
}
if(GetPlayerWantedLevel(ID) == 6)
{
format(string,sizeof(string),"%s (%d) has been arrested by %s (%d)",PlayerName(ID),ID,PlayerName(playerid),playerid);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
//Give the police officer reward
format(string,sizeof(string),"You have recieved $5000 for arresting %s (%d).",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid,5000);
JailTime[ID] =240;
TotalJailTime[ID] =240;
if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,6);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 264.29998779297, 82, 1000.5);
case 1: SetPlayerPos(playerid, 264.29998779297, 77.5, 1000.5);
case 2: SetPlayerPos(playerid, 264.29998779297, 86.599998474121, 1000.5);
}
}
else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,10);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 223.30000305176, 108.40000152588, 998.40002441406);
case 1: SetPlayerPos(playerid, 219.30000305176, 108.40000152588, 998.40002441406);
case 2: SetPlayerPos(playerid, 215.30000305176, 108.40000152588, 998.40002441406);
case 3: SetPlayerPos(playerid, 227.39999389648, 108.30000305176, 998.40002441406);
}
}
else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid])
{
SetPlayerInterior(ID,3);
switch(randomspawn)
{
case 0: SetPlayerPos(playerid, 194.19999694824, 162.10000610352, 1002.4000244141);
case 1: SetPlayerPos(playerid, 189.89999389648, 162.10000610352, 1002.4000244141);
case 2: SetPlayerPos(playerid, 198.39999389648, 162, 1002.4000244141);
case 3: SetPlayerPos(playerid, 193.39999389648, 174.69999694824, 1002.4000244141);
case 4: SetPlayerPos(playerid, 189, 174.80000305176, 1002.4000244141);
case 5: SetPlayerPos(playerid, 197.69999694824, 174.69999694824, 1002.4000244141);
}
}
TogglePlayerControllable(ID,1);
SetPlayerWantedLevel(ID,0);
SetPlayerToTeamColour(ID);
return 1;
}
return 1;
}
return 1;
}
(2026) : error 012: invalid function call, not a valid address
(2026) : warning 215: expression has no effect
(2026) : error 001: expected token: ";", but found ")"
(2026) : error 029: invalid expression, assumed zero
(2026) : fatal error 107: too many error messages on one line
format(string,sizeof(string),"%s (%d) is too far away. You cannot reach him to arrest him.",PlayerName(ID),ID);
format(string,sizeof(string)),"%s (%d) is too far away. You cannot reach him to arrest him.",PlayerName(ID),ID);
try this:
pawn Код:
|
number of arguments does not match definition
PlayerName(ID)
Show us how you defined
pawn Код:
|
new PlayerName[MAX_PLAYER_NAME];
if(GetDistanceBetweenPlayers(playerid,ID) > 4)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(ID, PlayerName, sizeof(PlayerName));
format(string,sizeof(string),"%s (%d) is too far away. You cannot reach him to arrest him.",PlayerName,ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}