SA-MP Forums Archive
From normal cmds to 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)
+--- Thread: From normal cmds to zcmd (/showthread.php?tid=559341)



From normal cmds to zcmd - xX4m4zingXx - 22.01.2015

I have some commands, but I want to change them to zcmd commands.
How would I do that.
I have one command if someone of you can convert it, then I will change all the other ones.
This is my command
Код:
if(!strcmp(cmdtext, "/help", true))
	{
		SendClientMessage(playerid, 0xFFFFFFFF, "Vehicle");
		SendClientMessage(playerid, 0xFFFFFFFF, "Use it like /help vehicle");
		return 1;
	}



Re: From normal cmds to zcmd - Ironboy - 22.01.2015

pawn Код:
CMD:help(playerid, params)
{
    SendClientMessage(playerid, 0xFFFFFFFF, "Vehicle");
    SendClientMessage(playerid, 0xFFFFFFFF, "Use it like /help vehicle");
    return 1;
}



Re: From normal cmds to zcmd - xX4m4zingXx - 22.01.2015

What does the playerid and params here mean?
Код:
CMD:help(playerid, params)
And what do here strcmp and true here mean?
Код:
if(!strcmp(cmdtext, "/help", true))



Re: From normal cmds to zcmd - Rodney Francalim - 22.01.2015

At ZCMD:
params is everything that you types after "/help ".

At normal cmds:
strcmp compares 2 strings. The 2 firsts args are strings. In the case what the player typed (cmdtext) and the "/help" string. True is a boolean, that points if ignore the case sensitive, or not.

If strcmp returns 0 the strings match.


Re: From normal cmds to zcmd - xX4m4zingXx - 22.01.2015

Quote:
Originally Posted by Rodney Francalim
Посмотреть сообщение
At ZCMD:
params is everything that you types after "/help ".

At normal cmds:
strcmp compares 2 strings. The 2 firsts args are strings. In the case what the player typed (cmdtext) and the "/help" string. True is a boolean, that points if ignore the case sensitive, or not.

If strcmp returns 0 the strings match.
Does ZCMD ignore the case sensitive, or not?
What can you do with the params of ZCMD?


Re: From normal cmds to zcmd - Stanford - 22.01.2015

Quote:
Originally Posted by xX4m4zingXx
Посмотреть сообщение
Does ZCMD ignore the case sensitive, or not?
What can you do with the params of ZCMD?
It ignores the case sensitive part.

you can use the params for sscanf for example.

- When you type something for instance like: "/kill Fenix" the fenix part is counted as params.

Recommended for you to learn how to use sscanf by ******, it's really useful.

I hope I helped, good luck!


Re: From normal cmds to zcmd - xX4m4zingXx - 22.01.2015

Quote:
Originally Posted by Stanford
Посмотреть сообщение
It ignores the case sensitive part.

you can use the params for sscanf for example.

- When you type something for instance like: "/kill Fenix" the fenix part is counted as params.

Recommended for you to learn how to use sscanf by ******, it's really useful.

I hope I helped, good luck!
Thank you, this is very useful.