[Help] Speed - 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: [Help] Speed (
/showthread.php?tid=454278)
[Help] Speed -
Pajser - 28.07.2013
How can I create system if you press 2 when you are inside the vehicle,that vehicle will drive with just one speed. Example: i'm driving with sultan 110km/h and in a moment I pressed 2 that vehicle will drive without "w" that speed and I will just use right and left. Please let me know how to create it
Re: [Help] Speed -
park4bmx - 28.07.2013
https://sampwiki.blast.hk/wiki/SetVehicleVelocity
Re: [Help] Speed -
Pajser - 28.07.2013
Yes,I know for that,but I don't understand how to create it what did I say
Re: [Help] Speed -
park4bmx - 28.07.2013
pawn Код:
new Float:Velocity[3], VelTimer[MAX_PLAYERS];//global
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new PlayerState = GetPlayerState(playerid);
if(newkeys & KEY_YES && PlayerState == PLAYER_STATE_DRIVER)
{
if(VelTimer[playerid] !=-1) return KillTimer(VelTimer[playerid]);
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
VelTimer[playerid] = SetTimerEx("UpdateVelocity", 500, true, "i", GetPlayerVehicleID(playerid));
}
}
forward UpdateVelocity(veh);
public UpdateVelocity(veh)
{
SetVehicleVelocity(veh,Velocity[0], Velocity[1], Velocity[2]);
return 1;
}
Consider change the update time
But will not go when turning as calculations are involved