Speed limiter help
#1

Working! lock THEME
Reply
#2

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.
Reply
#3

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!
Reply
#4

Working! lock THEME
Reply
#5

Can anyone make these codes to one filterscript ?
Reply
#6

This will help you https://sampforum.blast.hk/showthread.php?tid=448761
Reply
#7

scripteri this didnt worked .. i try again..
Reply
#8

you have plugin sscanf ?
Reply
#9

Working! lock THEME
Reply
#10

Working! lock THEME
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)