Start Car Engine with Hotkey [PLEASE HELP]
#2

On top:
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
OnPlayerKeyStateChange function:
Код:
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;
}
Reply


Messages In This Thread
Start Car Engine with Hotkey [PLEASE HELP] - by jetpas - 09.06.2016, 00:52
Re: Start Car Engine with Hotkey [PLEASE HELP] - by iShawn - 09.06.2016, 01:08
Re: Start Car Engine with Hotkey [PLEASE HELP] - by jetpas - 09.06.2016, 01:46

Forum Jump:


Users browsing this thread: 2 Guest(s)