16.04.2013, 03:36
Hey people i have still a weird problem with the function SetVehicleParamsEx and the lights. I have tested now a lot, i also printed the lights, just to know if the params gets changed and well yes they do, just this freaky light won't turn on.
Here the code how i did it right now.
When anyone can tell me what i've done wrong would it be really great.
PS: When i press the first time KEY_FIRE when i printed it does it show me -1. Which is really really weird.
Here the code how i did it right now.
pawn Код:
//by my defines:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//^before some starts to ask me if i have it.
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_FIRE))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(pInfo[playerid][LightsOn]==0)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,1, alarm,doors, bonnet, boot, objective);
pInfo[playerid][LightsOn]=1;
}
else if(pInfo[playerid][LightsOn]==1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,0, alarm,doors, bonnet, boot, objective);
pInfo[playerid][LightsOn]=0;
}
}
}
return 1;
}
PS: When i press the first time KEY_FIRE when i printed it does it show me -1. Which is really really weird.