SA-MP Forums Archive
What is the Different ? - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What is the Different ? (/showthread.php?tid=487288)



What is the Different ? - dakata994 - 12.01.2014

Thanks for the Information !


Re : What is the Different ? - S4t3K - 12.01.2014

ZCMD commands are just faster to create.
And ZCMD commands are also most used to learn the pawn (and because the guy learnt the pawn with ZCMD, he continues to use ZCMD)

But no differences about performances.
With ZCMD, your server will be as fast as if you use strcmp.


Re: What is the Different ? - Lyksus - 12.01.2014

It is, and ZCMD is fast indeed. But you should take into a count of using YCMD instead.


Re: What is the Different ? - Konstantinos - 12.01.2014

Read a quote of Zeex:
Quote:
Originally Posted by Zeex
Посмотреть сообщение
This is just a little include that uses OnPlayerCommandText() to process players' commands. Each command has a separate function like in dcmd, but zcmd calls them directly via CallLocalFunction(). Such method is much faster than when you successively compare the text player entered to each command you have in your script (especially if he send a nonexistent cmd, you pass though all then) and its superiority over the old way is proportional to the number of commands.
---

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
But no differences about performances.
With ZCMD, your server will be as fast as if you use strcmp.
Not a valid argument, compare y_commands or ZCMD with strcmp and you'll see big difference for a server that uses many commands.


Re: What is the Different ? - Yashas - 12.01.2014

Comparing strings are always slower.Because strings are arrays.
new string[10];
If you have to check a command then you will have to check string[0],string[1],....till [9].
That makes things slow.

If you go through the include, you will notice that ZCMD works very much differently.
When you use COMMAND:cmdname you are actually creating a function with a name cmd_cmdname.
So what ZCMD does is when it receives a command it joins "cmd_" and the command entered and calls the respective function.So there is no string checking or any such thing that would possibly make the server processing slow.