warning, zbytočne píšeš -.- v posledných tématoch iba blbosti a nijak si nepomohol, možno hodnotenie ok beriem
asi nejak takto:
#include <a_samp>
new Text:Tachometer[MAX_PLAYERS];
public OnFilterScriptInit() {
SetTimer("TachometerTimer", 100, true);
return 1;
}
public OnFilterScriptExit() {
return 1;
}
public OnPlayerConnect(playerid) {
Tachometer[playerid] = TextDrawCreate(524.000000, 330.000000, "");
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate) {
if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
TextDrawShowForPlayer(playerid, Tachometer[playerid]);
} else if (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) {
TextDrawHideForPlayer(playerid, Tachometer[playerid]);
}
return 1;
}
stock GetPlayerSpeed(playerid, bool:kmh)
{
new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
forward TachometerTimer();
public TachometerTimer(){
for (new i = 0; i < MAX_PLAYERS; i++) { /* Ten cyklus o ktorom som hovoril */
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) {
new str[256];
format(str, sizeof(str), "Rychlost: %i", GetPlayerSpeed(i, true));
TextDrawSetString(Tachometer[i], str);
}
}
return 1;
}
je to spísane naslepo, lebo idem spať a už sa mi to testovať nechce, malo by to ísť