Player textdraw only works for id 0?
#1

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?
Reply
#2

is the new?
pawn Код:
new Clock[MAX_PLAYERS];


and show ur TextDrawShowForPlayer
Reply
#3

Quote:
Originally Posted by thimo
Посмотреть сообщение
i have this:
Where? I hope you didn't do something stupid like "new playerid".
Reply
#4

I have new Clock[MAX_PLAYERS];
And this under onspawn:
public OnPlayerSpawn(playerid)
{
PlayerTextDrawShow(playerid, Clock[playerid]);
Reply
#5

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.
Reply
#6

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
Reply
#7

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?
Reply
#8

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
Reply
#9

This suggests that GlobalTimer is only being called for player id 0 therefore.
Reply
#10

Thank you very much Jay_ i got it running!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)