WHAT?!
#1

Can someone help me with this warns
PHP код:
new Text:hdisplay[MAX_PLAYERS];
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;
}
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;
}
public 
OnPlayerExitVehicle(playerid, vehicleid)
{
     
PlayerTextDrawHide(playerid, hdisplay[playerid]);
        return 
1;
} 
And i get these
PHP код:
C:\Users\Admin\Desktop\Moj SRV\gamemodes\MojMod.pwn(3008) : warning 213: tag mismatch
C
:\Users\Admin\Desktop\Moj SRV\gamemodes\MojMod.pwn(3009) : warning 213: tag mismatch
C
:\Users\Admin\Desktop\Moj SRV\gamemodes\MojMod.pwn(3020) : warning 213: tag mismatch
Pawn compiler 3.2.3664              Copyright 
(c) 1997-2006, ITB CompuPhase
3 Warnings
. 
These are the lines of warns
PHP код:
        PlayerTextDrawSetString(playerid, hdisplay[playerid], szText);
    
PlayerTextDrawShow(playerid, hdisplay[playerid]);
        
PlayerTextDrawHide(playerid, hdisplay[playerid]); 
Reply
#2

PHP код:
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; 
} 
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(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; 
} 
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(playerid, hdisplay[playerid]);
TextDrawHideForPlayer(playerid, hdisplay[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)