В событие OnGameModeInit
Код:
SetTimer("SpeedoUpdate",100,1);
Остальной код в конец мода
Код:
forward SpeedoUpdate(); public SpeedoUpdate() { for(new i = 0; i < MAX_PLAYERS; i++) { if(GetPlayerState(i) == PLAYER_STATE_DRIVER) { GameTextForPlayer(i, Split("~n~~n~~n~~n~~n~~n~~n~~n~~w~~w~KM/?:~b~ ", tostr(GetPlayerSpeed(i)), "~w~ KM/H"),1000, 6); } } return true; } stock GetPlayerSpeed(playerid) { new Float:ST[4]; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]); ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625; return floatround(ST[3]); } Split(s1[], s2[], s3[]="") { new rxx[256]; format(rxx, 256, "%s%s%s", s1, s2, s3); return rxx; } tostr(int) { new st[256]; format(st, 256, "%d", int); return st; }
Автор:Alexander