Speed limiter help - 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: Speed limiter help (
/showthread.php?tid=457715)
Working! lock THEME -
Baumann - 12.08.2013
Working! lock THEME
Re : Speed limiter help -
lelemaster - 12.08.2013
Use SetVehicleVelocity(vehicleid, Float

, Float:y, Float:z);
https://sampwiki.blast.hk/wiki/SetVehicleVelocity
Just get the speed of the player, then if he is going higher then 100 kph, reduce his velocity.
Re: Speed limiter help -
Pk93 - 13.08.2013
Try This
Define.. Top of your gamemode somwhere..
Код:
new Speedlimit[MAX_PLAYERS];
The command
Код:
CMD:speedlimit(playerid, params[])
{
new string[128], speed;
if(sscanf(params, "i", speed)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /speedlimit [Max MPH]");
if(speed < 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid MPH speed.");
Speedlimit[playerid] = speed;
if(speed == 0) format(string, sizeof(string), " You have turned your speed limit off.", speed);
else format(string, sizeof(string), " You have set your speed limit to %d MPH, any vehicle you drive will not go past this limit.", speed);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
and this somewhere in the end of your gm
Код:
// Speedlimit
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Speedlimit[playerid])
{
new a, b, c;
GetPlayerKeys(playerid, a, b ,c);
if(a == 8 && GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) > Speedlimit[playerid])
{
new newspeed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) - Speedlimit[playerid];
ModifyVehicleSpeed(GetPlayerVehicleID(playerid), -newspeed);
}
}
Add this to your variables.
Код:
Speedlimit[playerid] = 0;
NOTE THIS IS TAKEN FROM ANOTHER GAMEMODE IAM NOT THE AUTHOR OF THIS SCRIPT SO DONT GIVE ME CREDS FOR THE SCRIPT ONLY FOR HELP!
Re: Speed limiter help -
Baumann - 13.08.2013
Working! lock THEME
Re: Speed limiter help -
Baumann - 13.08.2013
Can anyone make these codes to one filterscript ?
Re: Speed limiter help -
ScRipTeRi - 13.08.2013
This will help you
https://sampforum.blast.hk/showthread.php?tid=448761
Re: Speed limiter help -
Baumann - 13.08.2013
scripteri this didnt worked .. i try again..
Re: Speed limiter help -
ScRipTeRi - 13.08.2013
you have plugin sscanf ?
Re: Speed limiter help -
Baumann - 13.08.2013
Working! lock THEME
Re: Speed limiter help -
Baumann - 13.08.2013
Working! lock THEME