SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 13/06/2019, 04:02 PM   #1
akovacevic00
Little Clucker
 
akovacevic00's Avatar
 
Join Date: May 2019
Posts: 13
Reputation: 0
Default Smart CMD help

Hello, I'm trying to make a command that will show a list of administrative commands without manually writing them. SInce this SmartCMD has all the needed functions, I thought that would be possible. But I can't make it.

SmartCMD - https://forum.sa-mp.com/showthread.php?t=619862

The current code shows like 5 commands correctly, then repeats one command name many, many times..
Also, when dialog pops up, and if there are many commands, it wont fit on the screen. So how can I make it only display 10 commands per dialog line?

Thanks for your help

PHP Code:
CMD<A1>:acmds(cmdidplayeridparams[])
{
    new 
info[128], dialog[1000], cmd[MAX_COMMAND_NAME];
    
strcat(info"{FF0000}Trial administrator (Level 1):{FFFFFF}\n\n"); strcat(dialoginfo);
    for(new 
0500i++)
    {
        if(
IsCommandEnabled(i) && GetCommandFlags(i) == A1)
        {
            
GetCommandName(icmdsizeof(cmd));
        }
        
format(infosizeof(info), "/%s, "cmd); strcat(dialoginfo);
    }
    
Dialog_Show(playeridDIALOG_ACMDSDIALOG_STYLE_MSGBOX"Administrative Commands:"dialog"Close""");
    return 
1;

__________________
CONTACT ME
Discord: akovacevic00#9200
Email: kovacevica2000@gmail.com
akovacevic00 is offline   Reply With Quote
Old 13/06/2019, 05:13 PM   #2
DomagojSellug
Big Clucker
 
DomagojSellug's Avatar
 
Join Date: Sep 2016
Location: Croatia
Posts: 164
Reputation: 9
Default Re: Smart CMD help

Show us the code which shows the dialog (the part where the commands are listed
pawn Code:
"/kick , /ban ..."
).
Remember that after a few commands you list, you should put
pawn Code:
\n
so it starts writing the commands in a new line. So, after every 10 commands put \n.
__________________
My work:


Weapon Shop FS
Click on me!
DomagojSellug is offline   Reply With Quote
Old 13/06/2019, 05:39 PM   #3
akovacevic00
Little Clucker
 
akovacevic00's Avatar
 
Join Date: May 2019
Posts: 13
Reputation: 0
Default Re: Smart CMD help

That's the entire code. Look closely

Yeah I know, but right in this case, how exactky do I do it? When you have time, I would please you to modify it just a little so I get to know

I'm sure that I'm missing something
__________________
CONTACT ME
Discord: akovacevic00#9200
Email: kovacevica2000@gmail.com
akovacevic00 is offline   Reply With Quote
Old 13/06/2019, 05:58 PM   #4
Plastikmensch
Huge Clucker
 
Join Date: Aug 2016
Posts: 243
Reputation: 13
Default Re: Smart CMD help

You could create a variable to keep track of added commands and if that variable %10=0 you strcat "\n".
And you might want to put the format inside the if. When you do not this happens:
Quote:
[shows x command correctly] then repeats one command name many, many times..
Code:
CMD<A1>:acmds(cmdid, playerid, params[])
{
    new info[128], dialog[1000], cmd[MAX_COMMAND_NAME],commandAmount;
    strcat(info, "{FF0000}Trial administrator (Level 1):{FFFFFF}\n\n"); strcat(dialog, info);
    for(new i = 0; i < 500; i++)
    {
        if(IsCommandEnabled(i) && GetCommandFlags(i) == A1)
        {
            GetCommandName(i, cmd, sizeof(cmd));
            format(info, sizeof(info), "/%s, ", cmd); strcat(dialog, info);
            commandAmount++;
            if(commandAmount>9 && commandAmount%10==0) strcat(dialog,"\n");
        }
    }
    Dialog_Show(playerid, DIALOG_ACMDS, DIALOG_STYLE_MSGBOX, "Administrative Commands:", dialog, "Close", "");
    return 1;
}
Plastikmensch is offline   Reply With Quote
Old 13/06/2019, 06:30 PM   #5
akovacevic00
Little Clucker
 
akovacevic00's Avatar
 
Join Date: May 2019
Posts: 13
Reputation: 0
Default Re: Smart CMD help

That's it. Thanks guys!
(left some reps) :*
__________________
CONTACT ME
Discord: akovacevic00#9200
Email: kovacevica2000@gmail.com
akovacevic00 is offline   Reply With Quote
Old 14/06/2019, 05:24 AM   #6
Koreadars
Big Clucker
 
Join Date: Mar 2019
Location: Czech Republic, Prdelákov.
Posts: 128
Reputation: 6
Default Re: Smart CMD help

Don't forget this:
pawn Code:
if(i == cmdid) continue; //not add /acmds (if you'll be checking level)
if(IsCommandAlternate(i)) continue; // if /car has /c alternative, won't be added
Koreadars 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
[Off] Streaming Smart TV Holl Português/Portuguese 2 03/08/2015 05:10 AM
[FilterScript] Smart Checker V1.2! Wizza Filterscripts 3 16/10/2013 09:05 PM
Smart Ass Problem! James Coral Scripting Help 4 27/12/2011 11:26 AM
How do I use Smart Chat? seanny Scripting Help 1 27/10/2011 12:19 AM
[Include] Smart Chat =WoR=Varth Includes 21 06/07/2011 03:27 AM


All times are GMT. The time now is 01:57 AM.


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