SA-MP Forums Archive
/admins dialog Total online admins do help:( - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /admins dialog Total online admins do help:( (/showthread.php?tid=283927)



/admins dialog Total online admins do help:( - y@sin1 - 17.09.2011


http://i54.tinypic.com/5yx2jk.png


Re: /admins dialog Total online admins do help:( - [MWR]Blood - 17.09.2011

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;
}



[MWR]Blood - y@sin1 - 17.09.2011

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.
_________________


Re: /admins dialog Total online admins do help:( - Davz*|*Criss - 17.09.2011

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.


Re: /admins dialog Total online admins do help:( - playbox12 - 17.09.2011

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).


Re: /admins dialog Total online admins do help:( - [MWR]Blood - 17.09.2011

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.


Re: /admins dialog Total online admins do help:( - Kingunit - 17.09.2011

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.


Re: /admins dialog Total online admins do help:( - y@sin1 - 17.09.2011

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;
}



Re: /admins dialog Total online admins do help:( - Tee - 17.09.2011

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.




Re: /admins dialog Total online admins do help:( - bob_dillan - 17.09.2011

Bugger me i nearly had an heart attack.