SA-MP Forums Archive
text draw screwing other textrdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: text draw screwing other textrdraw (/showthread.php?tid=160956)



text draw screwing other textrdraw - aNdReSk - 18.07.2010

Why is this timer not showing up properly the text draw?
It doesnt bug other textdraw (in this case the clock) if i dont show it (the gas one)

pawn Код:
public CheckGas()
 {
  for(new i=0;i<MAX_PLAYERS;i++)
   {
      if(IsPlayerConnected(i))
       {
       //-----------------------------------------------------------------
       if  (IsPlayerInAnyVehicle(i)){
        if (VehicleInfo[GetPlayerVehicleID(i)][buybar] == 0){
        return 1;
        }
        new GasString[256];
        new TBarZone[MAX_ZONE_NAME];
        GetPlayer2DZone(i, TBarZone, MAX_ZONE_NAME);  // Location
        TextDrawHideForPlayer(i,GASTD[i]);
        VehicleInfo[GetPlayerVehicleID(i)][gas]=VehicleInfo[GetPlayerVehicleID(i)][gas]-1;
        format(GasString, sizeof(GasString), "] %s ] %s ] Gas: %d % ]", TBarZone, VehicleInfo[GetPlayerVehicleID(i)][name], VehicleInfo[GetPlayerVehicleID(i)][gas]);
        TextDrawSetString(GASTD[i],GasString);
        TextDrawShowForPlayer(i,GASTD[i]);
        return 1;
       }
       //-----------------------------------------------------------------
       new GasString[256];
       new TBarZone[MAX_ZONE_NAME];
       GetPlayer2DZone(i, TBarZone, MAX_ZONE_NAME); // Location
       TextDrawHideForPlayer(i,GASTD[i]);
       format(GasString, sizeof(GasString), "] %s ]", TBarZone);
       TextDrawSetString(GASTD[i],GasString);
       TextDrawShowForPlayer(i,GASTD[i]);
       return 1;


       }
       
   }
   
 return 1;
 }



Re: text draw screwing other textrdraw - aNdReSk - 18.07.2010

bump :P plz


Re: text draw screwing other textrdraw - Kar - 18.07.2010

is this in a filterscript?


Re: text draw screwing other textrdraw - aNdReSk - 18.07.2010

no it's on my GM


it seems to be working for id 0 only? rest of id's screw the player's clock


Re: text draw screwing other textrdraw - Kar - 18.07.2010

whats the checkgas timer set to


Re: text draw screwing other textrdraw - aNdReSk - 18.07.2010

SetTimer("CheckGas", 500, 1);

--------------------

also other things that may help to figure out:

pawn Код:
new Text:GASTD[MAX_PLAYERS];
//(on top) ----------------------------------------------------------------------------


TextDrawHideForPlayer(playerid,GASTD[playerid]);
//(on player death) ----------------------------------------------------------------------------

TextDrawShowForPlayer(playerid,GASTD[playerid]);
//(on player spawn) ----------------------------------------------------------------------------


    GASTD[playerid] = TextDrawCreate(78.000000, 437.000000, "_"); // ] ocean flats ] infernus ] gas: 100% ]
    TextDrawBackgroundColor(GASTD[playerid], 255);
    TextDrawAlignment(GASTD[playerid], 1);
    TextDrawFont(GASTD[playerid], 2);
    TextDrawLetterSize(GASTD[playerid], 0.220000, 0.899999);
    TextDrawColor(GASTD[playerid], 16777215);
    TextDrawSetOutline(GASTD[playerid], 0);
    TextDrawSetProportional(GASTD[playerid], 1);
    TextDrawSetShadow(GASTD[playerid], 1);

//(on player connect) ----------------------------------------------------------------------------


TextDrawDestroy(GASTD[playerid]);
//(on player disconnect) ----------------------------------------------------------------------------



Re: text draw screwing other textrdraw - Kar - 18.07.2010

onplayer disconnect hidetextdraw dont destroy it

under gamemodeexit destroy textdraw in a loop

maybe try using onplayerstatechange to for when player goes in vehicle it shows because i dont understand why you show gas if player is out of vehicle?