Vehicle lights
#1

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;
}
Reply
#2

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

ManualVehicleEngineAndLights();

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

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.
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)