11.05.2011, 19:54
Heey guys
I made a ticket dcmd and a arrest dcmd
And i made a key(MMB)
But when a player is wanted lvl 1 or 2 nothing happens.
Here is key code
Here is arrest command:
The command is longer thats why i dont add more but how can i fix this?
I made a ticket dcmd and a arrest dcmd
And i made a key(MMB)
But when a player is wanted lvl 1 or 2 nothing happens.
Here is key code
Код:
if(newkeys == KEY_LOOK_BEHIND) { new ID; if(GetPlayerWantedLevel(ID)==3 || GetPlayerWantedLevel(ID)==4) { dcmd_arrestkey(playerid, IntToStr(GetClosestPlayerToPlayer(playerid))); } if(GetPlayerWantedLevel(ID)==1 || GetPlayerWantedLevel(ID)==2) { dcmd_ticketkey(playerid, IntToStr(GetClosestPlayerToPlayer(playerid))); } return 1; }
Код:
dcmd_arrestkey(playerid,params[]) { new ID; if(GetPlayerWantedLevel(ID)>= 3) { new string[128]; if(sscanf(params, "u", ID)) { SendClientMessage(playerid,COLOR_RED,"USAGE: /arrest (Player Name/ID)"); return 1; } if(IsSpawned[playerid] != 1) { SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command."); return 1; } if(IsKidnapped[playerid] == 1) { SendClientMessage(playerid,COLOR_RED,"You are kidnapped. You cannot use this command."); return 1; } if(gTeam[playerid] != TEAM_COP) { SendClientMessage(playerid,COLOR_RED,"Only law enforcement can arrest wanted suspects."); return 1; } if(!IsPlayerConnected(ID)) { return 1; } if(GetDistanceBetweenPlayers(playerid,ID) > 4) { return 1; } if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { SendClientMessage(playerid,COLOR_RED,"You cannot arrest a suspect while in a vehicle. Exit the vehicle first."); return 1; } if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER) { SendClientMessage(playerid,COLOR_RED,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first."); return 1; } if(InAdminMode[ID] == 1) { SendClientMessage(playerid,COLOR_RED,"You cannot use this command on this player because they are in Administrator mode."); return 1; } if(playerid == ID) { SendClientMessage(playerid,COLOR_RED,"You cannot arrest yourself, why would you do that anyway?"); return 1; } if(IsSpawned[ID] != 1) { format(string,sizeof(string),"%s(%d) is not spawned. You arrest dead people ..",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_RED,string); return 1; } if(GetPlayerWantedLevel(ID) < 4) { format(string,sizeof(string),"%s(%d)'s wanted level is too low. You cannot jail them. Use /ticket (Player ID).",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_RED,string); return 1; } if(GetDistanceBetweenPlayers(playerid,ID) <= 4) { SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Arrested_]]"); format(string,sizeof(string),"You have been sent to San Fierro Prison by Law Enforcement Officer %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) == 3) { format(string,sizeof(string),"[POLICE ACTION] Law Enforcement Officer %s(%d) has sent the low wanted suspect %s(%d) to San Fierro Prison.",PlayerName(playerid),playerid,PlayerName(ID),ID); SendClientMessageToAll(COLOR_ORANGE,string); //Give the police officer reward format(string,sizeof(string),"You have recieved $10000 for sending the low wanted suspect %s(%d) to prison.",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_LIGHTBLUE,string); GivePlayerMoney(playerid,10000); new rnd = random(sizeof(JailSpawnPoints)); JailTime[ID] =180; TotalJailTime[ID] =180; SetPlayerInterior(ID,10); SetPlayerPos(ID,JailSpawnPoints[rnd][0],JailSpawnPoints[rnd][1],JailSpawnPoints[rnd][2]); SetPlayerFacingAngle(ID,JailSpawnPoints[rnd][3]); TogglePlayerControllable(ID,1); StopLoopingAnim(ID); SetPlayerWantedLevel(ID,0); SetPlayerToTeamColour(ID); return 1; }