How to store names and put them into a Textdraw
#1

Hey Guys!

I wanna make a /onlineadmins command which loops through the players, checks if a player is admin, and puts it into a string, and the string into a textdraw.

Could anyone help me how to do it?

Nonameman
Reply
#2

Why would you want it to loop threw all players? and check them all thats just plain stupid if somebody spammed that command your server will lag shitless.

Just make a simple command where if somebody is example pAdmin auto puts them into the list, Checking all players is just nuts..
Reply
#3

Quote:
Originally Posted by Mr187
Посмотреть сообщение
Why would you want it to loop threw all players? and check them all thats just plain stupid if somebody spammed that command your server will lag shitless.

Just make a simple command where if somebody is example pAdmin auto puts them into the list, Checking all players is just nuts..
You are right, and it's easier to make, but I want to learn how can I make something like I wrote.
And I have an anti spam function, so nobody can spam this
Reply
#4

Here we go. This is what I use.

pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_WHITE, "__________Admins Online__________");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                new count;
                if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 1338)
                {
                    GetPlayerName(i, sendername, sizeof(sendername));
                    format(string, 256, "(%d)%s, Admin Level: %d", i, sendername, PlayerInfo[i][pAdmin]);
                    SendClientMessage(playerid, COLOR_GREY, string);
                    count++;
                }
                if(count==0)
                {
                    SendClientMessage(playerid,COLOR_WHITE,"No admins online at the moment, sorry!");
                }
            }
        }
    }
    return 1;
}
PS: My script is made from scratch and inspired by GF systems, it's why I use e.g. PlayerInfo and pAdmin and stuff (Just for people that thought they can judge me that it's a GF copy, which it's not)
Reply
#5

Thanks.
Reply
#6

Ah btw, this doesnt store it into some kind of textdraw, you've to do it your self :P

But it prints in chat
Reply
#7

just make a textdraw and use "TextDrawSetString" The End..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)