Posts: 281
Threads: 2
Joined: Sep 2011
pawn Код:
stock GetVehicleSpeed(vehicleid)
{
new Float:x, Float:y, Float:z;
GetVehicleVelocity(vehicleid, x, y, z);
return floatround(floatsqroot(x*x+y*y+z*z)*195);
}
stock setVehicleSpeed ( vehicleid, speed_mph )
{
if ( speed_mph < 1 ) speed_mph = 1;
new Float: v[3], cur_speed_mph;
GetVehicleVelocity( vehicleid, v[0], v[1], v[2] );
cur_speed_mph = floatround( 200.0 * floatsqroot( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] ), floatround_floor );
if ( cur_speed_mph <= 0 )
{
new Float: zAngle;
GetVehicleZAngle( vehicleid, zAngle );
new Float: newVelX = floatcos( (zAngle -= 270.0), degrees ) * speed_mph / 200.0;
SetVehicleVelocity( vehicleid, newVelX, floattan(zAngle,degrees) * newVelX, 0.0 );
return;
}
new Float: vMultiplier = float(speed_mph) / float(cur_speed_mph);
SetVehicleVelocity( vehicleid, v[0] * vMultiplier, v[1] * vMultiplier, v[2] * vMultiplier );
}
а в OnPlayerUpdate:
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
new veh = GetPlayerVehicleID(playerid);
if(GetVehicleSpeed(veh) > 50) SetVehicleSpeed(veh, 49);
}
как-то так
Posts: 201
Threads: 16
Joined: Jan 2011
Reputation:
0
есть же FS'ы ограничители скорости) гуглите)
Posts: 167
Threads: 21
Joined: Oct 2011
Reputation:
0
EvgeN 1137, спасибо вам! И всем спс что помогаете