12.05.2011, 12:45
Heey guys
I made a arrest and ticket key but when i am in vehicle it dont work.
Is something wrong with GetClosestPlayer or does that function to if you are in a vehicle?
Here is my ticket command:
And here is my key:
Pls anyone can help?
I made a arrest and ticket key but when i am in vehicle it dont work.
Is something wrong with GetClosestPlayer or does that function to if you are in a vehicle?
Here is my ticket command:
Код:
dcmd_ticketkey(playerid,params[]) { new ID; new string[128]; if(sscanf(params, "u", ID)) { SendClientMessage(playerid,COLOR_RED,"USAGE: /ticket (Player Name/ID)"); return 1; } if(IsKidnapped[playerid] == 1) { SendClientMessage(playerid,COLOR_RED,"You are kidnapped. You cannot use this command."); 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(gTeam[playerid] != TEAM_COP) { SendClientMessage(playerid,COLOR_RED,"Only law enforcement can issue tickets to suspects."); 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(!IsPlayerConnected(ID)) { return 1; } if(GetPlayerWantedLevel(ID) >= 3 && GetPlayerWantedLevel(ID) < 10) { return 1; } if(HasTicket[ID] ==1) { SendClientMessage(ID,COLOR_RED,"Pay Your ticket!"); return 1; } if(GetDistanceBetweenPlayers(playerid,ID) > 8) { //SendClientMessage(playerid,COLOR_RED,"No Suspect In Range."); return 1; } if(GetPlayerWantedLevel(ID) == 1 || GetPlayerWantedLevel(ID) == 2) { SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Fined_]]"); format(string,sizeof(string),"Law Enforcement Officer %s(%d) has issued you a ticket of $2000 for your criminal actions.",PlayerName(playerid),playerid); SendClientMessage(ID,COLOR_DODGERBLUE,string); SendClientMessage(ID,COLOR_DODGERBLUE,"You have 2 minutes to pay this ticket with /payticket or your wanted level will increase."); HasTicket[ID] =1; TimeToPayTicket[ID] =120; TextDrawSetString(MessageTD[ID],"TICKET RECIEVED"); TextDrawShowForPlayer(ID,MessageTD[ID]); MessageTDTime[ID] =5; IncreasePlayerScore(playerid,1); format(string,sizeof(string),"[POLICE RADIO] Law Enforcement Officer %s(%d) has issued a ticket of $2000 to %s(%d).",PlayerName(playerid),playerid,PlayerName(ID),ID); SendClientMessageToAllCops(string); } return 1; }
Код:
if(newkeys == KEY_LOOK_BEHIND) { new ID = GetClosestPlayerToPlayer(playerid); dcmd_arrestkey(playerid, IntToStr(GetClosestPlayerToPlayer(playerid))); dcmd_ticketkey(playerid, IntToStr(GetClosestPlayerToPlayer(playerid))); if(GetPlayerWantedLevel(ID)==0 && GetDistanceBetweenPlayers(playerid,ID) > 4) { SendClientMessage(playerid,COLOR_RED,"No Suspect In Range!"); } return 1; }