Light [Rep+]
#1

How i can make that, if i click number " 2 " then the car or bike lights turns on
Reply
#2

add something on OnPlayerKeyStateChange and SetVehicleParams should be easy if you know a thing or two but i think i would keep that on a command
Reply
#3

use the callback OnPlayerKeyStateChange and the KEY SUBMISSION
Reply
#4

Quote:
Originally Posted by paulll0len
Посмотреть сообщение
How i can make that, if i click number " 2 " then the car or bike lights turns on
Well I'm not sure about number 2, but you can use any KEYS from the following link.

Scroll down to the keys: https://sampwiki.blast.hk/wiki/GetPlayerKeys

Now I will write an example for you, you can replace the keys if you want:-

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
    {
        new vid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(vid != INVALID_VEHICLE_ID)
        {
            SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective); // on light
            SendClientMessage(playerid, -1, "Lights on");
        }
        else
        if(vid != INVALID_VEHICLE_ID && lights == 1)
        {
            SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective); // off light
            SendClientMessage(playerid, -1, "Lights off");
        }
    }
    return 1;
}
Not sure if it works, but it will compile, have a try.

-FalconX
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)