help with /light
#1

Hello, i need help with the cmd /lights i want to open the lights even in the daytime i put this FS but only the front open lights not even the back!Sorry for bad english...im romanian..please help...i saw on some servers that u can turn on lights even on daytime..

http://pastebin.com/dFCs7Y5n
Reply
#2

mhm...... i think its possible, i saw it in one server
Reply
#3

please help mee....
Reply
#4

Код:
#include <a_samp>
#define PRESSED(%0) \
        (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
		
new bool: VehicleLightsOn[MAX_VEHICLES];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if (newstate == PLAYER_STATE_DRIVER)
	{
		if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
		{
			new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
			GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
			SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective);
		}
		else
		{
			new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
			GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
			SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective);
		}
	}
	return 1;
}
 
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (PRESSED(KEY_ACTION))
	{
		if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
			if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
			{
				new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
				GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
				SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective);			
				VehicleLightsOn[vid] = true;
			}
			else
			{
				new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
				GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
				SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective);			
				VehicleLightsOn[vid] = false;
			}
		}
	}
	return 1;
}
That should work.
Reply
#5

error .... error 017: undefined symbol "vid"
Reply
#6

See the edit. Should work now.
Reply
#7

delete never mind
Reply
#8

Basssiiie's code:
pawn Код:
#include <a_samp>
#define PRESSED(%0) \
        (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

new bool: VehicleLightsOn[MAX_VEHICLES];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective);
        }
        else
        {
            new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective);
        }
    }
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_ACTION))
    {
        if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
            {
                new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
                GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective);
                VehicleLightsOn[vid] = true;
            }
            else
            {
                new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
                GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective);
                VehicleLightsOn[vid] = false;
            }
        }
    }
    return 1;
}
You shouldn't get any errors with it, I compiled it fine.
Reply
#9

i put this in the pawn ) never mind how can i put it to work in daytime?....i mean i want to turn on lights at 10 am!
Reply
#10

It should work in the daytime, if you're in the vehicle and pressed the action key.

But by lights, you do mean vehicle headlights, yes? Or do you mean street-lights?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)