/admins dialog Total online admins do help:(
#1


http://i54.tinypic.com/5yx2jk.png
Reply
#2

This is from my script...
pawn Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PInfo[i][Level] >= 1)
            {
                if(PInfo[i][Level] == 1) AdminPos=""cwhite"VIP";
                else if(PInfo[i][Level] == 2) AdminPos=""cyellow"Moderator";
                else if(PInfo[i][Level] == 3) AdminPos=""cyellow"Administrator";
                else if(PInfo[i][Level] == 4) AdminPos=""cgreen"Head Administrator";
                else if(PInfo[i][Level] == 5) AdminPos=""cred"Owner";
                format(string,sizeof(string),"%s"cgreen2"%s(ID:%d) "cyellow2"- "cblue"%s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,""cwhite"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",""cred"No Admins Online!","OK","");
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
This is from my script...
pawn Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PInfo[i][Level] >= 1)
            {
                if(PInfo[i][Level] == 1) AdminPos=""cwhite"VIP";
                else if(PInfo[i][Level] == 2) AdminPos=""cyellow"Moderator";
                else if(PInfo[i][Level] == 3) AdminPos=""cyellow"Administrator";
                else if(PInfo[i][Level] == 4) AdminPos=""cgreen"Head Administrator";
                else if(PInfo[i][Level] == 5) AdminPos=""cred"Owner";
                format(string,sizeof(string),"%s"cgreen2"%s(ID:%d) "cyellow2"- "cblue"%s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,""cwhite"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",""cred"No Admins Online!","OK","");
        }
    }
    return 1;
}
Thanks

Error

______________
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 017: undefined symbol "PInfo"
C:\Users\Yasin\Desktopmode\filterscripts\dLadmin.p wn(1837) : warning 215: expression has no effect
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 001: expected token: ";", but found "]"
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 029: invalid expression, assumed zero
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
_________________
Reply
#4

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
This is from my script...
pawn Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PInfo[i][Level] >= 1)
            {
                if(PInfo[i][Level] == 1) AdminPos=""cwhite"VIP";
                else if(PInfo[i][Level] == 2) AdminPos=""cyellow"Moderator";
                else if(PInfo[i][Level] == 3) AdminPos=""cyellow"Administrator";
                else if(PInfo[i][Level] == 4) AdminPos=""cgreen"Head Administrator";
                else if(PInfo[i][Level] == 5) AdminPos=""cred"Owner";
                format(string,sizeof(string),"%s"cgreen2"%s(ID:%d) "cyellow2"- "cblue"%s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,""cwhite"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",""cred"No Admins Online!","OK","");
        }
    }
    return 1;
}
Good code.
Reply
#5

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
This is from my script...
pawn Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PInfo[i][Level] >= 1)
            {
                if(PInfo[i][Level] == 1) AdminPos=""cwhite"VIP";
                else if(PInfo[i][Level] == 2) AdminPos=""cyellow"Moderator";
                else if(PInfo[i][Level] == 3) AdminPos=""cyellow"Administrator";
                else if(PInfo[i][Level] == 4) AdminPos=""cgreen"Head Administrator";
                else if(PInfo[i][Level] == 5) AdminPos=""cred"Owner";
                format(string,sizeof(string),"%s"cgreen2"%s(ID:%d) "cyellow2"- "cblue"%s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,""cwhite"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",""cred"No Admins Online!","OK","");
        }
    }
    return 1;
}
You can better use foreach and delete IsPlayerConnected (you don't need that anymore since 0.3 and foreach is much faster, and loops only through connected players instead of the 500 slots that may not be filled). Also use a switch statement, it's much more clearer (I don't think it would affect the speed though, but its good practice).
Reply
#6

Quote:
Originally Posted by y@sin1
Посмотреть сообщение
Error

______________
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 017: undefined symbol "PInfo"
C:\Users\Yasin\Desktopmode\filterscripts\dLadmin.p wn(1837) : warning 215: expression has no effect
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 001: expected token: ";", but found "]"
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 029: invalid expression, assumed zero
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
_________________
Of course - you will have to replace everything with your variables;


Quote:
Originally Posted by playbox12
Посмотреть сообщение
You can better use foreach and delete IsPlayerConnected (you don't need that anymore since 0.3 and foreach is much faster, and loops only through connected players instead of the 500 slots that may not be filled). Also use a switch statement, it's much more clearer (I don't think it would affect the speed though, but its good practice).
Indeed. Thanks for pointing that out.
Reply
#7

Quote:
Originally Posted by y@sin1
Посмотреть сообщение
Error

______________
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 017: undefined symbol "PInfo"
C:\Users\Yasin\Desktopmode\filterscripts\dLadmin.p wn(1837) : warning 215: expression has no effect
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 001: expected token: ";", but found "]"
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : error 029: invalid expression, assumed zero
C:\Users\Yasin\Desktop\mode\filterscripts\dLadmin. pwn(1837) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
_________________
Dude, you need to replace it with your own variables. Do you even have a register and login aka saving system? If you don't know how to fix this I doubt you don't have one.
Reply
#8

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
Dude, you need to replace it with your own variables. Do you even have a register and login aka saving system? If you don't know how to fix this I doubt you don't have one.
original
Код HTML:
dcmd_admins(playerid, params[])
{
#pragma unused params
new string[2048];
new sendername[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
{
GetPlayerName(i , sendername, sizeof(sendername));
format(string, sizeof(string),"%s[Level %d]: %s [ID:%i]\n", string,PlayerInfo[i][Level], sendername,i);
}
}
}
ShowPlayerDialog(playerid,5,DIALOG_STYLE_MSGBOX,".::Online Admins::.",string,"Okey","Cancel");
}
return 1;
}
Reply
#9

Quote:
Originally Posted by y@sin1
Посмотреть сообщение
original
pawn Код:
dcmd_admins(playerid, params[])
{
#pragma unused params
new string[2048];
new sendername[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
{
GetPlayerName(i , sendername, sizeof(sendername));
format(string, sizeof(string),"%s[Level %d]: %s [ID:%i]\n", string,PlayerInfo[i][Level], sendername,i);
}
}
}
ShowPlayerDialog(playerid,5,DIALOG_STYLE_MSGBOX,".::Online Admins::.",string,"Okey","Cancel");
}
return 1;
}
WOW Look at the size of that string.

Reply
#10

Bugger me i nearly had an heart attack.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)