Carlights command
#1

I want,when I am in a car,with a buttons press, to turn on/off the carlights. could you help me?
Reply
#2

Try this:

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_SUBMISSION/* Button 2 */) && IsPlayerInAnyVehicle(playerid)) {
        new vehicleid = GetPlayerVehicleID(playerid), turnTo;
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        turnTo = (lights == 0) ? (1) : (0);
        SetVehicleParamsEx(vehicleid, engine, turnTo, alarm, doors, bonnet, boot, objective);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)