SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 23/08/2011, 04:57 PM   #1
Hoss
Huge Clucker
 
Join Date: Sep 2010
Posts: 200
Reputation: 85
Default Please help

Hello
I want to make /admins with dialogs
But i got some problems,with doing it
This is original /admins cmd wiht no dialogs
Code:
dcmd_admins(playerid,params[])
{
	#pragma unused params
	new string[128],amt;
	string = "Admins: ";
	if(IsPlayerAdmin(playerid) || Variables[playerid][Level] > 12)
	{
		foreach(Player,i)
  		{
    	 	if(Variables[i][Level] < 12 && Variables[i][Level] > 0)
    	 	{
    	 	    format(string,128,"%s  %s(%d)",string,RealName[i],Variables[i][Level]);
    	 	    amt++;
			}
   		}
	}
	else
	{
	    foreach(Player,i)
  		{
    	 	if(Variables[i][Level] < 12 && Variables[i][Level] > 0)
    	 	{
    	 	    format(string,128,"%s  %s",string,RealName[i]);
    	 	    amt++;
			}
   		}
	}
   	if(amt > 0)return SendClientMessage(playerid,MAIN_COLOR_2,string);
   	else return SendClientMessage(playerid,MAIN_COLOR_2,"No admins online.");
}

and i tried to make it with dialogs,but when i am typing /admins IG i am gettin only 1 admin line
Code:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new string[256];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(Variables[i][Level] >0 && Variables[i][Level] < 10)
        {
			format(string, sizeof(string), "{FF0000}ADMINISTRATOR: %s ID[%d]{15D4ED}[Level %d]\n", RealName[i],playerid, Variables[i][Level]);
			ShowPlayerDialog(playerid, 5591, 0, "{1B1BE0}Online Admins:", string, "Done", "");
        }
    }
    return 1;
}
Please help me

Last edited by Hoss; 24/08/2011 at 09:46 AM.
Hoss is offline  
Old 23/08/2011, 05:08 PM   #2
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,574
Reputation: 63
Default Re: Dialog Problem

Code:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new string[400], admins;
    for(new i = 0; i < MAX_PLAYERS; i++) if(Variables[i][Level] >0 && Variables[i][Level] < 10) admins++;
    if(admins > 0)
    {
	    for(new i = 0; i < MAX_PLAYERS; i++)
	    {
	        if(Variables[i][Level] >0 && Variables[i][Level] < 10)
	        {
	            format(string, sizeof(string), "%s{FF0000}ADMINISTRATOR: %s ID[%d]{15D4ED}[Level %d]\n",string, RealName[i],playerid, Variables[i][Level]);
	            ShowPlayerDialog(playerid, 5591, 0, "{1B1BE0}Online Admins:", string, "Done", "");
	        }
	    }
	}
	else ShowPlayerDialog(playerid, 5591, 0, "{1B1BE0}Online Admins:", "There are no Administrators online.", "Done", "");
    return 1;
}

Should work then.

Jeffry
__________________

Last edited by Jeffry; 23/08/2011 at 05:15 PM. Reason: Adding the 'No admins...'
Jeffry is offline  
Old 23/08/2011, 06:06 PM   #3
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 4,880
Reputation: 2179
Default Re: Dialog Problem

This might work: http://pastebin.com/vR8D1868
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline  
Old 23/08/2011, 06:12 PM   #4
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,574
Reputation: 63
Default Re: Dialog Problem

Oh, good one Hiddos, didn't think of that way.
__________________
Jeffry is offline  
Old 23/08/2011, 07:35 PM   #5
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 3,753
Reputation: 619
Default AW: Dialog Problem

If I am not mistaken, than Hiddos code would always show "No admins online!" and the online admins if there are some

Code:
dcmd_admins(playerid, unused[]) {
    #pragma unused unused
    new
        i = 0,
        string[400];
    for( ; i != MAX_PLAYERS; ++i) { // foreach ?
        if(0 < Variables[i][Level] < 10) {
            format(string, sizeof string, "%s{FF0000}ADMINISTRATOR: %s ID[%d]{15D4ED}[Level %d]\n", string, RealName[i], i, Variables[i][Level]);
        }
    }
    if(string[0] == EOS) {
        string = "No admins online.";
    }
    ShowPlayerDialog(playerid, 5591, DIALOG_STYLE_MSGBOX, "{1B1BE0}Online Admins:", string, "Done", "");
    return true;
}
__________________
Nero_3D is online now  
Old 23/08/2011, 07:57 PM   #6
PrawkC
Gangsta
 
