SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 17/02/2013, 10:37 PM   #1
RieTzz
Little Clucker
 
RieTzz's Avatar
 
Join Date: May 2008
Location: Schweden/Sweden
Posts: 38
Reputation: 0
Default Admin help

Im creating an /Admins command, with an Dialog, but when theres no admins online, the dialog isn't showing up, how do I fix that, like showing the player "Online Admins: None"
pawn Code:
CMD:admins(playerid)
{
        new adminso[128];
        for(new i=0; i<5; i++)
        if(pInfo[i][AdminLevel] >= 1 && pInfo[i][AdminLevel] <= 1337)
        format(adminso,sizeof(adminso)," %s with Level: %d",pName(playerid),pInfo[playerid][AdminLevel]);
        ShowPlayerDialog(playerid,adminsonline,DIALOG_STYLE_MSGBOX, "Online Admins",adminso, "Close","");
        return 1;
        {
        else
        }
        new noadm[128];
        for(new i=0; i<5; i++)
        if(pInfo[i][AdminLevel] >= 1)
        format(noadm,sizeof(noadm), "None.");
        ShowPlayerDialog(playerid,noadmins,DIALOG_STYLE_MSGBOX,"Online Admins:",noadm,"Close","");
        return 1;
}

ERRORS
pawn Code:
G:\Server info\Mein - Kopia\gamemodes\gys.pwn(933) : warning 225: unreachable code
G:\Server info\Mein - Kopia\gamemodes\gys.pwn(934) : error 029: invalid expression, assumed zero
RieTzz is offline   Reply With Quote
Old 17/02/2013, 11:39 PM   #2
Roach_
Huge Clucker
 
Roach_'s Avatar
 
Join Date: Sep 2012
Posts: 281
Reputation: 35
Default Re: Admin help

Try this:
pawn Code:
CMD:admins(playerid)
{
    new adminso[128];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(pInfo[i][AdminLevel] >= 1 && pInfo[i][AdminLevel] <= 1337)
        {
            format(adminso, sizeof adminso," %s with Level: %d\n", pName(i), pInfo[i][AdminLevel]);
            ShowPlayerDialog(playerid, adminsonline, DIALOG_STYLE_MSGBOX, "Online Admins", adminso, "Close", "");
        }
        else
        {
            format(adminso, sizeof adminso, "None.");
            ShowPlayerDialog(playerid, noadmins, DIALOG_STYLE_MSGBOX, "Online Admins:", adminso, "Close", "");
        }
    }
    return 1;
}
Roach_ is offline   Reply With Quote
Old 18/02/2013, 12:05 AM   #3
CoaPsyFactor
Gangsta
 
Join Date: Jul 2010
Location: Belgrade, Serbia
Posts: 867
Reputation: 52
Default Re: Admin help

This is bad, you will show dialog on every admin in game.

Here is something I think its better.

