There are some keys that you can use in cars. One is KEY_CHROUCH which is the Horn Key (H or Caps Lock).
Also, KEY_ACTION, KEY_FIRE, KEY_SPRINT (etc.) i find KEY_CHROUCH as the finest one.
Код:
if(newkeys == KEY_CHROUCH)
{
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;
}
The KEY_CHROUCH is also "C" so, to don`t allow cops using this thing while on foot, you can add something like:
Код:
if(IsPlayerInVehicle(playerid, the id of the car))
{
your script
}
PS: Also, don`t forgot to add a check if the player is a cop. Because i can`t see that in your script.