Textdraw doesn't appear.
#1

I'v been working on showing using textdraws to show players stats while and admin is spectating them.
When i spectate the player everything works fine but the textdraws don't show. Been kind of puzzled and couldn't get it to work.

Thanks in advance.
Code:
pawn Код:
//======Textdraws=========//
new Text:Spectate0[MAX_PLAYERS];
new Text:Playername1[MAX_PLAYERS];
new Text:Playermoney2[MAX_PLAYERS];
new Text:Playerscore3[MAX_PLAYERS];
new Text:Playerkills4[MAX_PLAYERS];
new Text:Playerdeaths5[MAX_PLAYERS];


//ongamemodeinit
for ( new i; i < MAX_PLAYERS; i ++ )
    {
    Spectate0[i] = TextDrawCreate(534.000000,356.000000," ");
    Playername1[i] = TextDrawCreate(487.000000,371.000000," ");
    Playermoney2[i] = TextDrawCreate(487.000000,387.000000," ");
    Playerscore3[i] = TextDrawCreate(487.000000,401.000000," ");
    Playerkills4[i] = TextDrawCreate(487.000000,416.000000," ");
    Playerdeaths5[i] = TextDrawCreate(487.000000,430.000000," ");
    TextDrawUseBox(Spectate0[i],1);
    TextDrawBoxColor(Spectate0[i],0x00000033);
    TextDrawTextSize(Spectate0[i],629.000000,-107.000000);
    TextDrawUseBox(Playername1[i],1);
    TextDrawBoxColor(Playername1[i],0x00000033);
    TextDrawTextSize(Playername1[i],581.000000,95.000000);
    TextDrawUseBox(Playermoney2[i],1);
    TextDrawBoxColor(Playermoney2[i],0x00000033);
    TextDrawTextSize(Playermoney2[i],581.000000,7.000000);
    TextDrawUseBox(Playerscore3[i],1);
    TextDrawBoxColor(Playerscore3[i],0x00000033);
    TextDrawTextSize(Playerscore3[i],581.000000,-3.000000);
    TextDrawUseBox(Playerkills4[i],1);
    TextDrawBoxColor(Playerkills4[i],0x00000033);
    TextDrawTextSize(Playerkills4[i],581.000000,-33.000000);
    TextDrawUseBox(Playerdeaths5[i],1);
    TextDrawBoxColor(Playerdeaths5[i],0x00000033);
    TextDrawTextSize(Playerdeaths5[i],581.000000,-1.000000);
    TextDrawAlignment(Spectate0[i],2);
    TextDrawAlignment(Playername1[i],1);
    TextDrawAlignment(Playermoney2[i],1);
    TextDrawAlignment(Playerscore3[i],0);
    TextDrawAlignment(Playerkills4[i],0);
    TextDrawAlignment(Playerdeaths5[i],0);
    TextDrawBackgroundColor(Spectate0[i],0x00000066);
    TextDrawBackgroundColor(Playername1[i],0x000000ff);
    TextDrawBackgroundColor(Playermoney2[i],0x000000ff);
    TextDrawBackgroundColor(Playerscore3[i],0x000000ff);
    TextDrawBackgroundColor(Playerkills4[i],0x000000ff);
    TextDrawBackgroundColor(Playerdeaths5[i],0x000000ff);
    TextDrawFont(Spectate0[i],1);
    TextDrawLetterSize(Spectate0[i],0.399999,1.000000);
    TextDrawFont(Playername1[i],1);
    TextDrawLetterSize(Playername1[i],0.399999,1.100000);
    TextDrawFont(Playermoney2[i],1);
    TextDrawLetterSize(Playermoney2[i],0.499999,0.899999);
    TextDrawFont(Playerscore3[i],1);
    TextDrawLetterSize(Playerscore3[i],0.399999,1.000000);
    TextDrawFont(Playerkills4[i],1);
    TextDrawLetterSize(Playerkills4[i],0.499999,0.899999);
    TextDrawFont(Playerdeaths5[i],1);
    TextDrawLetterSize(Playerdeaths5[i],0.399999,1.000000);
    TextDrawColor(Spectate0[i],0xffffffff);
    TextDrawColor(Playername1[i],0xffffffff);
    TextDrawColor(Playermoney2[i],0xffffffff);
    TextDrawColor(Playerscore3[i],0xffffffff);
    TextDrawColor(Playerkills4[i],0xffffffff);
    TextDrawColor(Playerdeaths5[i],0xffffffff);
    TextDrawSetOutline(Spectate0[i],1);
    TextDrawSetOutline(Playername1[i],1);
    TextDrawSetOutline(Playermoney2[i],1);
    TextDrawSetOutline(Playerscore3[i],1);
    TextDrawSetOutline(Playerkills4[i],1);
    TextDrawSetOutline(Playerdeaths5[i],1);
    TextDrawSetProportional(Spectate0[i],1);
    TextDrawSetProportional(Playername1[i],1);
    TextDrawSetProportional(Playermoney2[i],1);
    TextDrawSetProportional(Playerscore3[i],1);
    TextDrawSetProportional(Playerkills4[i],1);
    TextDrawSetProportional(Playerdeaths5[i],1);
    TextDrawSetShadow(Spectate0[i],1);
    TextDrawSetShadow(Playername1[i],1);
    TextDrawSetShadow(Playermoney2[i],1);
    TextDrawSetShadow(Playerscore3[i],1);
    TextDrawSetShadow(Playerkills4[i],1);
    TextDrawSetShadow(Playerdeaths5[i],1);
    }
 //the spectate dialog case when a player uses admin OnPlayerclickPlayer panel
case 7:
            {
                new string[20], gName[25], pName[25];
                new giveplayerid = GetPVarInt(playerid,"ClickedPlayer");
                GetPlayerName(playerid,pName,sizeof pName);
                GetPlayerName(giveplayerid,gName,sizeof gName);

                TogglePlayerSpectating(playerid, 1);
                PlayerSpectatePlayer(playerid, giveplayerid);
                specID[playerid] = giveplayerid;
               
                new string1[100];
                format(string1, sizeof(string1),"%s",giveplayerid);
                TextDrawSetString(Playername1[playerid],string);
                TextDrawShowForPlayer(playerid, Playername1[playerid]);
               

                format(string1, sizeof(string1),"Money: %d",GetPlayerMoney(giveplayerid));
                TextDrawSetString(Playermoney2[playerid],string);
                TextDrawShowForPlayer(playerid, Playermoney2[playerid]);
               

                format(string1, sizeof(string1),"Score: %d",GetPlayerScore(giveplayerid));
                TextDrawSetString(Playerscore3[playerid],string);
                TextDrawShowForPlayer(playerid, Playerscore3[playerid]);

                format(string1, sizeof(string1),"Kills: %d",Kills[giveplayerid]);
                TextDrawSetString(Playerkills4[playerid],string);
                TextDrawShowForPlayer(playerid, Playerkills4[playerid]);

                format(string1, sizeof(string1),"Kills: %d",Deaths[giveplayerid]);
                TextDrawSetString(Playerdeaths5[playerid],string);
                TextDrawShowForPlayer(playerid, Playerdeaths5[playerid]);

                format(string1, sizeof(string1), "Spectating");
                TextDrawSetString(Spectate0[playerid], string);
                TextDrawShowForPlayer(playerid, Spectate0[playerid]);
            }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)