Vehicle Boost Help
#1

I have this
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys == KEY_FIRE)
    {
        if (pRank[playerid] > 4) {
            new vid, Float:x, Float:y, Float:z, Float:nx, Float:ny;
            vid = GetPlayerVehicleID(playerid);
            if(vid != 0) {
                GetVehicleVelocity(vid, x, y, z);
                if(x == 0) nx = x;
                else if(x < 0) nx = x - 0.5;
                else nx = x + 0.5;
                if(y == 0) ny = y;
                else if(y < 0) ny = y - 0.5;
                else ny = y + 0.5;
                SetVehicleVelocity(vid, nx, ny, z);
            }
        }
    }
    return 1;
}
This works but only boosts you in the general direction of travel. Can somebody make it so it boost you in exactly the direction of travel.
Reply
#2

Use GetVehicleZAngle
Reply
#3

Well this is a kind of simple way of putting it but...

pawn Код:
new Float:x,Float:y,Float:z;
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
SetVehicleVelocity(GetPlayerVehicleID(playerid),x*1.5,y*1.5,z*1.5);
Sometimes the simple solution is the best solution
Reply
#4

Vehicle boost for a roleplay server.
Reply
#5

Multiply Works! Nice and simple.

Yes... For The Admins
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)