Der Fehler muss irgendwo in "OnPlayerStateChange(playerid, newstate, oldstate)" liegen, da der darin enthaltene Code: "SetPlayerArmedWeapon(playerid,0);" ebenfalls
nicht abgefragt wird!
Hallo,
ich habe derzeit folgendes Tachosystem:
new Tachospeedanzeige[Tachosystem];
new Text:Tacho[MAX_PLAYERS][6];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i; i < 13; i++)
{
TextDrawShowForPlayer(playerid, Tachospeedanzeige[Tachoanzeige][i]);
}
for(new i; i < 6; i++)
{
Tacho[playerid][i] = TextDrawCreate(516.0,350.0, "~r~ |");
}
}
else
{
for(new i; i < 6; i++)
TextDrawHideForPlayer(playerid, Tacho[playerid][i]);
for(new i; i < 13; i++)
TextDrawHideForPlayer(playerid, Tachospeedanzeige[Tachoanzeige][i]);
}
if(newstate == PLAYER_STATE_DRIVER)
{
TextDrawShowForPlayer(playerid,Tachospeedanzeige[Tachoanzeige][playerid]);
}
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), fPos2[0], fPos2[1], fPos2[2]);
sSpeed = floatsqroot(floatpower(fPos2[0], 2) + floatpower(fPos2[1], 2) +
floatpower(fPos2[2], 2)) * 200;
new Float:alpha = 320 - sSpeed;
if(alpha < 70)
alpha = 70;
for(new i; i < 6; i++)
{
TextDrawHideForPlayer(playerid, Tacho[playerid][i]);
TextDrawDestroy(Tacho[playerid][i]);
Speed(516,350, Pos[i][0], Pos[i][1], alpha, (i + 1) * 7);
Tacho[playerid][i] = TextDrawCreate(Pos[i][0], Pos[i][1], "~r~ |");
TextDrawLetterSize(Tacho[playerid][i],0.9,3.0);
TextDrawSetOutline(Tacho[playerid][i], 0);
TextDrawSetShadow(Tacho[playerid][i], 1);
TextDrawShowForPlayer(playerid, Tacho[playerid][i]);
}
}
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510)
{
new string[125];
if(Tank[vehicleid] < 10) format(string,sizeof string,"~r~Tank: ~r~%i",Tank[vehicleid]);
else if(Tank[vehicleid] < 20) format(string,sizeof string,"~r~Tank: ~r~%i",Tank[vehicleid]);
else if(Tank[vehicleid] < 40) format(string,sizeof string,"~y~Tank: ~y~%i",Tank[vehicleid]);
else if(Tank[vehicleid] <= 100) format(string,sizeof string,"~g~Tank: ~g~%i",Tank[vehicleid]);
TextDrawSetString(Anzeige[playerid],string);
}
}
else
{
TextDrawSetString(Anzeige[playerid], " ");
}
}
Doch nach der Zeit (nach 5-6 Stunden, die der Server läuft), verschwindet es (Tank und Geschwindigkeitsanzeige) einfach, woran kann das liegen?
Vielen Dank im Vorraus!