31.03.2014, 08:08
Оптимизация:
У тебя походу проблема с таймерами, попробуй их отследить.
pawn Код:
public PlayerDrift() {
for (new Player, PlayerVehicleID = INVALID_VEHICLE_ID; Player < GetMaxPlayers(); Player++) {
if (IsPlayerConnected(Player) && GetPlayerState(Player) == PLAYER_STATE_DRIVER && VehicleIsCar((PlayerVehicleID = GetPlayerVehicleID(Player)))) {
new Float:Angle,
vehicleSpeed = VehicleSpeed(PlayerVehicleID),
Float:playerTheoreticAngle = PlayerTheoreticAngle(Player);
GetVehicleZAngle(PlayerVehicleID, Angle);
Angle = floatabs(floatsub(Angle, playerTheoreticAngle));
if (10.0 < Angle && Angle < 90.0 && 30 < vehicleSpeed && vehicleSpeed < 300) {
if (!PlayerMoney[Player] && !PlayerScore[Player] && PlayerCombo[Player] == 1) {
TextDrawShowForPlayer(Player, ServerTextDrawThree[Player]);
TextDrawShowForPlayer(Player, ServerTextDrawFour[Player]);
TextDrawShowForPlayer(Player, ServerTextDrawFive[Player]);
TextDrawSetString(ServerTextDrawThree[Player]," ");
TextDrawSetString(ServerTextDrawFour[Player]," ");
TextDrawSetString(ServerTextDrawFive[Player]," ");
}
PlayerMoney[Player] += floatround((Angle * (vehicleSpeed * 0.1)) / 10);
PlayerScore[Player] += floatround((Angle * 3 * (vehicleSpeed* 0.1)) / 10);
PlayerCombo[Player] = PlayerScore[Player] / 1000;
if (PlayerCombo[Player] < 1) {
PlayerCombo[Player] = 1;
}
new String[100];
format(String, sizeof(String),"~r~~h~%d~g~$ ~w~+", PlayerMoney[Player]);
TextDrawSetString(ServerTextDrawThree[Player], String);
format(String, sizeof(String),"~r~~h~%d~g~ ~w~+", PlayerScore[Player]);
TextDrawSetString(ServerTextDrawFour[Player], String);
format(String, sizeof(String),"~W~~H~X%d",PlayerCombo[Player]);
TextDrawSetString(ServerTextDrawFive[Player], String);
PlayerTimerOne[Player] = SetTimerEx("PlayerDriftEnd", 3000, 0, "d", Player);
}
}
}
return 1;
}