SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/09/2011, 12:20 PM   #1
y@sin1
Big Clucker
 
Join Date: Dec 2010
Posts: 66
Reputation: 0
Default /admins dialog Total online admins do help:(


http://i54.tinypic.com/5yx2jk.png
__________________
Sorry for my bad english
y@sin1 is offline   Reply With Quote
Old 17/09/2011, 12:36 PM   #2
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,272
Reputation: 105
Default Re: /admins dialog Total online admins do help:(

This is from my script...
pawn Code:
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 is offline   Reply With Quote
Old 17/09/2011, 01:03 PM   #3
y@sin1
Big Clucker
 
Join Date: Dec 2010
Posts: 66
Reputation: 0
Default

Quote:
Originally Posted by [MWR]Blood View Post
This is from my script...
pawn Code:
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 (c) 1997-2006, ITB CompuPhase


4 Errors.
_________________
__________________
Sorry for my bad english

Last edited by JaTochNietDan; 17/09/2011 at 05:23 PM. Reason: Stop double posting, use the edit button.
y@sin1 is offline   Reply With Quote
Old 17/09/2011, 01:14 PM   #4
Davz*|*Criss
Gangsta
 
Davz*|*Criss's Avatar
 
Join Date: Jan 2011
Posts: 778
Reputation: 15
Default Re: /admins dialog Total online admins do help:(

Quote:
Originally Posted by [MWR]Blood View Post
This is from my script...
pawn Code:
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.
__________________
Join Extreme Missions Now: 176.31.192.96:7778!
Davz*|*Criss is offline   Reply With Quote
Old 17/09/2011, 01:21 PM   #5
playbox12
High-roller
 
playbox12's Avatar
 
Join Date: Feb 2010
Location: Netherlands
Posts: 1,318
Reputation: 216
Default Re: /admins dialog Total online admins do help:(

Quote:
Originally Posted by [MWR]Blood View Post
This is from my script...
pawn Code:
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).
playbox12 is offline   Reply With Quote
Old 17/09/2011, 01:25 PM   #6
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,272
Reputation: 105
Default Re: /admins dialog Total online admins do help:(

Quote:
Originally Posted by y@sin1 View Post
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 (c) 1997-2006, ITB CompuPhase


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


Quote:
Originally Posted by playbox12 View Post
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.
__________________
[MWR]Blood is offline   Reply With Quote
Old 17/09/2011, 01:48 PM   #7
Kingunit
High-roller
 
Kingunit's Avatar
 
Join Date: Dec 2010
Location: The Netherlands
Posts: 1,426
Reputation: 120
Default Re: /admins dialog Total online admins do help:(

Quote:
Originally Posted by y@sin1 View Post
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 (c) 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.
__________________
Kingunit is offline   Reply With Quote
Old 17/09/2011, 01:55 PM   #8
y@sin1
Big Clucker
 
Join Date: Dec 2010
Posts: 66
Reputation: 0
Default Re: /admins dialog Total online admins do help:(

Quote:
Originally Posted by Kingunit View Post
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 Code:
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;
}
__________________
Sorry for my bad english
y@sin1 is offline   Reply With Quote
Old 17/09/2011, 03:41 PM   #9
Tee
Gangsta
 
Join Date: Sep 2010
Posts: 836
Reputation: 81
Default Re: /admins dialog Total online admins do help:(

Quote:
Originally Posted by y@sin1 View Post
original
pawn Code:
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.

__________________
1.3 inch/360 - pretty high for precision
Tee is offline   Reply With Quote
Old 17/09/2011, 04:11 PM   #10
bob_dillan
Big Clucker
 
Join Date: Apr 2009
Posts: 51
Reputation: 0
Default Re: /admins dialog Total online admins do help:(

Bugger me i nearly had an heart attack.
bob_dillan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Admins online Davz*|*Criss Help Archive 2 10/08/2011 05:51 PM
/admins online. GangsTa_ Help Archive 2 10/06/2011 08:47 AM
[HELP]/admins <Show current admins online by ID, Name, Rank and Duty> Deal-or-die Help Archive 7 01/06/2011 12:00 PM


All times are GMT. The time now is 08:45 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.