SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/06/2020, 12:39 AM   #1
Chams
Big Clucker
 
Chams's Avatar
 
Join Date: May 2017
Posts: 90
Reputation: 17
Default Command Help

Hello, does anybody know how could I do the command /admins like this one?
Here: https://imgur.com/a/VZJFqqC
Chams is offline   Reply With Quote
Old 29/06/2020, 12:43 AM   #2
IZenta
Banned
 
Join Date: Jan 2020
Location: Indonesia
Posts: 24
Reputation: 16
Default Re: Command Help

Just make a dialog and use for loops to show the admin.
IZenta is offline   Reply With Quote
Old 29/06/2020, 12:59 AM   #3
Chams
Big Clucker
 
Chams's Avatar
 
Join Date: May 2017
Posts: 90
Reputation: 17
Default Re: Command Help

Yeah, do you have the code?
Chams is offline   Reply With Quote
Old 29/06/2020, 01:38 AM   #4
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Re: Command Help

Quote:
Originally Posted by Chams View Post
Yeah, do you have the code?
It will look a little like this.

PHP Code:
CMD:admins(playeridparams[])
{
    new 
AdminString[62], AdminsString[512], Count 0;
    foreach(new 
i:Player)
    {
        if(
Player[i][ModLevel] != || Player[i][AdminLevel] != 0Count++;
        if(
Player[i][ModLevel] != 0format(AdminStringsizeof(AdminString),"%s (%i) Moderator\n"Player[i][Name], i);
        if(
Player[i][AdminLevel] != 0format(AdminStringsizeof(AdminString),"%s (%i) Administrator\n"Player[i][Name], i);
        
strcat(AdminsStringAdminString);
    }
    if(
Count == 0) return ShowPlayerDialog(playeridDIALOG_UNUSEDDIALOG_STYLE_MSGBOX"Online Staff""There is currently no Staff Member(s) Online.""Okay""");
    else if(
Count != 0) return ShowPlayerDialog(playeridDIALOG_UNUSEDDIALOG_STYLE_LIST"Online Staff"AdminsString"Okay""");
    return 
1;

__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Old 29/06/2020, 01:42 AM   #5
Lexless
Little Clucker
 
Join Date: May 2020
Posts: 38
Reputation: 14
Default Re: Command Help

Here you go, change PlayerInfo[i][Level] to your variable.

pawn Code:
CMD:admins(playerid, params[])
{
    new count, string[128 * 10], name[MAX_PLAYER_NAME + 1];
    GetPlayerName(playerid, name, sizeof(name));

    foreach(new i : Player)
    {
        if(PlayerInfo[i][Level] >= 1)
        {
            format(string, sizeof(string), "%s (ID: %d) %s (Level %d)\n", string, i, name(i), PlayerInfo[i][Level]);

            count++;
        }
        if(count < 1) return SendClientMessage(playerid, -1, "There are no administrators online");
    }
    ShowPlayerDialog(playerid, DIALOG_BLANK, DIALOG_STYLE_MSGBOX, "Admins Online", string, "OKAY", "");
    return 1;
}
Lexless is offline   Reply With Quote
Old 29/06/2020, 01:53 AM   #6
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Re: Command Help

If in your script, you use Moderators inside your AdminLevel like I do... this might work better.

PHP Code:
CMD:admins(playeridparams[])
{
    new 
AdminString[62], AdminsString[512], Count 0;
    foreach(new 
i:Player)
    {
        if(
Player[i][AdminLevel] != 0Count ++;
        switch(
Player[i][AdminLevel])
        {
            case 
1format(AdminStringsizeof(AdminString),"[Junior Administrator](%i) %s\n"iPlayer[i][Name]);
            case 
2format(AdminStringsizeof(AdminString),"[Senior Administrator](%i) %s\n"iPlayer[i][Name]);
            case 
3format(AdminStringsizeof(AdminString),"[Head Administrator](%i) %s\n"iPlayer[i][Name]);
            case 
4format(AdminStringsizeof(AdminString),"[Server Co-Director](%i) %s\n"iPlayer[i][Name]);
            case 
5format(AdminStringsizeof(AdminString),"[Server Director](%i) %s\n"iPlayer[i][Name]);
            default: 
format(AdminStringsizeof(AdminString),"[Undefined](%i) %s\n"iPlayer[i][Name]);
        }
        
strcat(AdminsStringAdminString);
    }
    if(
Count == 0) return ShowPlayerDialog(playeridDIALOG_UNUSEDDIALOG_STYLE_MSGBOX"Online Staff""There is currently no Staff Member(s) Online.""Okay""");
    else if(
Count != 0) return ShowPlayerDialog(playeridDIALOG_UNUSEDDIALOG_STYLE_LIST"Online Staff"AdminsString"Okay""");
    return 
1;

You could also do same layout for a /helpers CMD
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare 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
Help with YCMD proces command and problem with "Server:Unknown command JoDe Scripting Help 1 20/04/2018 12:12 PM
[Plugin] mcmd Command Engine - Plugin based command processing Mellnik Plugin Development 108 08/05/2016 01:55 PM
i had this command in my gamemode, when i type this in game,it tells server unknow command? Chrisli520 Scripting Help 3 24/11/2013 10:02 AM
Executed ZCMD command returns SERVER: Unknown Command SexTourist Scripting Help 12 03/01/2012 03:38 PM
Slap command returns an Unknown Command when player is not connected HydraX Help Archive 16 01/08/2011 05:19 AM


All times are GMT. The time now is 02:11 PM.


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