SA-MP Forums Archive
[Include] rCmd.inc - Easiest way to create commands! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] rCmd.inc - Easiest way to create commands! (/showthread.php?tid=323777)

Pages: 1 2 3 4 5 6


Re: rCmd.inc - Easiest way to create commands! - Ricop522 - 08.03.2012

Great job!


Re: rCmd.inc - Easiest way to create commands! - RyDeR` - 09.03.2012

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.


Re: rCmd.inc - Easiest way to create commands! - TheArcher - 09.03.2012

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.


Re: rCmd.inc - Easiest way to create commands! - RyDeR` - 09.03.2012

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.


Re: rCmd.inc - Easiest way to create commands! - Stylock - 09.03.2012

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.


Re: rCmd.inc - Easiest way to create commands! - vpontin - 09.04.2012

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);




Re: rCmd.inc - Easiest way to create commands! - RyDeR` - 10.04.2012

@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);
}



Re: rCmd.inc - Easiest way to create commands! - DonWade - 10.04.2012

Really Nice.

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


EDIT: You already did


Re: rCmd.inc - Easiest way to create commands! - Juninho_Oakley - 10.04.2012

Good Job Ryder


Re: rCmd.inc - Easiest way to create commands! - Armyw0w - 11.04.2012

It's fast?


Re: rCmd.inc - Easiest way to create commands! - sniperwars - 11.04.2012

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


Re: rCmd.inc - Easiest way to create commands! - paulor - 12.04.2012

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.


Re: rCmd.inc - Easiest way to create commands! - VendenTTa - 12.04.2012

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


Re: rCmd.inc - Easiest way to create commands! - vpontin - 13.04.2012

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



Re: rCmd.inc - Easiest way to create commands! - MrDeath537 - 13.04.2012

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.


Re: rCmd.inc - Easiest way to create commands! - dPlaYer_ - 13.04.2012

LoL very nice , good work Ryder :P


Re: rCmd.inc - Easiest way to create commands! - Biesmen - 18.04.2012

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


Re: rCmd.inc - Easiest way to create commands! - RyDeR` - 21.04.2012

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!


Re: rCmd.inc - Easiest way to create commands! - RyDeR` - 21.04.2012

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.


Re: rCmd.inc - Easiest way to create commands! - StreetGT - 21.04.2012

nice work!