SA-MP Forums Archive
Change vehicle values - 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: Change vehicle values (/showthread.php?tid=461630)



Change vehicle values - lefagroll - 02.09.2013

Can I change the for example top speed of a car in SAMP?
I couldn't find something, and I don't know if it's possible.

Do anyone know if this could work, or is possible?


Re: Change vehicle values - Borg - 02.09.2013

SAMP doesn't provide function to change vehicle specs. But you can add something like "nitro" that will GetVehicleVelocity, increase it and set it by SetVehicleVelocity.
https://sampwiki.blast.hk/wiki/GetVehicleVelocity
https://sampwiki.blast.hk/wiki/SetVehicleVelocity


Re: Change vehicle values - Konstantinos - 02.09.2013

Yes, you can. By getting and changing the vehicle velocity.

For example:
pawn Код:
new
    Float: vx,
    Float: vy,
    Float: vz,
    Float: vs = 1.2 // kind of speedboost. 1.0 is normal (off), under 1.0 goes slower than the normal speed.
;
GetVehicleVelocity( GetPlayerVehicleID( playerid ), vx, vy, vz );
SetVehicleVelocity( GetPlayerVehicleID( playerid ), vx * vs, vy * vs, vz * vs );



Re: Change vehicle values - lefagroll - 03.09.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Yes, you can. By getting and changing the vehicle velocity.

For example:
pawn Код:
new
    Float: vx,
    Float: vy,
    Float: vz,
    Float: vs = 1.2 // kind of speedboost. 1.0 is normal (off), under 1.0 goes slower than the normal speed.
;
GetVehicleVelocity( GetPlayerVehicleID( playerid ), vx, vy, vz );
SetVehicleVelocity( GetPlayerVehicleID( playerid ), vx * vs, vy * vs, vz * vs );
Thanks, it worked, but can I set it over time, like a nitro, so I don't have to type the command over again.
Also, is it possible to add something to the transfender for separate cars/bikes?, and is it possible to create a transfender somewhere else?
EDIT: kinda off topic, but if I use the CreateVehicle function, does it always spawn there in the future?


Re: Change vehicle values - Konstantinos - 03.09.2013

Quote:
Originally Posted by lefagroll
Посмотреть сообщение
Thanks, it worked, but can I set it over time, like a nitro, so I don't have to type the command over again.
You can use a button/key instead.
pawn Код:
#define         PRESSED(%0)             (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
    if( PRESSED( KEY_FIRE ) )
    {
        if( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
        {
            new
                Float: vx,
                Float: vy,
                Float: vz,
                Float: vs = 1.2 // kind of speedboost. 1.0 is normal (off), under 1.0 goes slower than the normal speed.
            ;
            GetVehicleVelocity( GetPlayerVehicleID( playerid ), vx, vy, vz );
            SetVehicleVelocity( GetPlayerVehicleID( playerid ), vx * vs, vy * vs, vz * vs );
        }
    }
    return 1;
}
Pressing left click from the mouse, right CTRL or left ALT, it changes the speed.

Quote:
Originally Posted by lefagroll
Посмотреть сообщение
Also, is it possible to add something to the transfender for separate cars/bikes?
No, it's not. If any bike enters the garage, the message that you cannot mod that vehicle appears.

Quote:
Originally Posted by lefagroll
Посмотреть сообщение
and is it possible to create a transfender somewhere else?
You can make a garage somewhere else and even change the interior inside but it needs a lot of work. If you want to make a menu like that, changing camera to each part etc.

Quote:
Originally Posted by lefagroll
Посмотреть сообщение
EDIT: kinda off topic, but if I use the CreateVehicle function, does it always spawn there in the future?
If the vehicle (that it was created by CreateVehicle function) re-spawns, it will be re-spawned at the location it was created at.