01.09.2009, 13:57
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:
I hawe search but i dont undestand enything
Sry My Bad English!
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; }
Sry My Bad English!