SA-MP Forums Archive
for some reason it it always doing the first cmd - 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: for some reason it it always doing the first cmd (/showthread.php?tid=110169)



for some reason it it always doing the first cmd - [HKS]dlegend - 24.11.2009

here is the beging but i dont wat the problem is it always does the cmd even if i do one that dosent exist like /hi i dont ge it help

thanks

Код:
		new cmd[256];
		new tmp[256];
		new sendername[MAX_PLAYER_NAME];
		new giveplayer[MAX_PLAYER_NAME];
		new giveplayerid, idx;
		new moneys;
		/////////////////////////////////////////////gangs////////////////////////////////////////
		//==============================================================================
		if(strcmp(cmd, "/gang",true)==0)
		{
	 	new gangcmd, gangnum;
		tmp = strtok(cmdtext, idx);
		new string[128];

		if(!strlen(tmp)) {
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/quit] [name/number]");
		return 1;
		}
		giveplayerid = strval(tmp);



Re: for some reason it it always doing the first cmd - Enzo_Ferrari_V12 - 25.11.2009

Ehh... use dcmd as it's faster, simpler, and more reliable. Here's the answer to ur probs

Код:
https://sampwiki.blast.hk/wiki/Fast_Commands
Give it a try.


Re: for some reason it it always doing the first cmd - Joe Staff - 25.11.2009

I'm pretty sure you have to use strtok on 'cmd' for before doing the commands.
pawn Код:
new cmd[256];
        new tmp[256];
        new sendername[MAX_PLAYER_NAME];
        new giveplayer[MAX_PLAYER_NAME];
        new giveplayerid, idx;
        new moneys;
        cmd = strtok(cmdtext,idx); //<--Here
        /////////////////////////////////////////////gangs////////////////////////////////////////
        //==============================================================================
        if(strcmp(cmd, "/gang",true)==0)
        {



Re: for some reason it it always doing the first cmd - [HKS]dlegend - 25.11.2009

oooh yeh thanks man and i use dcmd for other cmds


Re: for some reason it it always doing the first cmd - Correlli - 25.11.2009

Quote:
Originally Posted by [KG
Nikere ]
Ehh... use dcmd as it's faster, simpler, and more reliable.
Or zcmd, which is even more faster and more simple than dcmd.