I TYPE A COMMAND AND NOTHING HAPPENS! *REP+*
#1

Hey guys, i need help. I made myself an /admins command, which is supposed to show online admins and when there is no admin, it is supposed to show an dialog with no admins online, there is a code:

Код:
CMD:admins(playerid, params[])
{
	new string[128];
	new str[128];
	new Admin[50];
	if(PlayerInfo[playerid][pAdmin] == 2) Admin = "Moderбtor";
	if(PlayerInfo[playerid][pAdmin] == 3) Admin = "Administrбtor";
	if(PlayerInfo[playerid][pAdmin] == 4) Admin = "Vedъci Administrбtor";
	if(PlayerInfo[playerid][pAdmin] == 5) Admin = "Hlavnэ Administrбtor";
	for(new i = 0; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
		{
			format(str, sizeof(str), "%s (%d) {FF0000}%s", GetName(i), i, Admin);
			strcat(string, str);
			ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_LIST, "Administrбtori", string, "Vybrať", "Zavrieť");
		}
		if(!IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
		{
			ShowPlayerDialog(playerid, DIALOG_NOADMINS, DIALOG_STYLE_MSGBOX, "Administrбtori", "Na servery nieje prнtomnэ ћiadny administrбtor", "Zavrieť", "");
		}
	}
	return 1;
}
When i write a command, simply nothing happens, even if it would be a wrong command, it should show a note, i am using zcmd, so the command performs, but with no content.

If one of you guys would solve this problem for me, you will earn REP+.
Reply
#2

strcat is useless, you need to remove your condition of for
PHP код:
CMD:admins(playeridparams[])
{
    new 
str[128];
    new 
Admin[50];
        new 
adminsOnline;
    if(
PlayerInfo[playerid][pAdmin] == 2Admin "Moderбtor";
    if(
PlayerInfo[playerid][pAdmin] == 3Admin "Administrбtor";
    if(
PlayerInfo[playerid][pAdmin] == 4Admin "Vedъci Administrбtor";
    if(
PlayerInfo[playerid][pAdmin] == 5Admin "Hlavnэ Administrбtor";
    for(new 
0MAX_PLAYERS++)
    {
        if(
IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
        {
                        
adminsOnline++;
            
format(strsizeof(str), "%s (%d) {FF0000}%s"GetName(i), iAdmin);
            
ShowPlayerDialog(playeridDIALOG_ADMINSDIALOG_STYLE_LIST"Administrбtori"str"Vybrať""Zavrieť");
        }
    }
        if(
adminsOnline == 0ShowPlayerDialog(playeridDIALOG_NOADMINSDIALOG_STYLE_MSGBOX"Administrбtori""Na servery nieje prнtomnэ ћiadny administrбtor""Zavrieť""");
    return 
1;

Reply
#3

Thanks buddy, as i promised REP+.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)