SA-MP Forums Archive
How to make commands with parameters? - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make commands with parameters? (/showthread.php?tid=100846)



How to make commands with parameters? - sandisk125 - 07.10.2009

How to make commands with parameters?
for example like: "/givecash [playerid] [Amount]"


Re: How to make commands with parameters? - Eazy_Efolife - 07.10.2009

Код:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
	SendClientMessage(playerid, COLOR, "[USAGE:] /givemoney [playerid] [money]");
	return 1;
}



Re: How to make commands with parameters? - sandisk125 - 07.10.2009

Quote:
Originally Posted by Compton's Eazy E
Код:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
	SendClientMessage(playerid, COLOR, "[USAGE:] /givemoney [playerid] [money]");
	return 1;
}
how do you know that?
i mean how can i know how to make another commands with parameters alone?


Re: How to make commands with parameters? - woot - 07.10.2009

Use dcmd + sscanf, it's small, easy, fast.

https://sampwiki.blast.hk/wiki/Dcmd
https://sampwiki.blast.hk/wiki/Dcmd#example_revisited