SA-MP Forums Archive
How to add command to manually turn my vehicle's lights on? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to add command to manually turn my vehicle's lights on? (/showthread.php?tid=615430)



How to add command to manually turn my vehicle's lights on? - Gorgeousmaniac - 22.08.2016

How do I add a cmd to turn on a vehicle's light manually on SAMP 0.3.7?


Re: How to add command to manually turn my vehicle's lights on? - alexkeward - 22.08.2016

Code i have for it.
Код:
CMD:lights(playerid,params[])
{
	new string[124];
	new vehicleid = GetPlayerVehicleID(playerid);

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(GetPlayerState(playerid) == 2)
    {
		if(lights != 1)
		{
			SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, 0);
	  		format(string, sizeof(string), "* %s turns the lights on.", GetName(playerid));
	  		ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
		else if(lights != 0)
		{
			SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, 0);
			format(string, sizeof(string), "* %s turns the lights off.", GetName(playerid));
	  		ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
	}
	return 1;
}



Re: How to add command to manually turn my vehicle's lights on? - Shinja - 22.08.2016

https://sampwiki.blast.hk/wiki/SetVehicleParamsEx


Re: How to add command to manually turn my vehicle's lights on? - Gorgeousmaniac - 22.08.2016

Quote:
Originally Posted by alexkeward
Посмотреть сообщение
Code i have for it.
Код:
CMD:lights(playerid,params[])
{
	new string[124];
	new vehicleid = GetPlayerVehicleID(playerid);

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(GetPlayerState(playerid) == 2)
    {
		if(lights != 1)
		{
			SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, 0);
	  		format(string, sizeof(string), "* %s turns the lights on.", GetName(playerid));
	  		ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
		else if(lights != 0)
		{
			SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, 0);
			format(string, sizeof(string), "* %s turns the lights off.", GetName(playerid));
	  		ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
	}
	return 1;
}
Should I put that in my gamemode?


Re: How to add command to manually turn my vehicle's lights on? - alexkeward - 22.08.2016

Quote:
Originally Posted by Gorgeousmaniac
Посмотреть сообщение
Should I put that in my gamemode?
If you believe it will work yes.


Re: How to add command to manually turn my vehicle's lights on? - Gorgeousmaniac - 22.08.2016

Quote:
Originally Posted by alexkeward
Посмотреть сообщение
If you believe it will work yes.
Is the callback OnPlayerCommandText still needed?


Re: How to add command to manually turn my vehicle's lights on? - alexkeward - 22.08.2016

Quote:
Originally Posted by Gorgeousmaniac
Посмотреть сообщение
Is the callback OnPlayerCommandText still needed?
What callback?


Re: How to add command to manually turn my vehicle's lights on? - TayFunCZE - 22.08.2016

No, it isn't needed.