help with /light -
Dan_Barocu - 01.01.2012
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
Re: help with /light -
James Coral - 01.01.2012
mhm...... i think its possible, i saw it in one server
Re: help with /light -
Dan_Barocu - 01.01.2012
please help mee....
Re: help with /light -
Basssiiie - 01.01.2012
Код:
#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.
Re: help with /light -
Dan_Barocu - 01.01.2012
error .... error 017: undefined symbol "vid"
Re: help with /light -
Basssiiie - 01.01.2012
See the edit.

Should work now.
Re: help with /light -
Dan_Barocu - 01.01.2012
delete never mind
Re: help with /light -
Mosslah - 01.01.2012
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.
Re: help with /light -
Dan_Barocu - 01.01.2012
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!
Re: help with /light -
Mosslah - 01.01.2012
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?