Help in my command
#1

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
Reply
#2

Код:
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)