Vehicle Lights.
#5

Have you set the PVar for the player?
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInAnyVehicle(playerid) && newkeys & KEY_ANALOG_UP)
    {
        if(GetPVarInt(playerid, "Lights") == 1)//1 for on and 0 for off is easier to understand.
        {
            GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vehicleid,engine,false,alarm,doors,bonnet,boot,objective);
            SetPVarInt(playerid, "Lights", 0);
        }
        else if(GetPVarInt(playerid, "Lights") == 0)
        {
            GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vehicleid,engine,true,alarm,doors,bonnet,boot,objective);
            SetPVarInt(playerid, "Lights", 1);
        }
        //You missed a bracket here.
    }
}
return 1;
Sorry to push this old post, but I found it when I'm searching for something, and it is not solved.
Reply


Messages In This Thread
Vehicle Lights. - by budelis - 19.11.2011, 14:34
Re: Vehicle Lights. - by gecatahh - 19.11.2011, 14:37
Re: Vehicle Lights. - by GangsTa_ - 19.11.2011, 14:46
Re: Vehicle Lights. - by MP2 - 19.11.2011, 14:48
Re: Vehicle Lights. - by leong124 - 17.12.2011, 13:17

Forum Jump:


Users browsing this thread: 1 Guest(s)