SA-MP Forums Archive
vehicle speed boost - 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 speed boost (/showthread.php?tid=443333)



vehicle speed boost - absolute - 11.06.2013

hi
anyone knows how to fix this? i wrote this script but it works for cars only , it doesnt work for bikes, boats and shits
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
    {
        if(newkeys & KEY_LOOK_BEHIND)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            new Float:angle;
            GetVehicleZAngle(vehicleid, angle);
            new Float:velox, Float:veloy, Float:veloz;
            GetVehicleVelocity(vehicleid, velox, veloy, veloz);
            velox += floatsin(-angle, degrees);
            veloy += floatcos(-angle, degrees);
            SetVehicleVelocity(vehicleid, velox, veloy, veloz);
        }
    }



Re: vehicle speed boost - Avi57 - 11.06.2013

I Dont think it works on Bikes, planes?


Re: vehicle speed boost - absolute - 11.06.2013

what u mean?
well it doesnt , but i need to edit to make it work for bikes too


Re: vehicle speed boost - Konstantinos - 11.06.2013

I had similar problem months ago, and it worked only for vehicles. I'm now using something similar to the code above and it works for all the vehicles.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new
        Float:vx,
        Float:vy,
        Float:vz
    ;
    if((newkeys & KEY_LOOK_BEHIND) && !(oldkeys & KEY_LOOK_BEHIND))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
            if(floatabs(vx) < 3 && floatabs(vy) < 3 && floatabs(vz) < 3)
            {
                SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * 1.5, vy * 1.5, vz * 1.5);
            }
        }
    }
    return 1;
}
By Matite (I think).


Re: vehicle speed boost - absolute - 11.06.2013

thnaks so much for the help mate, but it doesn't work too


Re: vehicle speed boost - feartonyb - 11.06.2013

The velocity can be set only for cars. You can use SetVehiclePos for this script


Re: vehicle speed boost - Konstantinos - 12.06.2013

Quote:
Originally Posted by feartonyb
Посмотреть сообщение
The velocity can be set only for cars. You can use SetVehiclePos for this script
You're wrong. It can be set for any available vehicle in SA:MP...


Re: vehicle speed boost - feartonyb - 12.06.2013

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
You're wrong. It can be set for any available vehicle in SA:MP...
Nope. Doesn't take any effect on trains and some vehicles.


Re: vehicle speed boost - absolute - 13.06.2013

nevermind , gonna get it from another script lol :P