WHAT?!
#1

Can someone help me with this warns
PHP код:
new Text:hdisplay[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
        
hdisplay[playerid] = TextDrawCreate(505.625000427.583404"Health:");
    
TextDrawLetterSize(hdisplay[playerid], 0.4693752.020000);
    
TextDrawAlignment(hdisplay[playerid], 1);
    
TextDrawColor(hdisplay[playerid], -5963521);
    
TextDrawSetShadow(hdisplay[playerid], 0);
    
TextDrawSetOutline(hdisplay[playerid], 1);
    
TextDrawBackgroundColor(hdisplay[playerid], 51);
    
TextDrawFont(hdisplay[playerid], 1);
    
TextDrawSetProportional(hdisplay[playerid], 1);
        return 
1;
}
public 
OnPlayerEnterVehicle(playeridvehicleid)
{
        new 
FloathealthszText[10];
    
GetVehicleHealth(vehicleidhealth);
    
format(szTextsizeof (szText), "%.2f"health);
    
PlayerTextDrawSetString(playeridhdisplay[playerid], szText);
    
PlayerTextDrawShow(playeridhdisplay[playerid]);
        return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
     
PlayerTextDrawHide(playeridhdisplay[playerid]);
        return 
1;

And i get these
PHP код:
C:\Users\Admin\Desktop\Moj SRV\gamemodes\MojMod.pwn(3008) : warning 213tag mismatch
C
:\Users\Admin\Desktop\Moj SRV\gamemodes\MojMod.pwn(3009) : warning 213tag mismatch
C
:\Users\Admin\Desktop\Moj SRV\gamemodes\MojMod.pwn(3020) : warning 213tag mismatch
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
3 Warnings

These are the lines of warns
PHP код:
        PlayerTextDrawSetString(playeridhdisplay[playerid], szText);
    
PlayerTextDrawShow(playeridhdisplay[playerid]);
        
PlayerTextDrawHide(playeridhdisplay[playerid]); 
Reply
#2

PHP код:
public OnPlayerConnect(playerid

        
hdisplay[playerid] = TextDrawCreate(505.625000427.583404"Health:"); 
    
TextDrawLetterSize(hdisplay[playerid], 0.4693752.020000); 
    
TextDrawAlignment(hdisplay[playerid], 1); 
    
TextDrawColor(hdisplay[playerid], -5963521); 
    
TextDrawSetShadow(hdisplay[playerid], 0); 
    
TextDrawSetOutline(hdisplay[playerid], 1); 
    
TextDrawBackgroundColor(hdisplay[playerid], 51); 
    
TextDrawFont(hdisplay[playerid], 1); 
    
TextDrawSetProportional(hdisplay[playerid], 1); 
        return 
1

Try this

Код:
public OnPlayerConnect(playerid) 
{ 
    hdisplay[playerid] = TextDrawCreate(505.625000, 427.583404, "Health:"); 
    TextDrawLetterSize(hdisplay[playerid], 0.469375, 2.020000); 
    TextDrawAlignment(hdisplay[playerid], 1); 
    TextDrawColor(hdisplay[playerid], -5963521); 
    TextDrawSetShadow(hdisplay[playerid], 0); 
    TextDrawSetOutline(hdisplay[playerid], 1); 
    TextDrawBackgroundColor(hdisplay[playerid], 51); 
    TextDrawFont(hdisplay[playerid], 1); 
    TextDrawSetProportional(hdisplay[playerid], 1); 
    return 1; 
}
PHP код:
public OnPlayerEnterVehicle(playeridvehicleid

        new 
FloathealthszText[10]; 
    
GetVehicleHealth(vehicleidhealth); 
    
format(szTextsizeof (szText), "%.2f"health); 
    
PlayerTextDrawSetString(playeridhdisplay[playerid], szText); 
    
PlayerTextDrawShow(playeridhdisplay[playerid]); 
        return 
1

tryy
Код:
public OnPlayerEnterVehicle(playerid, vehicleid) 
{ 
    new Float: health, szText[10]; 
    GetVehicleHealth(vehicleid, health); 
    format(szText, sizeof (szText), "%.2f", health); 
    PlayerTextDrawSetString(playerid, hdisplay[playerid], szText); 
    PlayerTextDrawShow(playerid, hdisplay[playerid]); 
    return 1; 
}
Reply
#3

Half of your code is a global txd and the other half is a player txd.

PHP код:
new PlayerText:hdisplay[MAX_PLAYERS];

PlayerText...(...); 
Reply
#4

Rly??

By the way i fixed it

I replaced warn lines with this
PHP код:
TextDrawSetString(hdisplay[playerid], szText);
    
TextDrawShowForPlayer(playeridhdisplay[playerid]);
TextDrawHideForPlayer(playeridhdisplay[playerid]); 
Reply
#5

Right but you shouldn't do that.

Once you create enough, the TXD's will stop. Use player textdraws for players.
Reply
#6

Also, you need to fetch the health, format string and set the string to the textdraw inside a timer function that repeats. With your code, it will only get the vehicle health when a player enters a vehicle and won't be updated upon vehicle damage.
Reply
#7

Yup that is what happened. I fixed it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)