Custom Display @command

mrlongshen

Noobies
Messages
1,126
Points
0
Age
36
Location
localhost 127.0.0.1
Emulator
Hi all.

When player type @commands, it will show what we have config in group.conf right ? 

How to add additional display custom command in there ? at the bottom below of the original.

For example:

Custom command ----

buff,rms,ii2,jump2

 
To add the custom commands to '@commands', you'll have to make a change in the source, if you want do to in script, you have to create a command using the function 'bindatcmd' (see more in 'doc/script_commands.txt') and put your custom commands.

If you want the source modification example.

Here is:

atcommand.c.patch

Sorry for my english, I only understand a little of english.
default_smile.png


 

Attachments

Put '@commands2' in chat to see the custom commands.

This is a little example...

Here is:

Code:
-    script    atcmd_example    FAKE_NPC,{
OnInit:
    setarray .custom_commands$[0], "buff", "rms", "ii2", "jump2";
    setarray .custom_commands_group[0], 3, 0, 10, 15;
 
    bindatcmd "commands2", strnpcinfo(3) + "::OnAtcommand";
    end;
 
OnAtcommand:
    message getcharid(3), "--------------------------";
    message getcharid(3), "Available custom commands:";
 
    for(.@i = 0; .@i < getarraysize(.custom_commands$); .@i++)
    {
        if (getgroupid() < .custom_commands_group[.@i])
            continue;
 
        .@commands_string$ += .custom_commands$[.@i] + ((.@i + 1 == getarraysize(.custom_commands$)) ? "" : "   "); 
        .@count++;
    }
 
    message getcharid(3), .@commands_string$;
    message getcharid(3), .@count + " custom commands found.";
    end;
}
 
@@Cretino Oh I see. Thanks for your help sir ! I wish one day you will become herc.ws source dev 
default_wub.png
Hello friend, was seeing something in the function 'bindatcmd' and I made a change that I think you will like it, you will only need apply this change and all script commands will be read and show together in '@commands'.

atcommand.c_v2.patch

 

Attachments

Back
Top