[Tutorial] How to create an command without "zcmd"
#1

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;
}
Reply
#2

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

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

LoL

HmMm
Reply
#5

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

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

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

But STRCMP is gay, old and slow.
Reply
#9

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

but the STRCMP can make the /slap command too right?
Reply
#11

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

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

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


so my thread is good for the newbies?
Reply
#15

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

How can a scripter create me in game?
Reply
#17

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

Luis i'm not a pr0 scripter im medium scripter...
Reply
#19

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?
Reply
#20

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


Forum Jump:


Users browsing this thread: 1 Guest(s)