SA-MP Forums Archive
Problem with /name 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: Problem with /name command (/showthread.php?tid=139491)



Problem with /name command - sobolanux - 05.04.2010

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?


Re: Problem with /name command - Hiddos - 05.04.2010

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



Re: Problem with /name command - gotenks918 - 05.04.2010

if that doesnt work try this:

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