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



/lights help - litmanen - 15.09.2014

Hey guys, so ive used this command /lights, but it's not working. But when im getting out of the vehicle they pop on, when im getting back in again they're going off, anyone knows how to fix this? Thanks!

Код:
CMD:lights(playerid, param[])
{
	new string[128], idx;
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any 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, 1, 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;
}



AW: /lights help - Skimmer - 15.09.2014

Notes
Quote:

Lights also operate during the day.

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


Re: /lights help - DobbysGamertag - 15.09.2014

Look at: https://sampwiki.blast.hk/wiki/ManualVehicleEngineAndLights

pawn Код:
public OnGameModeInit()
{
    ManualVehicleEngineAndLights();
    return 1;
}
This prevents the game automatically turning the engine on/off when players enter/exit vehicles and headlights automatically coming on when it is dark.