SA-MP Forums Archive
Vehicle Lights - 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: Vehicle Lights (/showthread.php?tid=490136)



Vehicle Lights - McBan - 25.01.2014

Yo,

I simply have a lights error, I have a dialog whenever anyone enters any car (player owned or not) and its gives the players a few options, Engine, Idle, Lights, Boot, Bonnet etc.

When I click 'Lights', The textdraw confirms that the script is working however the vehicle lights do not turn on, I have even tried a lights FS, That FS works but only works as indicators, A for left and D for right etc.

I cannot leave the vehicle lights on, Here's the code:

Код:
switch(VehicleInfo[GetPlayerVehicleID(playerid)][vLights])
					         {
			    	             case 1:
				    	         {
				        	         CarLights(GetPlayerVehicleID(playerid),2);
				        	         GameTextForPlayer(playerid, "~w~Lights~n~~r~Off", 4000, 3);
				    	         }
				   	             case 2:
				   	             {
				        	         CarLights(GetPlayerVehicleID(playerid),1);
				        	         GameTextForPlayer(playerid, "~w~Lights~n~~g~On", 4000, 3);
				    	         }



Re: Vehicle Lights - Sawalha - 25.01.2014

https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
or show the stock of CarLights


Re: Vehicle Lights - McBan - 25.01.2014

Код:
stock CarLights(idcar,type)
{
    new engine,lights,alarm,doors,bonnet,boot,objective,tmphour,tmpminute,tmpsecond;
    GetVehicleParamsEx(idcar,engine,lights,alarm,doors,bonnet,boot,objective);
	switch(type)
	{
		case 1:
		{
            gettime(tmphour, tmpminute, tmpsecond);
	        FixHour(tmphour);
        	tmphour = shifthour;
        	switch(tmphour)
        	{
				case 0 .. 5, 21 .. 30: SetVehicleParamsEx(idcar,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
				default: SetVehicleParamsEx(idcar,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
        	}
			VehicleInfo[idcar][vLights] = 1;
		}
		case 2:
		{
			SetVehicleParamsEx(idcar,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
			VehicleInfo[idcar][vLights] = 2;
		}
	}
	return 1;
}