function()
{
new playerid;
SetPlayerHealth(playerid, 100.0);
}
SetTimer("Tester",1000,1);
public Tester(playerid)
[
SetPlayerHealth(playerid, 100.0);
}
public UpdateSpeed(playerid) //Speedo + Benzin { new Text:vehht; TextDrawDestroy(Text:vehht); new Float:x,Float:y,Float:z; new Float:distance,value,string[128]; new Float:health; new vehid; for(new i=0; i<MAX_PLAYERS; i++) //SLOTS { if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) { TextDrawDestroy(Speedo[i]); } } for(new i=0; i<MAX_PLAYERS; i++) //SLOTS { if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) { vehid = GetPlayerVehicleID(i); format(string, sizeof(string),"cars/car%d.ini",vehid); GetPlayerPos(i, x, y, z); GetVehicleHealth(GetPlayerVehicleID(i), health); distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2)); value = floatround(distance * 5000); if(UpdateSeconds > 1) { value = floatround(value / UpdateSeconds); } format(string,sizeof(string),"~l~Fahrzeug: ~w~%s ~n~~l~km/h: ~w~%d ~n~~l~FahrzeugHP: ~w~ %.2f ~n~~l~Benzin: ~w~%d ~n~~l~VehID: ~w~%d",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400], floatround(value/1000), health, Gas[vehid], vehid); Speedo[i] = TextDrawCreate(380.00, 380.00, string); TextDrawSetOutline(Speedo[i], 0); TextDrawFont(Speedo[i], 1); TextDrawSetShadow(Speedo[i], 0); TextDrawSetProportional(Speedo[i], 2); TextDrawAlignment(Speedo[i], 2); TextDrawShowForPlayer (i, Speedo[i]); } SavePlayerPos[i][LastX] = x; SavePlayerPos[i][LastY] = y; SavePlayerPos[i][LastZ] = z; if(IsPlayerInAnyVehicle(i)) { if(Gas[vehid] < 1) { NoFuel[playerid] = 1; TogglePlayerControllable(i, 0); GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~Kein Benzin mehr im Tank~n~Nutze /exitcar zum Aussteigen",1500,3); } } } }
for(new i=0; i<MAX_PLAYERS; i++)
for(new i=0; i<=MAX_PLAYERS; i++)
Originally Posted by 0rb
Don't try/use Toxicity's suggestion, it will make your script crash.
|
Originally Posted by 0rb
With how many players have you tested this, to confirm it works for everyone but id 0 ? I suggest you show your whole script (on pastebin, not here).
|