SA-MP Forums Archive
Textdraw for a player - 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 for a player (/showthread.php?tid=302446)



Textdraw for a player - gagnier91 - 09.12.2011

Hi, im trying to show a textdraw for each player, but i can't get it to show to only a player... this is what i've done :

at the top :
Код:
new Text:TextDrawsd[MAX_PLAYERS];
and above :
Код:
public OnPlayerConnect(playerid) {
    TextDrawsd[playerid] = TextDrawCreate(549.0,310.0," ");
    TextDrawShowForPlayer(playerid,TextDrawsd[playerid]);
	return 1;
}

public OnPlayerDisconnect(playerid, reason) {
    TextDrawDestroy(TextDrawsd[playerid]);
    return 1;
}
im updating the textdraw with :
Код:
TextDrawSetString(TextDrawsd[playerid], "Some text here");
But all the textdraw show to the same player and all others players don't see any textdraw. how can i fix this?

Thank you for your help


Re: Textdraw for a player - Dragony92 - 09.12.2011

Create texdraw in ongamemodeinit and show it in onplayerconnect...


Re : Textdraw for a player - gagnier91 - 09.12.2011

How do i create it in ongamemodeinit? because i used to create them like this :
Код:
TextDrawsd[playerid] = TextDrawCreate(549.0,310.0," ");
but there is no playerid in ongamemodeinit


Re: Textdraw for a player - Dragony92 - 09.12.2011

OnGameModeInt
TextDrawsd = TextDrawCreate(549.0,310.0," ");
OnPlayerConnect
TextDrawShowForPlayer(playerid,TextDrawsd);


Re : Textdraw for a player - gagnier91 - 09.12.2011

i get this error on the line for the ongamemodeinit :

error 033: array must be indexed (variable "TextDrawsd")

why?


Re: Textdraw for a player - Dragony92 - 09.12.2011

Because you need to change your define for it...
new TextDrawsd[MAX_PLAYERS]; change to new TextDrawsd;


Re : Textdraw for a player - gagnier91 - 09.12.2011

oh ok, thank you


Re : Textdraw for a player - gagnier91 - 09.12.2011

so it can be different for each player now? thats what i was trying to do