SA-MP Forums Archive
[Tutorial] How to create an command without "zcmd" - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to create an command without "zcmd" (/showthread.php?tid=411247)

Pages: 1 2


How to create an command without "zcmd" - Jaggy - 28.01.2013

To create a command with out "zcmd".inc
1. Create / load your script
2. then you must go bellow
and you will find :
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}
or if you don't find it and you already removed it then write it again
3. replace the /mycommand with your command
4. and replace the //do something here with your command action
5. and if you compelete it press (compile/run)

(NOTE): if you have some errors tell me

and if you want to add other and other commands

you have make likethis :


Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
                         SetPlayerHealth(playerid, 0)
		return 1;
	}
	return 0;
}
so you must add to the :

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
                                      SetPlayerHealth(playerid, 0)           
		             return 1;
	}
	return 0;
}
add like that :

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
                                      setplayerhealth(playerid, 0)
			return 1;
	}
             if (strcmp("/healme", cmdtext, true, 10) == 0)
	{
                                      setplayerhealth(playerid, 100)
                                      setplayerarmour(playerid, 100)
			return 1;
	}

	return 0;
}



AW: How to create an command without "zcmd" - Blackazur - 28.01.2013

I dont think that this is an Tutorial, and this is pretty simple self for Beginners. You should too say what they cause.


Re: How to create an command without "zcmd" - Madeline - 28.01.2013

Click me to see on how to post a tutorial ( Credits to Y_Less for topic _


Re: How to create an command without "zcmd" - Jaggy - 28.01.2013

LoL

HmMm


Re: How to create an command without "zcmd" - Madeline - 28.01.2013

Don't remove this, edit this to explain everyone clearly what you're saying!


AW: How to create an command without "zcmd" - IPrototypeI - 28.01.2013

you can even add to this tutorial where is the different between

pawn Code:
if (strcmp("/healme", cmdtext, true, 10) == 0)
and
pawn Code:
if (!strcmp("/healme", cmdtext)
how to use sscanf or strtok for commands with more parameters.
And if someone don't want to use sscanf to splitt the commandtext then how he get the string of a command
like /a for admin talk. And so on


Re: How to create an command without "zcmd" - Jaggy - 28.01.2013

do you see what i say in the tutorial?
i say replace the //do something here and make the command (Action)
... it is just for some actions
like :
(actions)
/kill
/drunk
/healme
(name Colors)
/red
/blue
/black
/pink
/purple
/green
/yellow
and other things..

read the tutorial good


Re: How to create an command without "zcmd" - Luis- - 28.01.2013

But STRCMP is gay, old and slow.


Re: How to create an command without "zcmd" - Madeline - 28.01.2013

Quote:
Originally Posted by -Luis
View Post
But STRCMP is gay, old and slow.
STRCMP is better than you, but before all these command processors were released, you had to use STRCMP, right? You can't just call something bad even if you used it many times before.


Re: How to create an command without "zcmd" - Jaggy - 28.01.2013

but the STRCMP can make the /slap command too right?


Re: How to create an command without "zcmd" - Luis- - 28.01.2013

zcmd was released when I started scripting and how is STRCMP better than me?


Re: How to create an command without "zcmd" - M3mPHi$_S3 - 28.01.2013

This is freaking easy , We also can use it by strcmp


Re: How to create an command without "zcmd" - Jochemd - 28.01.2013

It's good to learn players how to use strcmp, but not for commands.


Re: How to create an command without "zcmd" - Jaggy - 28.01.2013


so my thread is good for the newbies?


Re: How to create an command without "zcmd" - Madeline - 28.01.2013

Quote:
Originally Posted by -Luis
View Post
zcmd was released when I started scripting and how is STRCMP better than me?
Ok, but before command processors were even released, scripters had to use strcmp. A advanced scripter can create 'you' in-game using only strcmp.


Re: How to create an command without "zcmd" - Luis- - 28.01.2013

How can a scripter create me in game?


Re: How to create an command without "zcmd" - Madeline - 28.01.2013

Quote:
Originally Posted by -Luis
View Post
How can a scripter create me in game?
NPC, auto-chat, shoot when being attacked. Basically, the things we do being scripted.


Re: How to create an command without "zcmd" - Jaggy - 28.01.2013

Luis i'm not a pr0 scripter im medium scripter...



Re: How to create an command without "zcmd" - Luis- - 28.01.2013

Quote:
Originally Posted by Madeline
View Post
NPC, auto-chat, shoot when being attacked. Basically, the things we do being scripted.
You said an advanced scripter could create ME in game.

Quote:
Originally Posted by Jaggy
View Post
Luis i'm not a pr0 scripter im medium scripter...
I didn't say you was?


Re: How to create an command without "zcmd" - Madeline - 28.01.2013

Quote:
Originally Posted by Y_Less
View Post
Yes you can! If new better alternatives for something exist then the old version is worse than the new version. Just because it was once the best available doesn't make it good.
Yes, but you can just give some credits. It's something like it massively helped you before, but now you're betraying it.