SA-MP Forums Archive
Opening TextDraw bug - 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)
+--- Thread: Opening TextDraw bug (/showthread.php?tid=619041)



Opening TextDraw bug - NeXoR - 12.10.2016

Hey guys, I have a small bug
When I enter the server, I am getting a textdraw:
"Welcome to MILITARY VS REBELS (MyName)"
Now I noticed a bug, if someone else enters the server while I am in the class selection, I am getting HIS name on the textdraw (it changes from myname to his name) for me

Codes:
PHP код:
public OnPlayerConnect(playerid)
{
    
ClearChar(playerid);
    
SetPlayerColor(playerid0x6F6F6FFF);
    new 
string[128];
    
format(stringsizeof(string), "~y~Welcome to~n~~b~MILLITARY ~w~VS ~r~REBELS~n~~w~%s"RPN(playerid));
    
TextDrawSetString(OP[4], string);
    
ToggleOpeningTD(playerid1);
    
PlayerInfo[playerid][pLoggedIn] = 0;
    new 
query[248];
    
mysql_format(mysqlquerysizeof(query), "SELECT `BannedBy`, `BanReason`, `BannedDate`, `Username`, `IP` FROM `BanList` WHERE `Banned`=1 AND (`IP`='%e' OR `Username`='%e')"RPIP(playerid), RPN(playerid));
    
mysql_tquery(mysqlquery"CheckBan""i"playerid);
    
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `Users` WHERE `Username`='%e' LIMIT 1"RPN(playerid));
    
mysql_tquery(mysqlquery"LoadChar""i"playerid);
    return 
1;

ToggleOpeningTD
PHP код:
stock ToggleOpeningTD(playeridtoggle)
{
    if(
toggle)
    {
        for(new 
05i++) TextDrawShowForPlayer(playeridOP[i]);
        
TextDrawShowForPlayer(playeridVers);
    }
    else
    {
        for(new 
05i++) TextDrawHideForPlayer(playeridOP[i]);
        
TextDrawHideForPlayer(playeridVers);
    }

TextDraw creation
PHP код:
    OP[4] = TextDrawCreate(312.66668729.037025"Welcome to MILLITARY VS REBELS");
    
TextDrawLetterSize(OP[4], 0.4499991.600000);
    
TextDrawAlignment(OP[4], 2);
    
TextDrawColor(OP[4], 0xFFF000FF);
    
TextDrawSetShadow(OP[4], 0);
    
TextDrawSetOutline(OP[4], 0);
    
TextDrawBackgroundColor(OP[4], 51);
    
TextDrawFont(OP[4], 2);
    
TextDrawSetProportional(OP[4], 1); 



Re: Opening TextDraw bug - ISmokezU - 12.10.2016

Try using Per Player Textdraws instead.


Re: Opening TextDraw bug - NeXoR - 12.10.2016

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Try using Per Player Textdraws instead.
Is there a different way?


Re: Opening TextDraw bug - Pearson - 12.10.2016

Use PlayerTextDraw :3 :3


Re: Opening TextDraw bug - azzerking - 13.10.2016

Information

You will need to use Player Textdraws instead, the way your using textdraws is globally, which means there is one Textdraw shared amongst all the players on your server, and when you change the textdraws text, your changing it for the entire server.

This is where Player Textdraws come in, as they allow you to have one textdraw per player, and if you change the text of that textdraw it will only apply to the player of the textdraw you have changed.

You can see more here: CreatePlayerTextDraw


Re: Opening TextDraw bug - NeXoR - 13.10.2016

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Information

You will need to use Player Textdraws instead, the way your using textdraws is globally, which means there is one Textdraw shared amongst all the players on your server, and when you change the textdraws text, your changing it for the entire server.

This is where Player Textdraws come in, as they allow you to have one textdraw per player, and if you change the text of that textdraw it will only apply to the player of the textdraw you have changed.

You can see more here: CreatePlayerTextDraw
Shouldn't I re-show it to the player to change the text of a global textdraw ?


Re: Opening TextDraw bug - Rdx - 13.10.2016

No. Create textdraw per player, no other way.