SA-MP Forums Archive
[DCMD] Problem - 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: [DCMD] Problem (/showthread.php?tid=130103)



[DCMD] Problem - ErF - 25.02.2010

Hi. I want to do a command with several parameters. For example, someone typed "/p show" that displays something, someone enters "/p delete" displays something else. I have such a code is:
Код:
dcmd_p(playerid, cmdtext[])
{
	new tag[64];
	if(sscanf(cmdtext, "u", tag))
	{
	  SendClientMessage(playerid, WHITE, "Usage /p (show,delete)");
	  
	}
	else
	{
	  if(tag == "show")
	  {
	  	SendClientMessage(playerid,WHITE,"adsadada:");
		}
		
	}
	return 1;
}
Error:
Quote:

error 033: array must be indexed (variable "tag")




Re: [DCMD] Problem - SloProKiller - 25.02.2010

pawn Код:
dcmd_p(playerid, cmdtext[])
{
    new tag[64];
    if(sscanf(cmdtext, "u", tag))
    {
      SendClientMessage(playerid, WHITE, "Usage /p (show,delete)");
     
    }
    else
    {
      if(strval(tag) == "show")
      {
        SendClientMessage(playerid,WHITE,"adsadada:");
        }
       
    }
    return 1;
}



Re: [DCMD] Problem - ErF - 25.02.2010

Quote:

array must be indexed (variable "-unknown-")




Re: [DCMD] Problem - dice7 - 25.02.2010

pawn Код:
dcmd_p(playerid, cmdtext[])
{
    new tag[64];
    if(sscanf(cmdtext, "s", tag))
    {
      SendClientMessage(playerid, WHITE, "Usage /p (show,delete)");
     
    }
    else
    {
      if(strcmp(tag, "show", true) == 0)
      {
        SendClientMessage(playerid,WHITE,"adsadada:");
        }
       
    }
    return 1;
}



Re: [DCMD] Problem - ErF - 25.02.2010

Working, thanks man!


Re: [DCMD] Problem - Niixie - 25.02.2010

You wrote:
Код:
if(sscanf(cmdtext, "u", tag))
the "u" stands for its a playername or playerid, if you replace with an s its a string. i or d if its a interger.


Re: [DCMD] Problem - ErF - 25.02.2010

I know I made a mistake on. Thanks for the help