SpeedBoost Wrong?
#1

Hi Guys I Made A Speed Boost Command But It Don't Work When i press 'w'

Code:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_FIRE)
    {
       new Car, Float:x, Float:y, Float:z;
       Car = GetPlayerVehicleID(playerid);
       if(IsPlayerInAnyVehicle(playerid))
       {
          GetVehicleVelocity(Car, x, y, z);
          SetVehicleVelocity(Car, x*1.5, y*1.5, z*1.5);
       }
    }
    return 1;
}
Thx For Helping !.
Reply
#2

I didn't understand. You press W, and isn't working. Actually here in this code you writed KEY_FIRE, LMB Button (Left Mouse Button). You still change it to :

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_UP)
    {
       new Car, Float:x, Float:y, Float:z;
       Car = GetPlayerVehicleID(playerid);
       if(IsPlayerInAnyVehicle(playerid))
       {
          GetVehicleVelocity(Car, x, y, z);
          SetVehicleVelocity(Car, x*1.5, y*1.5, z*1.5);
       }
    }
    return 1;
}
Reply
#3

no i meant if i press lmb
and i keep vehicle drive 'w' the speedboost dont work
sorry for my bad english hope u understand
Reply
#4

pawn Код:
// PRESSED(keys)
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_UP))
    {
       if(IsPlayerInAnyVehicle(playerid))
       {
            new Car, Float:x, Float:y, Float:z;
            Car = GetPlayerVehicleID(playerid);
            GetVehicleVelocity(Car, x, y, z);
            SetVehicleVelocity(Car, x*1.5, y*1.5, z*1.5);
       }
    }
    return 1;
}
Reply
#5

thank you very much! !.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)