Textdraw Issue - 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: Textdraw Issue (
/showthread.php?tid=658601)
Textdraw Issue -
Ciandlah - 08.09.2018
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");
}
Re: Textdraw Issue -
ShihabSoft - 08.09.2018
Use PlayerTextDraw instead of TextDraw if you wanna show individual textdraws for players.
Re: Textdraw Issue -
Ciandlah - 08.09.2018
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
Re: Textdraw Issue -
alanhutch - 08.09.2018
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
Re: Textdraw Issue -
Shinja - 08.09.2018
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.000000, 64.000000, "Infected");
TextDrawBackgroundColor(InfectionLabel[playerid], 255);
TextDrawTextSize(InfectionLabel[playerid],633.000000,5.000000);
TextDrawFont(InfectionLabel[playerid], 1);
TextDrawLetterSize(InfectionLabel[playerid],0.159999, 1.100000);
TextDrawColor(InfectionLabel[playerid], -1);
TextDrawSetOutline(InfectionLabel[playerid], 0);
TextDrawSetProportional(InfectionLabel[playerid], 1);
TextDrawSetShadow(InfectionLabel[playerid], 1);
//OnPlayerDisconnect
TextDrawDestroy(InfectionLabel[playerid]);