SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 23/10/2016, 01:39 PM   #11
SyS
High-roller
 
SyS's Avatar
 
Join Date: Oct 2015
Posts: 2,002
Reputation: 473
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Pretty decent include .Thanks to you.
SyS is offline   Reply With Quote
Old 23/10/2016, 01:40 PM   #12
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 818
Reputation: 103
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Quote:
Originally Posted by eco1999 View Post
How to call a command?
Code:
cmd_yourcommand(playerid, " "); // if you are using params
cmd_yourcommand(playerid); // if you are not using params
__________________
SecretBoss is offline   Reply With Quote
Old 23/10/2016, 01:59 PM   #13
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 328
Reputation: 37
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Quote:
Originally Posted by SecretBoss View Post
Code:
cmd_yourcommand(playerid, " "); // if you are using params
cmd_yourcommand(playerid); // if you are not using params
No, i find.

native EmulateCommandEx(cmdid, playerid, params[])
native EmulateCommand(playerid, cmdtext[])
Max_Andolini is offline   Reply With Quote
Old 23/10/2016, 02:13 PM   #14
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 818
Reputation: 103
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Quote:
Originally Posted by eco1999 View Post
No, i find.

native EmulateCommandEx(cmdid, playerid, params[])
native EmulateCommand(playerid, cmdtext[])
EmulateCommand will re-create the command, calling the command is much faster than recreating it.
__________________
SecretBoss is offline   Reply With Quote
Old 23/10/2016, 02:38 PM   #15
Battallboi
Little Clucker
 
Join Date: Sep 2016
Posts: 8
Reputation: 0
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Any comparison between this and Pawn.CMD?

I mean this has tons of features but in terms of speed which is better?
Battallboi is offline   Reply With Quote
Old 23/10/2016, 03:14 PM   #16
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 867
Reputation: 295
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Quote:
Originally Posted by eco1999 View Post
How to call a command?
You can directly call the command as SecretBoss said, cmd_yourcommand(playerid, "");

Quote:
Originally Posted by SecretBoss View Post
Code:
cmd_yourcommand(playerid, " "); // if you are using params
cmd_yourcommand(playerid); // if you are not using params
You can pass "". And also you have to pass the command id. It wont crash the server.

Code:
cmd_yourcommand(cid_yourcommand, playerid, "");
Note that cid_yourcommand already exists. It is created by SmartCMD for you.

Quote:
Originally Posted by SecretBoss View Post
EmulateCommand will re-create the command, calling the command is much faster than recreating it.
The difference between the above method and using EmulateCommand is that EmulateCommand "really emulates". The command goes to OnPlayerCommandText which then triggers OnPlayerCOmmandReceived and then OnPlayerCommandPerformed... gets processed as if you really sent a command.

Whereas, calling directly using cmd_yourcommand will only call the command function. Using this method, OnPlayerCommandReceived and OnPlayerCommandPerformed will not be called.

Quote:
Originally Posted by Battallboi View Post
Any comparison between this and Pawn.CMD?

I mean this has tons of features but in terms of speed which is better?
For obvious reasons, PAWN.Cmd is faster as it is in a plugin but isn't significantly faster nor does it have any reasonable impact on your performance. This include is far more user friendly and is loaded with useful features.

Most importantly, this include lets you do anything with commands. You can extend the include without having to edit the include. You can do it in your script itself! So no worries about SmartCMD updates screwing up your edits.
Yashas is offline   Reply With Quote
Old 23/10/2016, 04:53 PM   #17
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 328
Reputation: 37
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Quote:
Originally Posted by Yashas View Post
You can directly call the command as SecretBoss said, cmd_yourcommand(playerid, "");



You can pass "". And also you have to pass the command id. It wont crash the server.

Code:
cmd_yourcommand(cid_yourcommand, playerid, "");
Note that cid_yourcommand already exists. It is created by SmartCMD for you.



The difference between the above method and using EmulateCommand is that EmulateCommand "really emulates". The command goes to OnPlayerCommandText which then triggers OnPlayerCOmmandReceived and then OnPlayerCommandPerformed... gets processed as if you really sent a command.

Whereas, calling directly using cmd_yourcommand will only call the command function. Using this method, OnPlayerCommandReceived and OnPlayerCommandPerformed will not be called.



For obvious reasons, PAWN.Cmd is faster as it is in a plugin but isn't significantly faster nor does it have any reasonable impact on your performance. This include is far more user friendly and is loaded with useful features.

Most importantly, this include lets you do anything with commands. You can extend the include without having to edit the include. You can do it in your script itself! So no worries about SmartCMD updates screwing up your edits.
cmd_yourcommand(cid_yourcommand, playerid, "");

Not work. Undefined symbol cid_yourcommand?
Max_Andolini is offline   Reply With Quote
Old 23/10/2016, 05:02 PM   #18
Stinged
High-roller
 
Join Date: Feb 2013
Posts: 1,588
Reputation: 187
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

The include looks great! I love the way you made those macros to work with flags and no flags.
I'm very bad at assembly so I barely understand how the code works, I've been actually planning on learning it years ago but I never had the time.

Quote:
Originally Posted by eco1999 View Post
cmd_yourcommand(cid_yourcommand, playerid, "");

Not work. Undefined symbol cid_yourcommand?
cmd_yourcommand(cid_yourcommand, playerid, "");
The red parts have to be the same. If you changed the first red word, you have to also change the second one.
Stinged is offline   Reply With Quote
Old 23/10/2016, 05:05 PM   #19
Max_Andolini
Huge Clucker
 
Max_Andolini's Avatar
 
Join Date: Oct 2013
Posts: 328
Reputation: 37
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Quote:
Originally Posted by Stinged View Post
cmd_yourcommand(cid_yourcommand, playerid, "");
The red parts have to be the same. If you changed the first red word, you have to also change the second one.
I know. Try. They give undefined symbol.
Max_Andolini is offline   Reply With Quote
Old 23/10/2016, 05:10 PM   #20
Stinged
High-roller
 
Join Date: Feb 2013
Posts: 1,588
Reputation: 187
Default Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+)

Quote:
Originally Posted by eco1999 View Post
I know. Try. They give undefined symbol.
I don't know if there's another way around this, but for now, place the command anywhere above the callback where you're using cid_yourcommand.

EDIT: I noticed this:

Quote:
Originally Posted by Yashas View Post
Code:
enum (<<=2)
{
    CFLAG_ACMD = 1,
    CFLAG_VIP,
    CFLAG_SOMETHING,
    CALEVEL_1,
    CALEVEL_2,
    CALEVEL_3,
    //store admin level of the admin command in these 3 bits; admin level can start from 0 and go upto 7
    .
    .
    .
    //total number should not exceed 32
}
The total number should not exceed 16 if you use (<<=2), it should be (<<=1)

Last edited by Stinged; 24/10/2016 at 03:49 AM.
Stinged 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
[Include] eXtended INI Processor - Fast & Feature Rich INI Processor Yashas Includes 28 01/09/2015 07:45 PM
[Include] r_commands - Clear and fast command processor! Swimor Includes 33 04/01/2013 03:30 PM
fast command processor [mad]MLK Help Archive 1 22/08/2009 01:32 AM


All times are GMT. The time now is 09:04 PM.


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