Constant speed function - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Constant speed function (
/showthread.php?tid=255548)
Constant speed function -
Swiftz - 16.05.2011
I need something like this, WHen a player has true for certain variable and drives a car , the speed should automatically boost (like 2x or 1.5x) without a need for tapping a specific button, How can i do this plz help
Re: Constant speed function -
park4bmx - 16.05.2011
OnPlayerUpdate
What u looking for just Put ur code there and it will automatickpy update
Re: Constant speed function -
Backwardsman97 - 16.05.2011
Try this on for size.
pawn Код:
forward BoostTime(playerid);
//When you start the boost
SetPVarInt(playerid,"BoostTime",SetTimerEx("BoostTime",2000,1,"d",playerid));
public BoostTime(playerid)
{
new
Float:x,
Float:y,
Float:z,
Float:v = GetPlayerVehicleID(playerid);
GetVehicleVelocity(v,x,y,z);
SetVehicleVelocity(v,x*1.3,y*1.3,z*1.3);
return 1;
}
//When you stop the boost
KillTimer(GetPVarInt(playerid,"BoostTime"));
You'll probably want to play around with the time on the timer so he doesn't just constantly accelerate until he goes way too fast.
Re: Constant speed function -
Swiftz - 16.05.2011
If i have about 30 players driving at a time, will all those timers cause me lag? and i need to add that function under onplayerstatechange (driver state) right? and how can i set like it should speed after reaching certain speed? Like where should i use getvehiclespeed function and know if speed if greater than certain limit and if so add that function. So where to add?