Heyho;)
Habe mir 2 Textdraws erstellt jeweils Benzin und Leben
new Tank[MAX_VEHICLES];
new Text:vtank;
new Text:vleben;
new timer;
forward textdrawvtank(playerid);
forward textdrawvleben(playerid);
for(new c=0;c<MAX_VEHICLES;c++)
{
Tank[code=c] = 100;
}
vtank= TextDrawCreate(432.8,400.0,"Benzin: 100");
vleben = TextDrawCreate(432.8,380.0,"Leben: 100");
public OnPlayerExitVehicle(playerid, vehicleid)
{
KillTimer(timer);
TextDrawHideForPlayer(playerid,vtank);
TextDrawHideForPlayer(playerid,vleben);
return 1;
}
public textdrawvtank(playerid)
{
new veh = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(Tank[veh] > 0)
{
Tank[veh] = Tank[veh] - 1;
format(tankstr,sizeof tankstr,"Benzin: %d",Tank[veh]);
TextDrawSetString(Anzeige,tankstr);
}
else
{
format(tankstr,sizeof tankstr,"Benzin leer");
TogglePlayerControllable(playerid,0);
TextDrawSetString(Anzeige,tankstr);
}
}
return 1;
}
public textdrawvleben(playerid)
{
new veh = GetPlayerVehicleID(playerid);
new Float:health;
GetVehicleHealth(veh, health);
new lstr[10];
if(IsPlayerInAnyVehicle(playerid))
{
format(lstr,sizeof lstr,"Leben: %d",health);
TextDrawSetString(vleben,lstr);
}
return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == 2 && IsPlayerInAnyVehicle(playerid))
{
timer = SetTimerEx("textdrawvtank",2500,1,"i",playerid);
timer = SetTimerEx("textdrawvleben",2500,1,"i",playerid);
TextDrawShowForPlayer(playerid,vleben);
TextDrawShowForPlayer(playerid,vtank);
}
return 1;
}
Nur wenn ich jetzt fahre verändert sich die Lebens und Tankanzeige net weiß wer um rat?
Sieht niemand ein Prob?