heyho liebe Community.
Ich hab mal wieder ein Problem....
Undzwar habe ich ein Tacho eingabut.. das funktioniert aber nicht
Sobald ich in ein Fahrzeug steige stürzt das Spiel ab ![]()
Hier der Code (Timer ist oben 700 Sekunden
Die Textdraws wurden mit der id i für MAX_Player in einer For Schleife erstellt
new text:Textdraw0[MAX_PLAYERS];
new text:Textdraw1[MAX_PLAYERS];
new text:Textdraw2[MAX_PLAYERS];
public VehStateCheck()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsANoTachoVehicle(GetPlayerVehicleID(i)))
{
if(M_Bot[i][PAFK] == 0)
{
new TachoString1[20];
new TachoString2[20];
new TachoString3[50];
new Float:health,vehicleid = GetPlayerVehicleID(i),Float:value,Float:distance,Float:x,Float:y,Float:z;
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,PCarPos[i][PCarX])),2)+floatpower(floatabs(floatsub(y,PCarPos[i][PCarY])),2)+floatpower(floatabs(floatsub(z,PCarPos[i][PCarZ])),2));
value = floatround(distance * 5000);
GetVehicleHealth(vehicleid,health);
format(TachoString1, sizeof(TachoString1), "Tank: %d/%dL",Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)));
TextDrawSetString(Textdraw0[i], TachoString1);
format(TachoString2, sizeof(TachoString2), "Speed: %d~b~km/h~",floatround(value/1700));
TextDrawSetString(Textdraw1[i], TachoString2);
format(TachoString3, sizeof(TachoString3), "Fahrzeug: %s",GetGasMax(GetVehicleModel(vehicleid)));
TextDrawSetString(Textdraw2[i], TachoString3);
PCarPos[i][PCarX] = x;
PCarPos[i][PCarY] = y;
PCarPos[i][PCarZ] = z;
}
}
}
return 1;
}
Und das hier wenn man in einem Fahrzeug der fahrer ist
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
TextDrawShowForPlayer(playerid, Textdraw2[playerid]);