Add Jail
#1

How Can Chenge
When i arrest anyone, if i am cop i need to type /ar (ID).

and after that if i type /ar (id) like is ticket ready to arrest

can arrest somebody and max distance is 2m

and use OnPlayerKeyStateChange and key
KEY_ACTION (Alt Keyboard Button).

Here is arrest commands code:

Код:
  if(strcmp(cmd, "/ar", true) == 0) {
  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,"You are not a Law Enforcement officer ");
  return 1;
  }
  if(InDerby[playerid] == 1) {
  SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
  return 1;
  }
	if(isKidnapped[playerid] ==1)
	{
	SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while tied up!");
	return 1;
	}
  if(Jailed[playerid] ==1) {
  SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
  return 1;
  }
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /ar (id)");
  return 1;
  }
  giveplayerid = strval(tmp);
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /ar (id) ID Must be a number");
  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(gTeam[playerid] == TEAM_BOUNTY && EscapedConvict[giveplayerid] == 0) {
  SendClientMessage(playerid,COLOR_ERROR,"That player is not on your bounty list. Type /bounty for details");
  return 1;
  }
  if(giveplayerid == playerid) {
  SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself");
  return 1;
  }
  if(gTeam[playerid] == TEAM_BOUNTY && EscapedConvict[giveplayerid] == 1 && GetPlayerWantedLevel(giveplayerid) >=10) {
  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), "Bounty Hunter %s(%d) has re-captured Escaped Convict %s(%d) and has sent the suspect to Alcatraz",oname,playerid,pname,giveplayerid);
  SendClientMessageToAll(0x00C7FFAA, string);
  ircSay(EchoConnection, EchoChan,string);
  SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Busted By A Bounty Hunter_|");
  format(string, sizeof(string), "You have been sent to Alcatraz by Bounty Hunter %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 escaped prisoner %s(%d) to Alcatraz - you receive a $5000 re-capture bonus",pname,giveplayerid);
  SendClientMessage(playerid,0x00C7FFAA, string);
  GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
  format(string, sizeof(string), "Escaped Convict %s(%d) has been re-arrested and sent to Alcatraz by Bounty Hunter %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,5000);
	Jailed[giveplayerid] =1;
	InAlcatraz[giveplayerid] =1;
	StoleCopCarRecent[giveplayerid] =0;
	triedtoescaperecent[giveplayerid] =1;
	ResetPlayerWeapons(giveplayerid);
	JailTime[giveplayerid] =320;
	JailTimeServed[giveplayerid] =0;
	EscapedConvict[giveplayerid] =0;
	SetPlayerWantedLevel(giveplayerid,0);
	oscore = GetPlayerScore(playerid);
  	SetPlayerScore(playerid, oscore +1);
	isKidnapped[giveplayerid] =0;
	kidnapTimer[giveplayerid] =0;
	return 1;
  }
I hawe search but i dont undestand enything

Sry My Bad English!
Reply
#2

what command functions....?

Reply
#3

add you code in keychange callback
Reply
#4

are that :

public OnPlayerStateKeyChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_ACTION)
{

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,"You are not a Law Enforcement officer ");
return 1;
}
if(InDerby[playerid] == 1) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
return 1;
}
if(isKidnapped[playerid] ==1)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while tied up!");
return 1;
}
if(Jailed[playerid] ==1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /ar (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /ar (id) ID Must be a number");
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(gTeam[playerid] == TEAM_BOUNTY && EscapedConvict[giveplayerid] == 0) {
SendClientMessage(playerid,COLOR_ERROR,"That player is not on your bounty list. Type /bounty for details");
return 1;
}
if(giveplayerid == playerid) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself");
return 1;
}
if(gTeam[playerid] == TEAM_BOUNTY && EscapedConvict[giveplayerid] == 1 && GetPlayerWantedLevel(giveplayerid) >=10) {
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), "Bounty Hunter %s(%d) has re-captured Escaped Convict %s(%d) and has sent the suspect to Alcatraz",oname,playerid,pname,giveplayerid);
SendClientMessageToAll(0x00C7FFAA, string);
ircSay(EchoConnection, EchoChan,string);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Busted By A Bounty Hunter_|");
format(string, sizeof(string), "You have been sent to Alcatraz by Bounty Hunter %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 escaped prisoner %s(%d) to Alcatraz - you receive a $5000 re-capture bonus",pname,giveplayerid);
SendClientMessage(playerid,0x00C7FFAA, string);
GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
format(string, sizeof(string), "Escaped Convict %s(%d) has been re-arrested and sent to Alcatraz by Bounty Hunter %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,5000);
Jailed[giveplayerid] =1;
InAlcatraz[giveplayerid] =1;
StoleCopCarRecent[giveplayerid] =0;
triedtoescaperecent[giveplayerid] =1;
ResetPlayerWeapons(giveplayerid);
JailTime[giveplayerid] =320;
JailTimeServed[giveplayerid] =0;
EscapedConvict[giveplayerid] =0;
SetPlayerWantedLevel(giveplayerid,0);
oscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, oscore +1);
isKidnapped[giveplayerid] =0;
kidnapTimer[giveplayerid] =0;
return 1;
}

}
}
Reply
#5

Код:
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(1734) : warning 219: local variable "rnd" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(2867) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(3505) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(3679) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(3735) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(3782) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(3827) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(3976) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(4905) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(4944) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5471) : warning 219: local variable "rnd" shadows a variable at a preceding level
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5750) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5753) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5755) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5758) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5760) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5762) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5764) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5766) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5769) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5771) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5773) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5776) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5778) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5781) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5783) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5785) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5788) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5792) : error 021: symbol already defined: "GetPlayerName"
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5794) : error 010: invalid function or declaration
C:\Documents and Settings\xxlx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5797) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5799) : error 010: invalid function or declaration
C:\Documents and Settings\xxxDesktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5801) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5803) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5806) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5808) : error 010: invalid function or declaration
C:\Documents and Settings\xxx\Desktop\Estonian Criminal Live (Version 1.8)\gamemodes\DANGEROS.pwn(5811) : error 010: invalid function or declaration

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)