SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 31/08/2011, 09:07 PM   #1
Swyft
Huge Clucker
 
Swyft's Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 496
Reputation: 117
Default STRCMP and ZCMD - how to change your commands to ZCMD

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: http://forum.sa-mp.com/showthread.php?t=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

Last edited by Swyft; 03/10/2011 at 02:06 AM.
Swyft is offline   Reply With Quote
Old 31/08/2011, 09:11 PM   #2
Kush
Gangsta
 
Join Date: May 2011
Posts: 781
Reputation: 126
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

This is your third 'tutorial' in less than 2 days in relation to strcmp and zcmd. Stop before you get an infraction.
__________________
Quote:
Originally Posted by Dripac
i have more reputation than you, that means i am more clever than you my friend
Kush is offline   Reply With Quote
Old 31/08/2011, 09:14 PM   #3
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,304
Reputation: 2184
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

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
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline   Reply With Quote
Old 31/08/2011, 09:16 PM   #4
Kush
Gangsta
 
Join Date: May 2011
Posts: 781
Reputation: 126
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

Quote:
Originally Posted by Hiddos View Post
I'd like to see you give one
EDIT: It was a simple reminder. You boss eh?
__________________
Quote:
Originally Posted by Dripac
i have more reputation than you, that means i am more clever than you my friend
Kush is offline   Reply With Quote
Old 31/08/2011, 09:20 PM   #5
Swyft
Huge Clucker
 
Swyft's Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 496
Reputation: 117
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

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
Swyft is offline   Reply With Quote
Old 01/09/2011, 11:26 AM   #6
Basicz
Gangsta
 
Basicz's Avatar
 
Join Date: Aug 2010
Location: Indonesia, Surabaya.
Posts: 605
Reputation: 35
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

You are converting it like this :
pawn Code:
public OnPlayerCommandText( ... )
{
    CMD: ...
        return 1;
}

Which is wrong, when you need to put it outside OnPlayerCommandText.
__________________

- Quina, from the game " Final Fantasy IX "
Basicz is offline   Reply With Quote
Old 01/09/2011, 10:48 PM   #7
Swyft
Huge Clucker
 
Swyft's Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 496
Reputation: 117
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

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.
Swyft is offline   Reply With Quote
Old 02/09/2011, 07:38 AM   #8
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

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.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 17/09/2011, 02:58 AM   #9
Swyft
Huge Clucker
 
Swyft's Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 496
Reputation: 117
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

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; ...
Swyft is offline   Reply With Quote
Old 17/09/2011, 03:43 AM   #10
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default Re: STRCMP and ZCMD - how to change your commands to ZCMD

Quote:
Originally Posted by RockingCamman View Post
G4U with ur bs but do return 1; ...
Good for you for posting bullshit among the community.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ 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
[Tutorial] Converting strcmp+strtok commands to zcmd+sscanf AndreT Tutorials 2 31/08/2011 09:02 PM
Strcmp to zcmd Omecken Help Archive 2 28/02/2011 10:01 PM
zcmd and strcmp xir Help Archive 7 15/02/2011 10:29 PM
strcmp to ZCMD? Xer0maR Help Archive 2 18/01/2011 04:46 PM


All times are GMT. The time now is 05:25 AM.


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