[Tutorial] STRCMP and ZCMD - how to change your commands to ZCMD
#1

NOTE: I got a message from a moderator about I didn't follow something in the guidelines, so hopefully this will take care of it! This is another re-upload. If there is any problems please just reply, I might of made a mistake but who knows.

ZCMD Well ZCMD is a type of include file that calls a command function

COMMAND Defines that you are using a ZCMD Command (You can also use CMD instead of COMMAND)

YourCommandHere is where you would place the name of the command you wish to use. (ie. /yourcommandhere)

Playerid Return of the player who typed the command that is added in your FS or GM

params[] is the parameters of the command (You can also use params instead of params[] (tested it and it worked with me)

Step 1: We need to download the include file for zcmd to work!

Download Link: https://sampforum.blast.hk/showthread.php?tid=91354

Step 2: At the top of your FS and GM we need to make sure we included the ZCMD include file, so this has to be added at the top of your script for it to work.
pawn Code:
#include <zcmd>
Step 3: Now we have to search for "OnPlayerCommandText" once we found it we have to delete it (Do not delete your commands that are in it.)

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
                // Do something here
        return 1;
    }
    return 0;
}
Well remove it you don't need it just make sure you use // to seperate it so it makes more sence for you guys to understand, so you are not confused with "OnPlayerText"

I am going to transfer my strcmp command to ZCMD, which in this case is named "/YourCommandHere"
pawn Code:
if (strcmp("/yourcommandhere", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_RED,"This is a test command");
        return 1;
    }
Now, this is a STRCMP command, so we have to make it a ZCMD command. All we are doing is converting =D
pawn Code:
if (strcmp("/yourcommandhere", cmdtext, true, 10) == 0)
We are going to replace it with this
pawn Code:
COMMAND:yourcommandhere(playerid, params[])
Changing the title is basically all you do like in here
pawn Code:
COMMAND:yourcommandhere(playerid, params)
    {
        SendClientMessage(playerid, COLOR_RED,"This is a test command");
        return 1;
    }
This is very simple to do, at the end you do not need to add return 0;

Well hope this tutorial helped if you want to see the filterscript that compiled correctly then look below
Reply
#2

This is your third 'tutorial' in less than 2 days in relation to strcmp and zcmd. Stop before you get an infraction.
Reply
#3

Quote:
Originally Posted by Kush
View Post
This is your third 'tutorial' in less than 2 days in relation to strcmp and zcmd. Stop before you get an infraction.
I'd like to see you give one
Reply
#4

Quote:
Originally Posted by Hiddos
View Post
I'd like to see you give one
EDIT: It was a simple reminder. You boss eh?
Reply
#5

Quote:
Originally Posted by Kush
View Post
EDIT: It was a simple reminder. You boss eh?
Dude, I got a message since all the mods didn't give me a message. This one gave me a message about why it is removed, i did my best to make sure it follows the guidelines... if it gets removed then... I'm all good with it.

See this one explains ZCMD and everything else.

....

So yea, if it gets removed, then I will not repost it. I am all right with it
Reply
#6

You are converting it like this :
pawn Code:
public OnPlayerCommandText( ... )
{
    CMD: ...
        return 1;
}
Which is wrong, when you need to put it outside OnPlayerCommandText.
Reply
#7

Quote:
Originally Posted by Basicz
View Post
You are converting it like this :
pawn Code:
public OnPlayerCommandText( ... )
{
    CMD: ...
        return 1;
}
Which is wrong, when you need to put it outside OnPlayerCommandText.
That is where you are wrong sir, My GM that works perfectly doesn't have OnPlayerCommandText, so you are wrong, You may be able to do it that way also.
Reply
#8

Quote:
Originally Posted by RockingCamman
View Post
That is where you are wrong sir, My GM that works perfectly doesn't have OnPlayerCommandText, so you are wrong, You may be able to do it that way also.
Bahhahahahahahahahhaha! I'm going to put that in the funny conversations topic!

This tutorials completely wrong, I'd advice don't take such power over correct opinions. They will not work.

I have 2500 commands in the god father consisting of parameters, I want that in sscanf, can you help me out? I tried all this and now my compiler stops working.
Reply
#9

Quote:
Originally Posted by Lorenc_
View Post
Bahhahahahahahahahhaha! I'm going to put that in the funny conversations topic!

This tutorials completely wrong, I'd advice don't take such power over correct opinions. They will not work.

I have 2500 commands in the god father consisting of parameters, I want that in sscanf, can you help me out? I tried all this and now my compiler stops working.
G4U with ur bs but do return 1; ...
Reply
#10

Quote:
Originally Posted by RockingCamman
View Post
G4U with ur bs but do return 1; ...
Good for you for posting bullshit among the community.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)