022R
Умник
Можно ли как то оптимизировать
вот это интересует
Код:
public Drift()
{
new Float:Angle1, Float:Angle2, Float:BySpeed, s[128];
new Float:Z;
new Float:X;
new Float:Y;
new Float:SpeedX;
for(new g=0;g<MAX_PLAYERS;g++)
{
GetPlayerPos(g, X, Y, Z);
SpeedX = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,SavedPos[ g ][ sX ])),2),floatpower(floatabs(floatsub(Y,SavedPos[ g ][ sY ])),2)),floatpower(floatabs(floatsub(Z,SavedPos[ g ][ sZ ])),2)));
Angle1 = ReturnPlayerAngle(g);
Angle2 = GetPlayerTheoreticAngle(g);
BySpeed = floatmul(SpeedX, 12);
if(IsPlayerInAnyVehicle(g) && IsCar(GetPlayerVehicleID(g)) && floatabs(floatsub(Angle1, Angle2)) > DRIFT_MINKAT && floatabs(floatsub(Angle1, Angle2)) < DRIFT_MAXKAT && BySpeed > DRIFT_SPEED)
{
if(PlayerDriftCancellation[g] > 0)KillTimer(PlayerDriftCancellation[g]);
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 2;
scores[g]++;
PlayerDriftCancellation[g] = SetTimerEx("DriftCancellation", 2000, 0, "d", g);
if(DriftPointsNow[g] >100 )
{
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 20;
scores[g]++;
}
if(DriftPointsNow[g] >200 )
{
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 30;
scores[g]++;
}
if(DriftPointsNow[g] >300 )
{
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 40;
scores[g]++;
}
}
Код:
if(PlayerDriftCancellation[g] > 0)KillTimer(PlayerDriftCancellation[g]);
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 2;
scores[g]++;
PlayerDriftCancellation[g] = SetTimerEx("DriftCancellation", 2000, 0, "d", g);
if(DriftPointsNow[g] >100 )
{
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 20;
scores[g]++;
}
if(DriftPointsNow[g] >200 )
{
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 30;
scores[g]++;
}
if(DriftPointsNow[g] >300 )
{
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 40;
scores[g]++;
}
