Need this. - 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: Need this. (
/showthread.php?tid=609714)
Need this. -
VZMatt - 15.06.2016
Hi there,
I need a SpeedBoost system, like this:
SpeedBoost (Press Alt or Ctrl)
FlyCar and Repair (Press 2)
If you can help me, do it please, I really aprecciate it ^^
Re: Need this. -
GangstaSunny - 15.06.2016
Please use the forum intern search function before creating a new thread.
http://forum.sa-mp.com/showthread.ph...ight=speedbost
You will also find FlyCar and Repair
Re: Need this. -
Jf - 16.06.2016
PHP Code:
// Simple Jump / Speed / Fix using keys.
#define HOLDING(%0) ((newkeys & (%0)) == (%0))
#define JUMP_MULTIPLIER 0.5
#define SPEED_MULTIPLIER 1.5
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
// Speed Boost (Press ALT / LCTRL)
if( HOLDING( KEY_ACTION ) )
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Only the driver of the vehicle is able to do this!
{
new
Float:f_x, Float:f_y, Float:f_z;
GetVehicleVelocity(GetPlayerVehicleID(playerid), f_x, f_y, f_z);
SetVehicleVelocity(GetPlayerVehicleID(playerid), f_x * SPEED_MULTIPLIER, f_y * SPEED_MULTIPLIER, f_z * SPEED_MULTIPLIER);
}
}
// Flip & Fly (Press 2)
if( HOLDING( KEY_SUBMISSION ) )
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // Only the driver of the vehicle will be able to do this!
{
new
Float:f_x, Float:f_y, Float:f_z, vID = GetPlayerVehicleID(playerid);
// Fly
GetVehicleVelocity(vID, f_x, f_y, f_z);
SetVehicleVelocity(vID, f_x, f_y, f_z + JUMP_MULTIPLIER);
// Repair
RepairVehicle(vID);
SetVehicleHealth(vID, 1000.0);
}
}
return 1;
}