SA-MP Forums Archive
Help in my 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: Help in my command (/showthread.php?tid=94173)



Help in my command - RyDeR` - 28.08.2009

Hello I've a little problem in mine command.

Код:
  if(strcmp(cmd, "/setallcash", true) == 0)
  {
    if(Girilmis[playerid] == 0) return Mesaj(playerid, COLOR_RED, "<!> You must login first.");
    	if(Adminlik[playerid] >= 2)
    	{
			for(new i=0; i<GetMaxPlayers(); i++)
			{
		    	tmp = strtok(cmdtext, idx);
		  	if(!strlen(tmp)) return Mesaj(playerid, COLOR_WHITE, "<Usage> /setallcash [amount]");
		  	new Miktar = strval(tmp);
		  	if(Miktar >= 0 && Miktar <= 999999999)
		  	{
			    format(string, sizeof(string), "<> Administrator %s has changed all player money to $%d.", adminisim, Miktar);
			    HerkezeMesaj(COLOR_PURPLE, string);
			    SetPlayerMoney(i, Miktar);
				}
				else
				{
				  Mesaj(playerid, COLOR_RED, "<!> invalid amount.");
				}
				}
		}
		else
		{
 			Mesaj(playerid, COLOR_RED,"<!> You don't have level enough!");
		}
		return 1;
  }
when I type /setallcash 100 oke it will sets all cash to 100$ but It will also display a mesage with: '<Usage> /Setallcash [amount]' but I gived the ammount :S


Re: Help in my command - ded - 28.08.2009

Код:
if(strcmp(cmd, "/setallcash", true) == 0)
  {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return Mesaj(playerid, COLOR_WHITE, "<Usage> /setallcash [amount]");
    if(Girilmis[playerid] == 0) return Mesaj(playerid, COLOR_RED, "<!> You must login first.");
    	if(Adminlik[playerid] >= 2)
    	{
			for(new i=0; i<GetMaxPlayers(); i++)
            {
		  	new Miktar = strval(tmp);
		  	if(Miktar >= 0 && Miktar <= 999999999)
		  	{
			    format(string, sizeof(string), "<> Administrator %s has changed all player money to $%d.", adminisim, Miktar);
			    HerkezeMesaj(COLOR_PURPLE, string);
			    SetPlayerMoney(i, Miktar);
				}
				else
				{
				  Mesaj(playerid, COLOR_RED, "<!> invalid amount.");
				}
				}
		}
		else
		{
 			Mesaj(playerid, COLOR_RED,"<!> You don't have level enough!");
		}
		return 1;
  }
Try that.

Edit: BBC Code tag fucked indentation. -.- You know what to do.