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=648840)



Vehicle lights - Davidmkd123 - 29.01.2018

The manual vehicle and lights is not used, but the lights are still turning on when its darker or smth. I got the same cmd for the engine, but it works correctly.

Код:
CMD:svetla(playerid,params[])
{
    new string[128];
    new engine,lights,alarm,doors,bonnet,boot,objective;
	if(IsPlayerInAnyVehicle(playerid))
	{
		if(Lights[playerid] == 0)
		{
			format(string, sizeof(string), "%s turns the lights on", RemoveUnderScore(playerid));
			SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 10.0, 5000);
			ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			SendClientMessage(playerid, COLOR_INFO, "[!]{FFFFFF} You turned the lights on");
			GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
			SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, 1 , alarm , doors, bonnet, boot, objective);
			Lights[playerid] = 1;
		}
		else
		{
			format(string, sizeof(string), "%s turns the lights off.", RemoveUnderScore(playerid));
			SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 10.0, 5000);
			ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			SendClientMessage(playerid, COLOR_INFO, "[!]{FFFFFF} You turned off the lights");
			GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine , lights , alarm , doors , bonnet , boot , objective);
			SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine , 0 , alarm , doors , bonnet , boot , objective);
			Lights[playerid] = 0;
		}
	}
	return 1;
}



Re: Vehicle lights - Mugala - 29.01.2018

use
Код:
if(lights)
{
instead of
Код:
if(Lights[playerid] == 0)
		{
with Lights[playerid] u must change variables when player enter/exits vehicle too.


Re: Vehicle lights - David (Sabljak) - 30.01.2018

ManualVehicleEngineAndLights();

use that in OnGameModInit and then you are forced to manually turn on/off lights and engine


Re: Vehicle lights - ISmokezU - 30.01.2018

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
use
Код:
if(lights)
{
instead of
Код:
if(Lights[playerid] == 0)
		{
with Lights[playerid] u must change variables when player enter/exits vehicle too.
His code is correct.


Re: Vehicle lights - edyun - 30.01.2018

You should maybe to , Lights with the carid
Код:
Lights[carid]
// To store this for a car not for a player