Speedboost and bounce. :S - 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: Speedboost and bounce. :S (
/showthread.php?tid=473167)
Speedboost and bounce. :S -
LeeXian99 - 01.11.2013
So, long time no script! When I'm here, means I got problem with scripting and there's no one around to help me so..
It's about speedboost and bounce. I did this.
pawn Код:
if((newkeys & KEY_FIRE))
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Float:Velocity[3];
if(Boost[playerid] == 1)
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0]*2, Velocity[1]*2, Velocity[2]*2);
}
}
if((newkeys & KEY_CROUCH))
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Float:Velocity[3];
if(Bounce[playerid] == 1)
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]+0.39);
}
}
When I tested it, it doesn't look really good as i expected.
I expected speedboost will go straight and bounce will go jump without stopping (or just bounce and going forward a bit)
So, how can I fix this?
Re: Speedboost and bounce. :S -
Konstantinos - 01.11.2013
pawn Код:
if(newkeys & KEY_FIRE)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(Boost[playerid])
{
new Float:Velocity[3];
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0]*1.2, Velocity[1]*1.2, Velocity[2]*1.2);
}
}
}
if(newkeys & KEY_CROUCH)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(Bounce[playerid])
{
new Float:Velocity[3];
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]+0.3);
}
}
}
The velocity * 2 makes it move too fast that you cannot control. 1.1-1.8 is pretty much fine.
Re: Speedboost and bounce. :S -
LeeXian99 - 01.11.2013
Quote:
Originally Posted by Konstantinos
pawn Код:
if(newkeys & KEY_FIRE) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(Boost[playerid]) { new Float:Velocity[3]; GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]); SetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0]*1.2, Velocity[1]*1.2, Velocity[2]*1.2); } } } if(newkeys & KEY_CROUCH) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(Bounce[playerid]) { new Float:Velocity[3]; GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]); SetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]+0.3); } } }
The velocity * 2 makes it move too fast that you cannot control. 1.1-1.8 is pretty much fine.
|
I mean, when I press LMB, it stops the car. When I press H, it bounce but it stopped the vehicle and bounced... Quite annoyed with this things around for an hour.
Re: Speedboost and bounce. :S -
Konstantinos - 01.11.2013
The code I posted shouldn't stop the car, I use pretty much the same for both speedboost/bounce and they work perfect.
Re: Speedboost and bounce. :S -
LeeXian99 - 01.11.2013
Just weird, why it still stop my car although I used your code? o.0