[Tutorial] Switching strcmp to zcmd [Basic]
#1



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:
Код:
#include <ZCMD>
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.

Reply
#2

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
Reply
#3

Junk!
Reply
#4

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.
Reply
#5

You mean converting cmd's........
Reply
#6

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.
Reply
#7

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.
Reply
#8

It's not quite complex to be honest, and it's not compatible for all situations; reconstruction wold be required here.
3/10
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)