Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys == 04)
{
new giveplayerid;
new tmp[256];
new string[128];
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_BOUNTY) {
SendClientMessage(playerid,COLOR_ERROR," ");
return 1;
}
if(Jailed[playerid] ==1) {
SendClientMessage(playerid, COLOR_ERROR, " ");
return 1;
}
if(cuffed[giveplayerid] == 0)
{
SendClientMessage(playerid,COLOR_ERROR,"That player is not handcuffed! Please cuff the suspect before arresting.");
return 1;
}
if(!IsPlayerConnected(giveplayerid)) {
format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
new oname[24];
new pname[24];
GetPlayerName(playerid,oname, 24);
GetPlayerName(giveplayerid, pname, 24);
if(GetPlayerWantedLevel(giveplayerid) <= 3) {
format(string, sizeof(string), "%s(%d) Does not have a warrant. You cannot arrest a player without a warrant",pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect if you are in a car");
return 1;
}
if(IsPlayerInAnyVehicle(giveplayerid)) {
format(string, sizeof(string), "%s(%d) Is in a vehicle. Get the suspect out before making the arrest",pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 4) {
format(string, sizeof(string), "%s(%d) Is too far away. You cannot arrest that player",pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsSpawned[giveplayerid] == 0) {
format(string, sizeof(string), "%s(%d) Is dead. You cannot arrest a dead body",pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
SetPlayerVirtualWorld(giveplayerid,0);
if(GetPlayerWantedLevel(playerid) >=1) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command if you are wanted by the police");
return 1;
}
if(giveplayerid == playerid) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself");
return 1;
}
if(GetPlayerWantedLevel(giveplayerid) >=4 && GetPlayerWantedLevel(giveplayerid) <=5 && if(IsPlayerInRangeOfPoint(playerid, 7, x, y, z)) {
SetPlayerInterior(giveplayerid,3);
new rnd;
rnd = random(sizeof (ArrestedSpawn));
SetPlayerPos(giveplayerid, ArrestedSpawn[rnd][0], ArrestedSpawn[rnd][1], ArrestedSpawn[rnd][2]);
SetPlayerFacingAngle(giveplayerid, ArrestedSpawn[rnd][3]);
format(string, sizeof(string), "Wanted suspect %s(%d) has been arrested by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
SendClientMessageToAll(0x00C7FFAA, string);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
format(string, sizeof(string), "You were Arrested by Officer %s(%d)",oname,playerid);
SendClientMessage(giveplayerid,0x00C7FFAA, string);
SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from jail or a Police Officer/Jail Turnkey can release you early");
SendClientMessage(giveplayerid,0x00C7FFAA,"If jail life sucks for you... Why not try /escape");
SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Arrested_|");
format(string, sizeof(string), "You have arrested %s(%d) - you receive a $1500 bonus",pname,giveplayerid);
SendClientMessage(playerid,0x00C7FFAA, string);
GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
format(string, sizeof(string), "Wanted suspect %s(%d) has been arrested by Officer %s(%d)",pname,giveplayerid,oname,playerid);
printf("%s", string);
SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
GivePlayerMoney(playerid,1500);
Jailed[giveplayerid] =1;
StoleCopCarRecent[giveplayerid] =0;
ResetPlayerWeapons(giveplayerid);
JailTime[giveplayerid] =80;
JailTimeServed[giveplayerid] =0;
SetPlayerWantedLevel(giveplayerid,0);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
return 1;
}
if(GetPlayerWantedLevel(giveplayerid) >=6 && GetPlayerWantedLevel(giveplayerid) <=8) {
SetPlayerInterior(giveplayerid,3);
new rnd;
rnd = random(sizeof (ArrestedSpawn));
SetPlayerPos(giveplayerid, ArrestedSpawn[rnd][0], ArrestedSpawn[rnd][1], ArrestedSpawn[rnd][2]);
SetPlayerFacingAngle(giveplayerid, ArrestedSpawn[rnd][3]);
format(string, sizeof(string), "Wanted suspect %s(%d) has been arrested by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
SendClientMessageToAll(0x00C7FFAA, string);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
format(string, sizeof(string), "You were Arrested by Officer %s(%d)",oname,playerid);
SendClientMessage(giveplayerid,0x00C7FFAA, string);
GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from jail or a Police Officer/Jail Turnkey can release you early");
SendClientMessage(giveplayerid,0x00C7FFAA,"If jail life sucks for you... Why not try /escape");
SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Arrested_|");
format(string, sizeof(string), "You have arrested %s(%d) - you receive a $2000 bonus",pname,giveplayerid);
SendClientMessage(playerid,0x00C7FFAA, string);
format(string, sizeof(string), "Wanted suspect %s(%d) has been arrested by Officer %s(%d)",pname,giveplayerid,oname,playerid);
printf("%s", string);
SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
GivePlayerMoney(playerid,2000);
Jailed[giveplayerid] =1;
StoleCopCarRecent[giveplayerid] =0;
ResetPlayerWeapons(giveplayerid);
JailTime[giveplayerid] =140;
JailTimeServed[giveplayerid] =0;
SetPlayerWantedLevel(giveplayerid,0);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
return 1;
}
if(GetPlayerWantedLevel(giveplayerid) == 9) {
SetPlayerInterior(giveplayerid,3);
new rnd;
rnd = random(sizeof (ArrestedSpawn));
SetPlayerPos(giveplayerid, ArrestedSpawn[rnd][0], ArrestedSpawn[rnd][1], ArrestedSpawn[rnd][2]);
SetPlayerFacingAngle(giveplayerid, ArrestedSpawn[rnd][3]);
format(string, sizeof(string), "Wanted suspect %s(%d) has been arrested by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
SendClientMessageToAll(0x00C7FFAA, string);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
format(string, sizeof(string), "You were Arrested by Officer %s(%d)",oname,playerid);
SendClientMessage(giveplayerid,0x00C7FFAA, string);
SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from jail or a Police Officer/Jail Turnkey can release you early");
SendClientMessage(giveplayerid,0x00C7FFAA,"If jail life sucks for you... Why not try /escape");
SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Arrested_|");
format(string, sizeof(string), "You have arrested %s(%d) - you receive a $2500 bonus",pname,giveplayerid);
SendClientMessage(playerid,0x00C7FFAA, string);
GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
format(string, sizeof(string), "Wanted suspect %s(%d) has been arrested by Officer %s(%d)",pname,giveplayerid,oname,playerid);
printf("%s", string);
SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
GivePlayerMoney(playerid,2500);
Jailed[giveplayerid] =1;
StoleCopCarRecent[giveplayerid] =0;
ResetPlayerWeapons(giveplayerid);
JailTime[giveplayerid] =200;
JailTimeServed[giveplayerid] =0;
SetPlayerWantedLevel(giveplayerid,0);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
return 1;
}
if(GetPlayerWantedLevel(giveplayerid) >=10 && GetPlayerWantedLevel(giveplayerid) <=14) {
SetPlayerInterior(giveplayerid,10);
new rnd;
rnd = random(sizeof (AlcatrazArrestedSpawn));
SetPlayerPos(giveplayerid, AlcatrazArrestedSpawn[rnd][0], AlcatrazArrestedSpawn[rnd][1], AlcatrazArrestedSpawn[rnd][2]);
SetPlayerFacingAngle(giveplayerid, AlcatrazArrestedSpawn[rnd][3]);
format(string, sizeof(string), "Most Wanted suspect %s(%d) has been sent to Alcatraz by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
SendClientMessageToAll(0x00C7FFAA, string);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
format(string, sizeof(string), "You have been sent to Alcatraz by Officer %s(%d)",oname,playerid);
SendClientMessage(giveplayerid,0x00C7FFAA, string);
SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from Alcatraz once you have served your sentence");
SendClientMessage(giveplayerid,0x00C7FFAA,"If Alcatraz life sucks for you... Why not ask a friend to visit you? /reqvisit (id)");
SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Arrested_|");
format(string, sizeof(string), "You have sent Most Wanted suspect %s(%d) to Alcatraz - you receive a $3000 bonus",pname,giveplayerid);
SendClientMessage(playerid,0x00C7FFAA, string);
GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
format(string, sizeof(string), "Most Wanted suspect %s(%d) has been arrested and sent to Alcatraz by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
printf("%s", string);
SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
GivePlayerMoney(playerid,3000);
Jailed[giveplayerid] =1;
StoleCopCarRecent[giveplayerid] =0;
ResetPlayerWeapons(giveplayerid);
JailTime[giveplayerid] =280;
JailTimeServed[giveplayerid] =0;
SetPlayerWantedLevel(giveplayerid,0);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
return 1;
}
if(GetPlayerWantedLevel(giveplayerid) >=15 && GetPlayerWantedLevel(giveplayerid) <=24) {
SetPlayerInterior(giveplayerid,10);
new rnd;
rnd = random(sizeof (AlcatrazArrestedSpawn));
SetPlayerPos(giveplayerid, AlcatrazArrestedSpawn[rnd][0], AlcatrazArrestedSpawn[rnd][1], AlcatrazArrestedSpawn[rnd][2]);
SetPlayerFacingAngle(giveplayerid, AlcatrazArrestedSpawn[rnd][3]);
format(string, sizeof(string), "Most Wanted suspect %s(%d) has been sent to Alcatraz by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
SendClientMessageToAll(0x00C7FFAA, string);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
format(string, sizeof(string), "You have been sent to Alcatraz by Officer %s(%d)",oname,playerid);
SendClientMessage(giveplayerid,0x00C7FFAA, string);
SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from Alcatraz once you have served your sentence");
SendClientMessage(giveplayerid,0x00C7FFAA,"If Alcatraz life sucks for you... Why not ask a friend to visit you? /reqvisit (id)");
SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Arrested_|");
format(string, sizeof(string), "You have sent Most Wanted suspect %s(%d) to Alcatraz - you receive a $3500 bonus",pname,giveplayerid);
SendClientMessage(playerid,0x00C7FFAA, string);
GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
format(string, sizeof(string), "Most Wanted suspect %s(%d) has been arrested and sent to Alcatraz by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
printf("%s", string);
SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
GivePlayerMoney(playerid,3500);
Jailed[giveplayerid] =1;
StoleCopCarRecent[giveplayerid] =0;
ResetPlayerWeapons(giveplayerid);
JailTime[giveplayerid] =320;
JailTimeServed[giveplayerid] =0;
SetPlayerWantedLevel(giveplayerid,0);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
return 1;
}
if(GetPlayerWantedLevel(giveplayerid) >=25) {
SetPlayerInterior(giveplayerid,10);
new rnd;
rnd = random(sizeof (AlcatrazArrestedSpawn));
SetPlayerPos(giveplayerid, AlcatrazArrestedSpawn[rnd][0], AlcatrazArrestedSpawn[rnd][1], AlcatrazArrestedSpawn[rnd][2]);
SetPlayerFacingAngle(giveplayerid, AlcatrazArrestedSpawn[rnd][3]);
format(string, sizeof(string), "Most Wanted suspect %s(%d) has been sent to Alcatraz by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
SendClientMessageToAll(0x00C7FFAA, string);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
format(string, sizeof(string), "You have been sent to Alcatraz by Officer %s(%d)",oname,playerid);
SendClientMessage(giveplayerid,0x00C7FFAA, string);
SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from Alcatraz once you have served your sentence");
SendClientMessage(giveplayerid,0x00C7FFAA,"If Alcatraz life sucks for you... Why not ask a friend to visit you? /reqvisit (id)");
SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Arrested_|");
format(string, sizeof(string), "You have sent Most Wanted suspect %s(%d) to Alcatraz - you receive a $4000 bonus",pname,giveplayerid);
SendClientMessage(playerid,0x00C7FFAA, string);
GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
format(string, sizeof(string), "Most Wanted suspect %s(%d) has been arrested and sent to Alcatraz by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
printf("%s", string);
SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
GivePlayerMoney(playerid,4000);
Jailed[giveplayerid] =1;
StoleCopCarRecent[giveplayerid] =0;
ResetPlayerWeapons(giveplayerid);
JailTime[giveplayerid] =420;
JailTimeServed[giveplayerid] =0;
SetPlayerWantedLevel(giveplayerid,0);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +2);
}
return 1;
}
Cant really get it working..