Start Car Engine with Hotkey [PLEASE HELP]
#1

Hey please help me, in my server we use /car engine to start the engine.

i want adding methods to turn the engine on with pressing any Key like (SHIFT) but still can use /car engine

can you help me, i will show the code. thanks

Код:
CMD:car(playerid, params[])
{
    new rand = random(2);
	if(isnull(params))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /car [name]");
		SendClientMessageEx(playerid, COLOR_GREY, "Available names: Status, Engine, Lights, Trunk, Hood, Fuel");
		return 1;
	}
	if(strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
		new string[128];
		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, "Vehicle engine starting, please wait...");
			SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);*/
           if(rand == 0)
		   {
			   SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
			   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
		       format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
       		   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		   }
		   if(rand == 1)
		   {
			   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine failed to start");
			   format(string, sizeof(string), "* %s struggles to start the engine but fails",  GetPlayerNameEx(playerid));
    		   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		   }
		}
	}
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: 1 Guest(s)