PDA

View Full Version : Textdraw for a player


gagnier91
09/12/2011, 12:31 AM
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

Dragony92
09/12/2011, 12:42 AM
Create texdraw in ongamemodeinit and show it in onplayerconnect...

gagnier91
09/12/2011, 01:00 AM
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

Dragony92
09/12/2011, 01:04 AM
OnGameModeInt
TextDrawsd = TextDrawCreate(549.0,310.0," ");
OnPlayerConnect
TextDrawShowForPlayer(playerid,TextDrawsd);

gagnier91
09/12/2011, 01:13 AM
i get this error on the line for the ongamemodeinit :

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

why?

Dragony92
09/12/2011, 01:20 AM
Because you need to change your define for it...
new TextDrawsd[MAX_PLAYERS]; change to new TextDrawsd;

gagnier91
09/12/2011, 01:23 AM
oh ok, thank you

gagnier91
09/12/2011, 02:00 AM
so it can be different for each player now? thats what i was trying to do