Player textdraw only works for id 0? -
thimo - 03.12.2014
Hello i have a problem, i have a textdraw that should be created for each player but it is only showing up for id 0 and not above. i have this:
pawn Код:
Clock[playerid] = CreatePlayerTextDraw(playerid, 550, 22, " ");
PlayerTextDrawFont(playerid, Clock[playerid], 2);
PlayerTextDrawColor(playerid, Clock[playerid], 16777215);
PlayerTextDrawSetOutline(playerid, Clock[playerid], 1);
PlayerTextDrawSetShadow(playerid, Clock[playerid], 0);
PlayerTextDrawSetProportional(playerid, Clock[playerid], true);
PlayerTextDrawLetterSize(playerid, Clock[playerid], 0.45, 2.0);
But it only works for id 0, anyone an idea why?
Re: Player textdraw only works for id 0? -
UltraScripter - 03.12.2014
is the new?
and show ur TextDrawShowForPlayer
Re: Player textdraw only works for id 0? -
Vince - 03.12.2014
Quote:
Originally Posted by thimo
i have this:
|
Where? I hope you didn't do something stupid like "new playerid".
Re: Player textdraw only works for id 0? -
thimo - 03.12.2014
I have new Clock[MAX_PLAYERS];
And this under onspawn:
public OnPlayerSpawn(playerid)
{
PlayerTextDrawShow(playerid, Clock[playerid]);
Re: Player textdraw only works for id 0? -
BroZeus - 03.12.2014
Well i am not sure if this is the cause but it should be like this -
Quote:
new PlayerText:Clock[MAX_PLAYERS];
|
Make sure the code for making textdraw is under OnPlayerConnect.
Re: Player textdraw only works for id 0? -
thimo - 03.12.2014
Okay:
pawn Код:
public OnPlayerConnect(playerid)
{
Clock[playerid] = CreatePlayerTextDraw(playerid, 550, 22, " ");
PlayerTextDrawFont(playerid, Clock[playerid], 2);
PlayerTextDrawColor(playerid, Clock[playerid], 16777215);
PlayerTextDrawSetOutline(playerid, Clock[playerid], 1);
PlayerTextDrawSetShadow(playerid, Clock[playerid], 0);
PlayerTextDrawSetProportional(playerid, Clock[playerid], true);
PlayerTextDrawLetterSize(playerid, Clock[playerid], 0.45, 2.0);
return 1;
}
Thats is onconnect, this is the new:
pawn Код:
new PlayerText: Clock[MAX_PLAYERS];
OnPlayerSpawn:
pawn Код:
PlayerTextDrawShow(playerid, Clock[playerid]);
But the thing only works for ID 0
Re: Player textdraw only works for id 0? -
Jay_ - 03.12.2014
With the code you've provided, the textdraw string is empty. That code wouldn't even show anything for ID 0. Are you setting the string anywhere?
Re: Player textdraw only works for id 0? -
thimo - 03.12.2014
This is where im setting the string
pawn Код:
public GlobalTimer(playerid)
{
Minutes++;
// Checks for clock 'defining' minutes limit as 60 and hours limit as 24
if(Minutes >= 60)
{
Minutes = 00;
Hours++;
}
if(Hours >= 24)
{
Hours = 00;
}
new clocktime[20];
format(clocktime, sizeof(clocktime), "~w~%02d:%02d", Hours, Minutes);
PlayerTextDrawSetString(playerid, Clock[playerid], clocktime);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetPlayerTime(i, Hours, Minutes);
}
}
But the weird thing is it only works for ID 0
Re: Player textdraw only works for id 0? -
Jay_ - 03.12.2014
This suggests that GlobalTimer is only being called for player id 0 therefore.
Re: Player textdraw only works for id 0? -
thimo - 04.12.2014
Thank you very much Jay_ i got it running!