Creating Command With Key On Keyboard?
#4

add cmd code in OnPlayerStateChange Callback.
try this

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(PRESSED(KEY_NO))
  {
    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || DynVeh[vehicleid] != -1 && DynVehicleInfo[DynVeh[vehicleid]][gv_iType] == 1 && GetVehicleModel(vehicleid) == 592) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't use in this vehicle.");
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine == VEHICLE_PARAMS_ON)
        {
            SetVehicleEngine(vehicleid, playerid);
            format(string, sizeof(string), "{FF8000}** {C2A2DA}%s turns the key in the ignition and the engine stops.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
 }
return 1;
}
Reply


Messages In This Thread
Creating Command With Key On Keyboard? - by hichay - 27.11.2014, 07:53
Re: Creating Command With Key On Keyboard? - by Alex Magaсa - 27.11.2014, 08:08
Re: Creating Command With Key On Keyboard? - by hichay - 27.11.2014, 08:26
Re: Creating Command With Key On Keyboard? - by M4D - 27.11.2014, 08:38
Re: Creating Command With Key On Keyboard? - by hichay - 27.11.2014, 15:08
Re: Creating Command With Key On Keyboard? - by LeXuZ - 27.11.2014, 15:18
Re: Creating Command With Key On Keyboard? - by Raweresh - 27.11.2014, 15:20
Re: Creating Command With Key On Keyboard? - by hichay - 28.11.2014, 04:42
Re: Creating Command With Key On Keyboard? - by PowerPC603 - 28.11.2014, 04:50

Forum Jump:


Users browsing this thread: 1 Guest(s)