Problem with /name command
#1

ok, so I have made a little code for a /name command. when you type 1 it shows your name and when you type 0 it hides ur name (/name 1/0)

Код:
dcmd_name(playerid,params[])
{
	#pragma unused params
	new a;
	sscanf(params, "i", a);
	if(a == 1)
		{
		  ShowPlayerNameTagForPlayer(MAX_PLAYERS, playerid, 1);
		  SendClientMessage(playerid, COLOUR_YELLOW,"Your name has been unhidden!");
		}
  else if(a == 0)
		{
		  ShowPlayerNameTagForPlayer(MAX_PLAYERS, playerid, 0);
		  SendClientMessage(playerid, COLOUR_YELLOW,"Your name has been hidden!");
		}
	else SendClientMessage(playerid, COLOUR_RED,"Correct algorithm: /name 1/0");
	return 1;
}
the problem is that when I type just /name ot /name 123213 or anything else it hids my name when it should say "Correct algorithm /team 1/0". It shows it just when I type /name 2 or /name 3 etc. Can you help?
Reply
#2

I'm not using DCMD, but shouldn't be 'a' indexed? Like:
pawn Код:
new a[32];
Reply
#3

if that doesnt work try this:

sscanf(params, "i[32]", a);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)