09.06.2016, 01:08
On top:
OnPlayerKeyStateChange function:
Код:
#define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (PRESSED(KEY_JUMP)) { new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid; vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle."); GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective); if(engine == VEHICLE_PARAMS_ON) { SetVehicleEngine(vehicleid, playerid); } else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)) { SendClientMessageEx(playerid, COLOR_WHITE, "Mesin mobil sedang dinyalakan, mohon tunggu..."); SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid); } } return 1; }