Whats wrong with this command?
#1

Код:
{ // 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
Reply
#2

No one knows?
Reply
#3

your forgot return 1;
Reply
#4

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

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

Tell the error or the gm name!
Reply
#7

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)