Switching strcmp to zcmd [Basic] -
MrCoder - 19.10.2012
Table of contents- Includes
- Downloads
- Adding it
- Transfer
- Errors
- Extra Info
Plugins
Okay, so the include you will need to get first is called ZCMD (Duh). It's the include that you will need to create the ZCMD commands. This is the only include you will need to transfer the command. It's that easy!
Downloads
You can find the download link to the ZCMD include on this page:
http://forum.sa-mp.com/showthread.ph...highlight=ZCMD
Adding it
You need to add the ZCMD include at the top of your script. The define you need to add is:
Transfer
Okay, now for the big transfer. It can be quite easy at times, but that's only for the small scripts. The first thing you need to do it remove the OnPlayerCommandText - You don't need it!
Now that's that done, lets clear out a space and add a comment for our commands
Great, now lets paste our strcmp command into our section!
Now, lets edit our code out to make it suitable for ZCMD.
You will need to remove the
Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
section on the top of the command, and replace it with
Код:
CMD:mycommand(playerid,params[])
And there you go, your command has been transferred! Wasn't that easy?
Errors
You shouldn't get any errors when transferring commands as small as this, but, if you do get error post them down below in CODE tags, and i'll help you out
Extra Info
This will work for the other type of command includes, such as Y_CMD and dcmd, bcmd etc.
Re: Switching strcmp to zcmd [Basic] -
xplor09edy - 19.10.2012
I use it on many commands (in old time) and this can't work very good because some commands use cmdtext in commands and it need to be changed with params
Re: Switching strcmp to zcmd [Basic] - Glint - 19.10.2012
Junk!
Re: Switching strcmp to zcmd [Basic] -
MrCoder - 19.10.2012
Quote:
Originally Posted by xplor09edy
I use it on many commands (in old time) and this can't work very good because some commands use cmdtext in commands and it need to be changed with params
|
This is just a basic tutorial, to let newb's at PAWN know the general idea of switching commands.
Re: Switching strcmp to zcmd [Basic] -
SwisherSweet - 22.10.2012
You mean converting cmd's........
Re: Switching strcmp to zcmd [Basic] -
SuperViper - 22.10.2012
Quote:
Originally Posted by MrCoder
This is just a basic tutorial, to let newb's at PAWN know the general idea of switching commands.
|
Most
"newbs" will have commands with parameters.
Re: Switching strcmp to zcmd [Basic] -
MrCoder - 22.10.2012
Quote:
Originally Posted by ******
Have you ever heard of regular expressions? If not you might want to go look them up as they can be used to vastly automate a large amount of this work.
|
Just looked them up and you are right. I'll use them next time, thanks.
Re: Switching strcmp to zcmd [Basic] -
Mafioso97 - 22.10.2012
It's not quite complex to be honest, and it's not compatible for all situations; reconstruction wold be required here.
3/10