14.07.2011, 08:44
hi i put in an light command and i can only turn on the front lights the rear lights stay open
#include <a_samp>
new bool: VehicleLightsOn[MAX_VEHICLES];
new panels, doors, lights, tires;
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Vehicle Lights Filterscript Loaded");
print("--------------------------------------\n");
for (new x = 1; x < MAX_VEHICLES; x++)
{
VehicleLightsOn[x] = false;
}
return 1;
}
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" Vehicle Lights Filterscript Unloaded");
print("--------------------------------------\n");
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == PLAYER_STATE_DRIVER)
{
if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(1, 1, 1, 1), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = false;
}
else
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(0, 0, 0, 0), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = true;
}
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SUBMISSION))
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(0, 0, 0, 0), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = true;
}
else
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(1, 1, 1, 1), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = false;
}
}
}
return 1;
}
stock encode_lights(light1, light2, light3, light4)
{
return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
help plz!!sorry for bad language !
}
#include <a_samp>
new bool: VehicleLightsOn[MAX_VEHICLES];
new panels, doors, lights, tires;
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Vehicle Lights Filterscript Loaded");
print("--------------------------------------\n");
for (new x = 1; x < MAX_VEHICLES; x++)
{
VehicleLightsOn[x] = false;
}
return 1;
}
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" Vehicle Lights Filterscript Unloaded");
print("--------------------------------------\n");
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == PLAYER_STATE_DRIVER)
{
if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(1, 1, 1, 1), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = false;
}
else
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(0, 0, 0, 0), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = true;
}
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_SUBMISSION))
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(0, 0, 0, 0), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = true;
}
else
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid ), panels, doors, lights, tires);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playe rid), panels, doors, encode_lights(1, 1, 1, 1), tires);
VehicleLightsOn[GetPlayerVehicleID(playerid)] = false;
}
}
}
return 1;
}
stock encode_lights(light1, light2, light3, light4)
{
return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
help plz!!sorry for bad language !
}