21.09.2011, 10:14
Hello.
I am a speed limiter.
I declare these variables:
When the limiter is activated (limit = = maximum speed input) :
In OnPlayerUpdate :
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!
I am a speed limiter.
I declare these variables:
Код:
new limiteur[MAX_PLAYERS]; new limiteurReload[MAX_PLAYERS]; new Float:limiteurSpeed[MAX_PLAYERS][3];
Код:
limiteurReload[playerid] = 1; limiteur[playerid] = vitesse;
Код:
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]); } }
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!