Join Date: May 2011
Posts: 501
Reputation: 52
Default Re: Dialog Problem

Code:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new string[256], result[256];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(Variables[i][Level] >0 && Variables[i][Level] < 10)
        {
            format(string, sizeof(string), "{FF0000}ADMINISTRATOR: %s ID[%d]{15D4ED}[Level %d]\n", RealName[i],playerid, Variables[i][Level]);
			strcat(result, string, sizeof(result));       
        }
    }
	ShowPlayerDialog(playerid, 5591, 0, "{1B1BE0}Online Admins:", result, "Done", "");	
    return 1;
}

Pretty sure this will work.
__________________
Doin' stuff.
PrawkC is offline  
Old 24/08/2011, 09:15 AM   #7
Hoss
Huge Clucker
 
Join Date: Sep 2010
Posts: 200
Reputation: 85
Default Re: Dialog Problem

Quote:
Originally Posted by PrawkC View Post
Code:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new string[256], result[256];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(Variables[i][Level] >0 && Variables[i][Level] < 10)
        {
            format(string, sizeof(string), "{FF0000}ADMINISTRATOR: %s ID[%d]{15D4ED}[Level %d]\n", RealName[i],playerid, Variables[i][Level]);
			strcat(result, string, sizeof(result));       
        }
    }
	ShowPlayerDialog(playerid, 5591, 0, "{1B1BE0}Online Admins:", result, "Done", "");	
    return 1;
}

Pretty sure this will work.
Thanks
but can anyone help me to make 2 admin lines,cuz when here are 2+ admins in admin list is only 1 admin
Help me please
Hoss is offline  
Old 24/08/2011, 10:34 AM   #8
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 3,753
Reputation: 619
Default AW: Re: Dialog Problem

Quote:
Originally Posted by [MD]Gangster View Post
Thanks
but can anyone help me to make 2 admin lines,cuz when here are 2+ admins in admin list is only 1 admin
Help me please
He used result instead of string in ShowPlayerDialog, just change it by yourself

Also did you tried Jeffry's, Hiddos's or mine ?
__________________
Nero_3D is online now  
Old 24/08/2011, 10:39 AM   #9
Intoxicated
Big Clucker
 
Join Date: Nov 2010
Posts: 63
Reputation: 7
Default Re: Dialog Problem

EDIT: Oops.. wrong topic
Intoxicated is offline  
Old 24/08/2011, 11:00 AM   #10
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,290
Reputation: 739
Default Re: Dialog Problem

Untested:

Code:
dcmd_admins(playerid,params[])
{
    #pragma unused params
    new string[MAX_PLAYER_NAME+8*15], stringb[MAX_PLAYER_NAME+8], amt;
    
    if(IsPlayerAdmin(playerid) || Variables[playerid][Level] > 12)
    {
        foreach(Player, i)
        {
            if(Variables[i][Level] < 12 && Variables[i][Level] > 0)
            {
                format(stringb, sizeof stringb,"%s(%d)", RealName[i], Variables[i][Level] );
                strcat(string, stringb, sizeof string);
                amt++;
            }
        }
    }
    else
    {
        foreach(Player,i)
        {
            if(Variables[i][Level] < 12 && Variables[i][Level] > 0)
            {
                format(stringb,sizeof stringb,"%s", RealName[i] );
                strcat(string, stringb, sizeof string);
                amt++;
            }
        }
    }
    if(amt == 0) return SendClientMessage( playerid, MAIN_COLOR_2, "No admins are online.");
    else return ShowPlayerDialog(playerid, 4557, DIALOG_STYLE_LIST, "Current Online Admins:", string, "OK", "Close");
}
__________________
Goodbye SA-MP.
iPLEOMAX is offline  
 

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
[HELP] Dialog Problem Fredden1993 Help Archive 15 31/08/2010 03:56 PM
Dialog problem [XST]O_x Help Archive 11 06/06/2010 02:43 PM
dialog problem billiout Help Archive 17 19/05/2010 10:14 AM
On Dialog : Problem.. g@k Help Archive 0 02/04/2010 04:58 PM
Dialog problem Matej682 Help Archive 18 28/02/2010 03:30 PM


All times are GMT. The time now is 04:30 PM.


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