Players in event textdraw issue.
#1

Hello everyone,

I am having a bit of trouble of making a small list on the side of everyone who is currently in the event they are playing. When the event starts, a timer is set off that then uses a function to give an updated textdraw of whoever is in the event. However, it shows up, but only the last player who entered.
Example: Player1 enters or starts it first, his name would be on the list first, then player2 enters and his name would remove player1 off the list. I don't know why this is happening.

Here is my function code that is activated after the timer. The timer is repeating until the derby ends.

pawn Код:
function players()
{
    new pname[24], pname2[24], szTemp[55], szStr[55 char], string1[1024 char];
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(playerinderby[i] == 1)
                {
                    GetPlayerName(i, pname, sizeof(pname));
                    format(szTemp, sizeof(szTemp), "%s~n~",pname);
                    strpack(szStr,szTemp);
                    strcat(string1,szStr);
                    TextDrawSetString(RaceInfo[i], string1);
                    TextDrawShowForPlayer(i, RaceInfo[i]);
         }
        }
    }
    return 1;
}
Any help is always appreciated.
Reply
#2

involve the string into the format you've done

Код:
"%s~n~%s,pname,szTemp
sorry ive wroten this on phone
Reply
#3

Quote:
Originally Posted by LazzyBoy
Посмотреть сообщение
involve the string into the format you've done

Код:
"%s~n~%s,pname,szTemp
sorry ive wroten this on phone
It's alright, thank you for your attempt, sadly, it still did not work.
Reply
#4

Код:
function players()
{
    new pname[24], szTemp[55];
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue;
            if(playerinderby[i] != 1) continue;
            {
                GetPlayerName(i, pname, sizeof(pname));
				format(szTemp, sizeof(szTemp), "%s~n~%s",pname,szTemp);
				TextDrawSetString(RaceInfo[i], szTemp);
				TextDrawShowForPlayer(i, RaceInfo[i]);
		    }
	    }
	}
	return 1;
}
Test this but it still doesnt work change the playerinderby != 0) continue; and maybe it should work if it still doesnt then i dont really know.
Reply
#5

Quote:
Originally Posted by LazzyBoy
Посмотреть сообщение
Код:
function players()
{
    new pname[24], szTemp[55];
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue;
            if(playerinderby[i] != 1) continue;
            {
                GetPlayerName(i, pname, sizeof(pname));
				format(szTemp, sizeof(szTemp), "%s~n~%s",pname,szTemp);
				TextDrawSetString(RaceInfo[i], szTemp);
				TextDrawShowForPlayer(i, RaceInfo[i]);
		    }
	    }
	}
	return 1;
}
Test this but it still doesnt work change the playerinderby != 0) continue; and maybe it should work if it still doesnt then i dont really know.
Once again. Thank you very much for your attempt, but still it did not work, but that is alright. Thanks for your input once again, it means alot.
Reply
#6

You don't need a timer for this since you know when a player leaves/joins.
Reply
#7

Quote:
Originally Posted by Pottus
Посмотреть сообщение
You don't need a timer for this since you know when a player leaves/joins.
So, I should loop it around say whenever a person dies and they get kicked out or disconnect?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)