Textdraw Issue
#1

I need some advice on where to go from here, as I have hit a brick wall and cant think at the moment.
I have made the textdraws so that if a player joins the server they get their own display menu in a way. However When one person joins they get the textdraws and noone else does. Stuck

Define
Код:
new Text:InfectionLabel[MAX_PLAYERS];
Under OnPlayerConnect
Код:
for(new i; i<MAX_PLAYERS; i++)
	{
	    InfectionLabel[i] = TextDrawCreate(565.000000, 64.000000, "Infected");
		TextDrawBackgroundColor(InfectionLabel[i], 255);
		TextDrawTextSize(InfectionLabel[i],633.000000,5.000000);
		TextDrawFont(InfectionLabel[i], 1);
		TextDrawLetterSize(InfectionLabel[i],0.159999, 1.100000);
		TextDrawColor(InfectionLabel[i], -1);
		TextDrawSetOutline(InfectionLabel[i], 0);
		TextDrawSetProportional(InfectionLabel[i], 1);
		TextDrawSetShadow(InfectionLabel[i], 1);

Under OnGamemodeExit
Код:
for(new i; i<MAX_PLAYERS; i++)
	{
    	TextDrawHideForPlayer(i, InfectionLabel[i]);
    	TextDrawHideForPlayer(i, ServerName[i]);
    	TextDrawHideForPlayer(i, PlayerName[i]);
	}
Under OnPlayerSpawn
Код:
TextDrawShowForPlayer(playerid, InfectionLabel[playerid]);
when the textdraw updates
Код:
if(PlayerInfo[i][psomething] == 0 && PlayerInfo[i][psomething] == 1)
     	{
     	    TextDrawSetString(InfectionLabel[i], "Not Infected");
		}
Reply
#2

Use PlayerTextDraw instead of TextDraw if you wanna show individual textdraws for players.
Reply
#3

You can use Textdraw for individual players as well. I'm asking why it won't show for all players and only one. If there is no other way I will but there should be a way. You could do this in 0.3.z
Reply
#4

If this is under OnPlayerConnect
pawn Код:
for(new i; i<MAX_PLAYERS; i++)
    {
        InfectionLabel[i] = TextDrawCreate(565.000000, 64.000000, "Infected");
        TextDrawBackgroundColor(InfectionLabel[i], 255);
        TextDrawTextSize(InfectionLabel[i],633.000000,5.000000);
        TextDrawFont(InfectionLabel[i], 1);
        TextDrawLetterSize(InfectionLabel[i],0.159999, 1.100000);
        TextDrawColor(InfectionLabel[i], -1);
        TextDrawSetOutline(InfectionLabel[i], 0);
        TextDrawSetProportional(InfectionLabel[i], 1);
        TextDrawSetShadow(InfectionLabel[i], 1);
At every connection will be created MAX_PLAYERS number of TextDraw.
Don't use the loop in OnPlayerConnect, just use 'playerid'.

And yeah, use Player Textdraws.

The best way to do this is probably creating only 2 global TextDraws, one with 'Infected' and one with 'Not Infected', to just show and hide without actually changin anything
Reply
#5

You dont need to loop at each playerconnect, simply create the player's textdraw when he connects and destroy it when he disconnect

PHP код:
//OnPlayerConnec
InfectionLabel[playerid] = TextDrawCreate(565.00000064.000000"Infected");
        
TextDrawBackgroundColor(InfectionLabel[playerid], 255);
        
TextDrawTextSize(InfectionLabel[playerid],633.000000,5.000000);
        
TextDrawFont(InfectionLabel[playerid], 1);
        
TextDrawLetterSize(InfectionLabel[playerid],0.1599991.100000);
        
TextDrawColor(InfectionLabel[playerid], -1);
        
TextDrawSetOutline(InfectionLabel[playerid], 0);
        
TextDrawSetProportional(InfectionLabel[playerid], 1);
        
TextDrawSetShadow(InfectionLabel[playerid], 1);
//OnPlayerDisconnect
TextDrawDestroy(InfectionLabel[playerid]); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)