How to make cruise control system - 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: How to make cruise control system (
/showthread.php?tid=196281)
How to make cruise control system -
Mehtab - 05.12.2010
i wanna make a cruise control system which limits the speed of control. How to do it. Or how to make a script that shows warning when a player drives fsatly
Re: How to make cruise control system -
fangoth1 - 05.12.2010
i belive you would need to use this in your code
pawn Код:
new seatid = GetPlayerVehicleSeat(playerid);
if(seatid == 0)
GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid, x, y, z);
SetVehicleVelocity(vehicleid, x, y, z+);// set it to what you want
kinda in a rush just giving you the basics of what you might need
Re: How to make cruise control system -
Jakku - 05.12.2010
pawn Код:
if (GetPlayerSpeed(playerid) > some_value) {
SendClientMessage(playerid, COLOR_COLOR,"You are driving too fast! Slow down");
}
stock GetPlayerSpeed(playerid)
{
new Float:ST[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 110.3;
return floatround(ST[3]);
}