need a little help.
#1

Hello. I got a small problem wich i also had it in past, but in past i knew how to fix it,and now , after 1 year of pause from scripting, i forgot how to fix it. Okay, so here it is. When a player types /players, a list dialog should pop up saying the connected players names. ( names should be like name undes name as it's a list dialog .) but for me it always shows the name of the player with the highest id. So do you guys know how to solve this?
Код:
new name[] = "\n";     for(new i;i<MAX_PLAYERS;i++);            {  if(IsPlayerConnected(i))       {  format(string,sizeof(string),"%s%s",name,PlayerName(i);                        ShowPlayerDialog(playerid,1000,"test",string,"ok"); continue;         }   //and then the loop ends
Reply
#2

Bump..
Reply
#3

Why too you need this command when u can only press TAB ^^
Reply
#4

i have my own reasons..
Reply
#5

pawn Код:
new name[] = "\n";
    for(new i;i<MAX_PLAYERS;i++);
    {
        if(IsPlayerConnected(i))
        {
            format(string,sizeof(string),"%s%s",name,PlayerName(i);
            ShowPlayerDialog(playerid,1000,"test",string,"ok", "");
        }
    }
    return 1;
}
pawn Код:
new name[MAX_PLAYER_NAME];
Getplayername(playerid, name,sizeof(name));
need to go . . i can help u after im back from school , seeya
Reply
#6

That didn't worked..
Reply
#7

pawn Код:
if(strcmp(cmdtext, "/players", true) == 0)
    {
        new plrs[2048];
        plrs = "";
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                new plrname[MAX_PLAYER_NAME];
                GetPlayerName(i, plrname, sizeof(plrname));
                if(i == 0)
                    format(plrs, sizeof(plrs), "%s", plrname);
                else
                    format(plrs, sizeof(plrs), "%s, %s", plrs, plrname);
            }
        }
        ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_MSGBOX, "Players", plrs, "Close", "");
        return 1;
    }
anyway you should modify this a little bit since with a lot of players on the server it will create huge dialog and you won't be able to see it full
Reply
#8

Quote:
Originally Posted by SEnergy
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext, "/players", true) == 0)
    {
        new plrs[2048];
        plrs = "";
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                new plrname[MAX_PLAYER_NAME];
                GetPlayerName(i, plrname, sizeof(plrname));
                if(i == 0)
                    format(plrs, sizeof(plrs), "%s", plrname);
                else
                    format(plrs, sizeof(plrs), "%s, %s", plrs, plrname);
            }
        }
        ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_MSGBOX, "Players", plrs, "Close", "");
        return 1;
    }
anyway you should modify this a little bit since with a lot of players on the server it will create huge dialog and you won't be able to see it full
Thanks for the help but i want it in DIALOG_STYLE_LIST, not DIALOG_STYLE_MSGBOX.
Reply
#9

Quote:
Originally Posted by Iuri
Посмотреть сообщение
Thanks for the help but i want it in DIALOG_STYLE_LIST, not DIALOG_STYLE_MSGBOX.
pawn Код:
if(strcmp(cmdtext, "/test", true) == 0)
    {
        new plrs[2048];
        plrs = "";
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                new plrname[MAX_PLAYER_NAME];
                GetPlayerName(i, plrname, sizeof(plrname));
                format(plrs, sizeof(plrs), "%s\n%s", plrs, plrname);
            }
        }
        ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_LIST, "Players", plrs, "Close", "");
        return 1;
    }
tell me if it works with more players since I have only local server
Reply
#10

EDIT: Nevermind, i found it and managed to fix it. Thanks for the help, i rep'd. you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)