Speedboost problem!
#1

Hey whats wrong with this code.. my speed boost is all types of FUCKED UP -.-...

pawn Код:
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
   
    if(booston[playerid] == 1)
    {
        if (newkeys & KEY_FIRE)
        {
          new Float:vx, Float:vy, Float:vz;
         
          GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), vx + 0.2, vy + 0.2 , vz);
         
          return 1;
        }
    }
}
Video of what happens...



The problem:

It goes the way its scripted.. + y, + x.. Not the direction the car is moving, How do i make it go the direction the car is moving?
Reply
#2

I think you should get the XY position infront of the player. you can find a script for it here somewhere
Reply
#3

pawn Код:
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
    if(booston[playerid] == 1)
    {
        if (newkeys & KEY_FIRE)
        {
            new Float:vx, Float:vy, Float:vz;
            GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);

            new Float:va;
            GetVehicleZAngle(GetPlayerVehicleID(playerid), va);

            SetVehicleVelocity(GetPlayerVehicleID(playerid), floatsin(-va, degrees) + 0.2, floatcos(va, degrees) + 0.2 , vz);
            return 1;
        }
    }
}
Reply
#4

bah
maybe u have a look at this single line, it will simply increase your accelratiion instead of your speed:
Код:
SetVehicleVelocity(GetPlayerVehicleID(playerid), vx*1.1, vy*1.1 , vz*1.1);
how you use it, belogs to you ^^
-this works for negative speeds too
-only cars/bikes works with that speed trick (planes and boats seems to have a speedlimit assigned to)
-you will need a "max speed" check i guess...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)