28.02.2012, 01:52
I made my own little version, I find this one alot better
Theres a bug in yours, once you hit 10 burnout, it does the burnout
if (RELEASED( KEY_SPRINT | KEY_JUMP ) && !(newkeys & ) fixes it
pawn Code:
#define BURNOUT_INDEX 0.015
forward BurnoutFunc(playerid, vehicleid);
public BurnoutFunc(playerid, vehicleid)
{
PlayerInfo[playerid][pBurnout]++;
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
if(PlayerInfo[playerid][pBurnout] > 10 && keys == 8)//VEHICLE_ACCELERATE
{
if(PlayerInfo[playerid][pBurnout] > 30) PlayerInfo[playerid][pBurnout] = 30;
new Float:speed[2];
GetXYInFrontOfVehicle(vehicleid, speed[0], speed[1], BURNOUT_INDEX * PlayerInfo[playerid][pBurnout]);
AccelerateTowardsAPoint(vehicleid, speed[0], speed[1]);
PlayerInfo[playerid][pBurnout] = 0;
KillTimer(PlayerInfo[playerid][pBurnoutTimer]);
}
if(keys == ( KEY_SPRINT | KEY_JUMP )) return 1;//keys are still accelerating and braking
if(keys != ( KEY_SPRINT | KEY_JUMP ) && keys != 8)//keys are now not related to accelerate and brake
{
PlayerInfo[playerid][pBurnout] = 0;
KillTimer(PlayerInfo[playerid][pBurnoutTimer]);
}
return 1;
}
#define TURBO_DEDUCT_INDEX 135
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_SPRINT) && (newkeys & KEY_JUMP) && IsPlayerInAnyVehicle(playerid))
{
PlayerInfo[playerid][pBurnout]++;
PlayerInfo[playerid][pBurnoutTimer] = SetTimerEx("BurnoutFunc", 100, true, "ii", playerid, Current_Vehicle[playerid]);
}
if (RELEASED( KEY_SPRINT | KEY_JUMP ) && !(newkeys & 8))
{
if (IsPlayerInAnyVehicle(playerid) && PlayerInfo[playerid][pBurnout] > 0)
{
PlayerInfo[playerid][pBurnout] = 0;
KillTimer(PlayerInfo[playerid][pBurnoutTimer]);
}
}
return 1;
}
if (RELEASED( KEY_SPRINT | KEY_JUMP ) && !(newkeys & ) fixes it