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



/lights - YoDawg - 12.12.2015

So, basically the lights don't work, they won't turn on in game.

Код:
CMD:lights(playerid, param[])
{
	new string[128], idx;
	if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command.");
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
    idx = GetPlayerVehicleID(playerid);
    new engine, lights, alarm, doors, bonnet, boot, objective;
	GetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, boot, objective);
	if(!lights)
	{
	    SetVehicleParamsEx(idx, engine, 2, alarm, doors, bonnet, boot, objective);
	    format(string, sizeof(string), "* %s turns their vehicle's lights on.", RPN(playerid));
		SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		GameTextForPlayer(playerid, "~g~Lights On", 3500, 3);
	}
	else
	{
	    SetVehicleParamsEx(idx, engine, 0, alarm, doors, bonnet, boot, objective);
	    format(string, sizeof(string), "* %s turns their vehicle's lights off.", RPN(playerid));
		SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
		GameTextForPlayer(playerid, "~r~Lights Off", 3500, 3);
	}
	return 1;
}



Re: /lights - jlalt - 12.12.2015

Quote:

SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);

vehicleid The ID of the vehicle to set the parameters of.


engine Engine status. 0 - Off, 1 - On.


lights Light status. 0 - Off, 1 - On.


alarm Vehicle alarm status. If on, the alarm starts. 0 - Off, 1 - On.


doors Door lock status. 0 - Unlocked, 1 - Locked.


bonnet Bonnet (hood) status. 0 - Closed, 1 - Open.


boot Boot/trunk status. 0 - Closed, 1 - Open.


objective Toggle the objective arrow above the vehicle. 0 - Off, 1 - On.
Код:
SetVehicleParamsEx(idx, engine, 2, alarm, doors, bonnet, boot, objective);
try to change lights [ 2 ] to 1 :
PHP код:
SetVehicleParamsEx(idxengine1alarmdoorsbonnetbootobjective); 



Re: /lights - YoDawg - 12.12.2015

Quote:
Originally Posted by jlalt
Посмотреть сообщение
Код:
SetVehicleParamsEx(idx, engine, 2, alarm, doors, bonnet, boot, objective);
try to change lights [ 2 ] to 1 :
PHP код:
SetVehicleParamsEx(idxengine1alarmdoorsbonnetbootobjective); 
Nope, it doesn't fix anything


Re: /lights - jlalt - 12.12.2015

Quote:
Originally Posted by YoDawg
Посмотреть сообщение
Nope, it doesn't fix anything
Quote:

%s turns their vehicle's lights on.

message being called?


Re: /lights - YoDawg - 12.12.2015

Quote:
Originally Posted by jlalt
Посмотреть сообщение
message being called?
Yeah, but it doesn't respond to turning the lights on.


Re: /lights - Sinox - 12.12.2015

What time are you using? If you're trying to turn on the lights in daytime, use ManualVehicleEngineAndLights


Re: /lights - YoDawg - 12.12.2015

Quote:
Originally Posted by Sinox
Посмотреть сообщение
What time are you using? If you're trying to turn on the lights in daytime, use ManualVehicleEngineAndLights
Thank you! This fixed it.