[Include] rCmd.inc - Easiest way to create commands!
#21

Great job!
Reply
#22

Quote:
Originally Posted by YJIET
View Post
I think this would be way better if you combined it with sscanf to support optional parameters, arrays etc.
Sorry, just noticed this post and I'm not sure what you mean. Can you explain a bit different please?

Beside this, are there any suggestions? I'd like to improve this command system.
Reply
#23

Well it's nice to see more ideas around the forums but anyways i bet the people will keep using ZCMD due to its performance and not for options. Good job though.
Reply
#24

I personally don't think that's the main reason. It's just because zcmd exists for quite a long time now and many people are used to it due its easiness combined with sscanf (plugin). Also many gamemodes are using zcmd nowdays and I don't think they'll just switch over just to make stuff easier, but I'm pretty sure that this will become very handy for people that create new gamemodes.
Reply
#25

I meant that you should include sscanf so it would be possible to use optional params and other stuff:
pawn Code:
public OnGameModeInit()
{
    rCmd_Init(car, "iI(-1)I(-1)");
}

rCmd:car(playerid, success, iModel, iColor1, iColor2)
{
    //code
    return 1;
}
Not sure if it's implementable though.
Reply
#26

Question: How do I call a command from another in the script?
For example, for dcmd I use:
PHP код:
dcmd_help(playeridparams[]) // Alias of /commands
{        
    return 
dcmd_commands(playerid,params);

Reply
#27

@YJIET:
Not sure about sscanf, but it is possible to add some specifiers in the command processor itself.

@vpontin:
For example:
pawn Код:
rCmd_Init(addcar,   "iffffii"); // Init

rCmd:addcar(playerid, success, iModel, Float: fX, Float: fY, Float: fZ, Float: fA, iColor1, iColor2) {
    if(!success)
        return SendClientMessage(playerid, 0xFF0000FF, "<> Syntax: /addcar [model] [x] [y] [z] [angle] [color1] [color2]");
    if(!(400 <= iModel <= 611))
        return SendClientMessage(playerid, 0xFF0000FF, "<> Error: Invalid model. Need to be between 400 and 611!");
   
    CreateVehicle(iModel, fX, fY, fZ, fA, iColor1, iColor2, 60);
   
    SendClientMessage(playerid, 0x00FF00FF, "<> You succesfully created the vehicle!");
    return 1;
}
Will be like:
pawn Код:
rCmd_Init(createveh,   "iffffii"); // Init

rCmd:createveh(playerid, success, iModel, Float: fX, Float: fY, Float: fZ, Float: fA, iColor1, iColor2) {
    return cmd_addcar(playerid, success, iModel, Float: fX, Float: fY, Float: fZ, Float: fA, iColor1, iColor2);
}
Reply
#28

Really Nice.

Is it possible to post speedtest of this cmd processor compareing it with ZCMD or YCMD


EDIT: You already did
Reply
#29

Good Job Ryder
Reply
#30

It's fast?
Reply
#31

I like this include. I will test this later and give you feedback.
Reply
#32

Very good!

Tip:
1° Try to remove the rCmd_Init therefore more complicated for those who will change ZCMD for RCMD.
2° In the parameters a place for players as well, which uses sscanf type "u".

Note: I do not know if the translation is nice ... Translated by ****** Translator. PT-BR for EN-US.
Reply
#33

sьper olmuş eline sağlık.

gtaturkde tьrkзe şekilde anlatım yaparsan makbule geзer.

ayrıca onplayercommandtex'e koymuyoruz bunu anladığım kadarı ile ?


onplayercommand'a bunu koymuşsun цrnekte tam olarak ne işe yarıyor ?
rCmd_Init(command, "ifs");

ve bir sorun var sanırım

http://c1204.hizliresim.com/w/d/4cz10.png
Reply
#34

Quote:
Originally Posted by paulor
Посмотреть сообщение
Very good!

Tip:
1° Try to remove the rCmd_Init therefore more complicated for those who will change ZCMD for RCMD.
2° In the parameters a place for players as well, which uses sscanf type "u".

Note: I do not know if the translation is nice ... Translated by ****** Translator. PT-BR for EN-US.
I think it's impossible not declare command's scopes.
Unless you are saying to make it more similar to dcmd, where the scope is in OnPlayerCommandText

Код:
OFFTOPIC: Greetings from Rio Grande do Sul :P
Reply
#35

Amazing, very nice work!



Quote:
Originally Posted by Armyw0w
Посмотреть сообщение
It's fast?
He said it's 2 times slower than ZCMD, so, yes it's fast.
Reply
#36

LoL very nice , good work Ryder :P
Reply
#37

I seriously love this include, but I highly miss the "u" parameter. I hope you'll add it, Ryder.
Reply
#38

Quote:
Originally Posted by Y_Less
View Post
You can get rid of "rCmd_Init", it's just a little tricky. Probably the simplest demonstration of this is y_remote:
That's very good! I just tried it and it worked pretty good, although I don't want to implement a whole other library in this small command system so can you give me a small idea on how I'd get the functions' name address specifically? As for the bug, I will see and confirm if so.

Quote:
Originally Posted by Biesmen
View Post
I seriously love this include, but I highly miss the "u" parameter. I hope you'll add it, Ryder.
I will add some useful parameters quite soon in the next update. Plus, there's not rCmd_Init anymore!
Reply
#39

Alright, got it, thanks!
pawn Code:
stock GetPublicNameByIndex(iIdx, szName[], iSize = sizeof(szName)) {
    static
        s_iBase,
        s_iPublics,
        s_iNatives,
        s_iCount
    ;
    if(!s_iBase) {
        #emit LCTRL 1
        #emit NEG
        #emit STOR.PRI s_iBase
    }
    if(!s_iPublics) {
        new
            iAddr
        ;
        #emit LOAD.PRI s_iBase
        #emit ADD.C 32
        #emit STOR.S.PRI iAddr
        #emit LREF.S.PRI iAddr 
        #emit LOAD.S.ALT iAddr
        #emit ADD
        #emit CONST.ALT 32
        #emit SUB  
        #emit STOR.PRI s_iPublics
    }
    if(!s_iNatives) {
        new
            iAddr
        ;
        #emit LOAD.PRI s_iBase
        #emit ADD.C 36
        #emit STOR.S.PRI iAddr
        #emit LREF.S.PRI iAddr 
        #emit LOAD.S.ALT iAddr
        #emit ADD
        #emit CONST.ALT 36
        #emit SUB
        #emit STOR.PRI s_iNatives
    }
    if(!s_iCount) {
        s_iCount = ((s_iNatives - s_iPublics) >>> 3);
    }
    if(iIdx < s_iCount) {
        new
            iPos = (iIdx << 3) + s_iPublics + 4,
            iCh,
            i
        ;
        #emit LREF.S.PRI iPos
        #emit LOAD.ALT s_iBase
        #emit ADD
        #emit STOR.S.PRI iPos

        do {
            #emit LREF.S.PRI iPos
            #emit STOR.S.PRI iCh

            szName[i] = iCh & 0xFF;
               
            iPos++;
        } while(szName[i++] != EOS && i <= iSize);
        szName[i] = EOS;
       
        return 1;
    }
    return 0;
}
Will update quite soon.
Reply
#40

nice work!
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)