SA-MP Forums Archive
Whats wrong with this command? - 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: Whats wrong with this command? (/showthread.php?tid=88741)



Whats wrong with this command? - killdahobo99 - 28.07.2009

Код:
{ // Your bracket was missing here and it was poorly indented
	if (strcmp("/cuff", cmdtext, true, 15) == 0) // This should work now
 	{
 		new tmp[128];
 		new idx;
		new giveplayerid;
		new giveplayer[MAX_PLAYER_NAME];
		new sendername[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);
 		if(!strlen(tmp)) return SendClientMessage(playerid,0xAA3333AA,"USAGE: /cuff [playerid]");
// 		giveplayerid = strval(tmp); // The problem here was that is should be ReturnUser(tmp) instead of strval(tmp)
 		giveplayerid = ReturnUser(tmp);
 		if(gTeam[playerid] == TEAM_COP)
		{
			if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot cuff cops !");
			TogglePlayerControllable(giveplayerid,0);
			GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
			GetPlayerName(playerid,sendername,sizeof(sendername));
			format(tmp,sizeof(tmp),"You have cuffed %s",giveplayer);
			SendClientMessage(playerid,0x33AA33AA,tmp);
			format(tmp,sizeof(tmp),"You have been cuffed by %s",sendername);
			SendClientMessage(giveplayerid,0xAA3333AA,tmp);
			return 1;
		}
		else return SendClientMessage(playerid,COLOR_GREY, "You are not a cop!"); // Added this to return a value if someone isn't a cop
	}
When i type /cuff it says "Server unknown command" When my skin is a cop


Re: Whats wrong with this command? - killdahobo99 - 28.07.2009

No one knows?


Re: Whats wrong with this command? - clean180ollie - 28.07.2009

your forgot return 1;


Re: Whats wrong with this command? - killdahobo99 - 28.07.2009

Quote:
Originally Posted by clean180ollie
your forgot return 1;
Where? Can you show me? ....


Re: Whats wrong with this command? - killdahobo99 - 28.07.2009

oh my god can someone please just reply if you know the answer, So i can finally continue with my GM


Re: Whats wrong with this command? - Nee - 28.07.2009

Tell the error or the gm name!


Re: Whats wrong with this command? - killdahobo99 - 28.07.2009

Quote:
Originally Posted by Nee
Tell the error or the gm name!
There is no error...! the Command simply just doesnt work...


Re: Whats wrong with this command? - Jefff - 28.07.2009

Should be cmd not cmdtext
and on top cmdtext
Код:
cmd = strtok(blabla);
Код:
if (strcmp("/cuff", cmd, true) == 0)



Re: Whats wrong with this command? - killdahobo99 - 28.07.2009

Quote:
Originally Posted by Jefff
Should be cmd not cmdtext
and on top cmdtext
Код:
cmd = strtok(blabla);
Код:
if (strcmp("/cuff", cmd, true) == 0)
.


I dont understand that...Whats the "bla bla bla" part?


Re: Whats wrong with this command? - Jefff - 28.07.2009

Код:
cmd = strtok(cmdtext, idx);