pawn Code:
CMD:admins(playerid)
{
    new adminso[128], adminson = 0;
    for(new i = 0; i < MAX_PLAYERS; i++){
        if(pInfo[i][AdminLevel] >= 1 && pInfo[i][AdminLevel] <= 1337){
            adminson++;
            format(adminso, sizeof(adminso)," %s%s with Level: %d\n", adminso, pName(i), pInfo[i][AdminLevel]);
    }
    if(!adminson) return ShowPlayerDialog(playerid, noadmins, DIALOG_STYLE_MSGBOX, "Online Admins:", "None.", "Close", "");
    ShowPlayerDialog(playerid, adminsonline, DIALOG_STYLE_MSGBOX, "Online Admins:", adminso, "Close", "");
    return 1;
}
__________________
Quote:
Originally Posted by ThaiLuan View Post
Code:
C:\Users\Administrator\Downloads\Viet-RP\gamemodes\3mien.pwn(112016) : fatal error 101: cannot write to file: "disk full"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Help me! How to fix error
CoaPsyFactor is offline   Reply With Quote
Old 18/02/2013, 08:05 AM   #4
RieTzz
Little Clucker
 
RieTzz's Avatar
 
Join Date: May 2008
Location: Schweden/Sweden
Posts: 38
Reputation: 0
Default Re: Admin help

Now does it show, even if I'm admin, that there's no admin online?
RieTzz is offline   Reply With Quote
Old 18/02/2013, 11:25 AM   #5
]Rafaellos[
Gangsta
 
Join Date: Feb 2012
Location: Cyprus
Posts: 731
Reputation: 48
Default Re: Admin help

This maybe?

pawn Code:
CMD:admins(playerid)
{
    new string[128], count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(pInfo[i][AdminLevel] >= 1 && pInfo[i][AdminLevel] <= 1337)
        {
            format(string,sizeof(string),"%s %s with Level: %d\r\n", string, pName(playerid), pInfo[playerid][AdminLevel]);
            count++;
        {
        ShowPlayerDialog(playerid,adminsonline,DIALOG_STYLE_MSGBOX,"Online Admins:",string,"Close","");
    }
    if(count == 0)
    {
        ShowPlayerDialog(playerid,noadmins,DIALOG_STYLE_MSGBOX,"Online Admins:","No Admins Online","Close","");
    }
    return 1;
}
__________________
]Rafaellos[ is offline   Reply With Quote
Old 18/02/2013, 11:40 AM   #6
PabloDiCostanzo
Huge Clucker
 
PabloDiCostanzo's Avatar
 
Join Date: Feb 2013
Location: Argentina
Posts: 307
Reputation: 8
Default Re: Admin help

Maybe this can help you.
PabloDiCostanzo is offline   Reply With Quote
Old 19/02/2013, 04:43 PM   #7
RieTzz
Little Clucker
 
RieTzz's Avatar
 
Join Date: May 2008
Location: Schweden/Sweden
Posts: 38
Reputation: 0
Default Re: Admin help

Pablo, what am I going to see there?
And Rafaleos, gives me tons of errors.
RieTzz is offline   Reply With Quote
Old 19/02/2013, 05:09 PM   #8
]Rafaellos[
Gangsta
 
Join Date: Feb 2012
Location: Cyprus
Posts: 731
Reputation: 48
Default Re: Admin help

Show me that errors.
__________________
]Rafaellos[ is offline   Reply With Quote
Old 19/02/2013, 10:54 PM   #9
RieTzz
Little Clucker
 
RieTzz's Avatar
 
Join Date: May 2008
Location: Schweden/Sweden
Posts: 38
Reputation: 0
Default Re: Admin help

all the 26errors that are almost appearing when the coding is failed.
RieTzz is offline   Reply With Quote
Old 20/02/2013, 01:23 AM   #10
Nuke547
Big Clucker
 
Join Date: Dec 2011
Posts: 172
Reputation: 16
Default Re: Admin help

Try this:
pawn Code:
CMD:admins(playerid)
{
    new string[128], count, admins[126];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(pInfo[i][AdminLevel] >= 1 && pInfo[i][AdminLevel] <= 1337)
        {
            format(string, sizeof string," %s with Level: %d\n", pName(i), pInfo[i][AdminLevel]);
            strcat(admins, string, sizeof(admins));
            count++;
        }
        else
        {
            format(string, sizeof(string), "None.");
        }
    }
    if(count >= 1)
    {
        ShowPlayerDialog(playerid, adminsonline, DIALOG_STYLE_MSGBOX, "Online Admins", string, "Close", "");
    }
    else
    {
        ShowPlayerDialog(playerid, noadmins, DIALOG_STYLE_MSGBOX, "Online Admins:", string, "Close", "");
    }
    return 1;
}
Nuke547 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
[FilterScript] mzAdmin - Admin/Donor System | 20+ Admin Commands [v1] mobiliz Filterscripts 11 28/05/2014 09:39 AM
[FilterScript] Admin House v2. Simple Admin Place :) 2nd Script nateykurgan Filterscripts 7 24/04/2013 02:02 PM
how to make my admin system save the admin score Zonoya Scripting Help 10 24/09/2012 09:20 PM
V-ADMIN LOGIN HELP: NO REPLY IN V-ADMIN TOPIC: PLEASE HELP RE-OPEN MY SERVER!!!! wilcock33 Help Archive 1 19/08/2009 02:19 PM


All times are GMT. The time now is 01:05 PM.


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