28.05.2014, 12:43
Hmm... How about use thread for calculates? Example:
UPD: Server anyway crashes
pawn Код:
new tickid;
new Float:PlayerVelocity[MAX_PLAYERS][3];
new PlayerSpeed[MAX_PLAYERS];
public OnGameModeInit() {
tickid = CreateThread("CalculateSpeed");
}
public OnGameModeExit() {
DestroyThread(tickid);
}
public CalculateSpeed(threadid) {
for(new i; i < MAX_PLAYERS; i++) {
PlayerSpeed[i] = floatround(floatsqroot(floatabs(floatpower(PlayerVelocity[i][0] + PlayerVelocity[i][1] + PlayerVelocity[i][2],2))) * 100)
}
SleepThread(100);
}
public OnPlayerUpdate(playerid) {
GetVehicleVelocity(GetPlayerVehicleID(playerid), PlayerVelocity[playerid][0], PlayerVelocity[playerid][1], PlayerVelocity[playerid][2]);
// Here send to player (PlayerSpeed[playerid])
}