Speed limiter
#1

Hello.

I am a speed limiter.

I declare these variables:
Код:
new limiteur[MAX_PLAYERS];
new limiteurReload[MAX_PLAYERS];
new Float:limiteurSpeed[MAX_PLAYERS][3];
When the limiter is activated (limit = = maximum speed input) :
Код:
limiteurReload[playerid] = 1;
limiteur[playerid] = vitesse;
In OnPlayerUpdate :
Код:
GetVehicleVelocity(GetPlayerVehicleID(playerid), fPos[0], fPos[1], fPos[2]);

		fSpeed = floatsqroot(floatpower(fPos[0], 2) + floatpower(fPos[1], 2) +
		 floatpower(fPos[2], 2)) * 150;
		 
		new Float:alpha = 320 - fSpeed;

	    if(limiteurReload[playerid] == 1) {
		    if(limiteur[playerid] == fSpeed) {
				for(new i = 0; i < 3; i++) {
					limiteurSpeed[playerid][i] = fPos[i];
					printf("%d - %f - %f",i,fPos[i],limiteurSpeed[playerid][i]);
				}
				limiteurReload[playerid] = 0;
		    }
		}
		if(limiteur[playerid] != 0) {
	    	if(fSpeed > limiteur[playerid]) {
	    	    SetVehicleVelocity(GetPlayerVehicleID(playerid), limiteurSpeed[playerid][0], limiteurSpeed[playerid][1], limiteurSpeed[playerid][2]);
			}
		}
Basically, I get the velocity of the vehicle when it is waiting limit.

If the above, we commend its velocity parameters recovered.

The problem is that with this script, if you exceed the speed limit, it returns to 0km / h (as if the settings were left at 0 ...)

How to solve it? Thank you!
Reply


Messages In This Thread
Speed limiter - by Urefeu - 21.09.2011, 10:14
Re: Speed limiter - by Urefeu - 21.09.2011, 10:29
Re: Speed limiter - by [MWR]Blood - 21.09.2011, 11:17

Forum Jump:


Users browsing this thread: 1 Guest(s)