How can i make 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: How can i make speed boost (
/showthread.php?tid=489761)
How can i make speed boost -
DarkLored - 24.01.2014
Well, i was wondering how to make a player able to boost his car by typing /ssb and when he types it, it gives him the abillity to left click to speed boost any help on how to make a player speed boost?
Re: How can i make speed boost -
Shetch - 24.01.2014
https://sampwiki.blast.hk/wiki/SetVehicleVelocity
Re: How can i make speed boost -
DarkLored - 24.01.2014
whats one of them that gives you the actual speed boost?
Re: How can i make speed boost -
itsCody - 24.01.2014
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(newkeys & KEY_FIRE)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Float:x,Float:y,Float:z;
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
SetVehicleVelocity(GetPlayerVehicleID(playerid), x * 1.0, y * 1.0, z * 1.0);
}
}
}
return 1;
}
Untested but it should work if you hit LMB
Re: How can i make speed boost -
iJumbo - 24.01.2014
Try like that
pawn Код:
new Float:x,Float:y,Float:z,Float:a,Float:distance = 0.27;
GetVehicleVelocity(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
SetVehicleVelocity(vehicleid,floatadd(x,floatmul(distance,floatsin(-a,degrees))), floatadd(y,floatmul(distance,floatcos(-a,degrees))), z);
just increase distance for more boost power