SA-MP Forums Archive
Vehicle FLIP! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle FLIP! (/showthread.php?tid=352803)



Vehicle FLIP! - kbalor - 21.06.2012

Can someone tell me the script for FLIP?


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

i know this is where i put but i dont know what to



Re: Vehicle FLIP! - Skaizo - 21.06.2012

try it
pawn Код:
//at top of script
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys&KEY_SUBMISSION)&&!(oldkeys&KEY_SUBMISSION))
    {
        new VehicleID,Float:B;
        VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VehicleID,B);
        SetVehicleZAngle(VehicleID,B);
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped.");
    }
    return 1;
}
press 2 to flip


Re: Vehicle FLIP! - kbalor - 21.06.2012

Quote:
Originally Posted by Skaizo
Посмотреть сообщение
try it
pawn Код:
//at top of script
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys&KEY_SUBMISSION)&&!(oldkeys&KEY_SUBMISSION))
    {
        new VehicleID,Float:B;
        VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VehicleID,B);
        SetVehicleZAngle(VehicleID,B);
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped.");
    }
    return 1;
}
press 2 to flip
Works like a charm! but can i change the height of flip? when i press 2 the car jumps and flips up to 10 inches.


Re: Vehicle FLIP! - Ironboy - 21.06.2012

Add this at the top

pawn Код:
#define KEY_HORN 2

pawn Код:
if (newkeys & KEY_HORN)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new VehicleID,Float:B;
            VehicleID = GetPlayerVehicleID(playerid);
            GetVehicleZAngle(VehicleID,B);
            SetVehicleZAngle(VehicleID,B);
            SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped.");
        }
    }



Re: Vehicle FLIP! - kbalor - 21.06.2012

Quote:
Originally Posted by Skaizo
Посмотреть сообщение
try it
pawn Код:
//at top of script
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys&KEY_SUBMISSION)&&!(oldkeys&KEY_SUBMISSION))
    {
        new VehicleID,Float:B;
        VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(VehicleID,B);
        SetVehicleZAngle(VehicleID,B);
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been flipped.");
    }
    return 1;
}
press 2 to flip
Man, i just change the if((newkeys&KEY_SUBMISSION)&&!(oldkeys&KEY_SUBMISS ION))

to if((newkeys&KEY_CROUCH)&&!(oldkeys&KEY_CROUCH) and its working do you think its better??


Re: Vehicle FLIP! - Dovydux - 02.12.2012

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
Add this at the top

pawn Код:
#define KEY_HORN 2
what does this do?