Help [+REP]
#1

Can someone help me fix this 1 error?

Код:
CMD:setmoneybank(playerid,params[]) 
{
     if(IsPlayerConnected(playerid))
     {
          if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	  {
	     new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	     if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
	     if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild amount");
	     new player1 = strval(tmp), moneys = strval(tmp2);
	     GivePlayerMoney(player1, 0-moneys);
	     PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]+moneys;
	     format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
	     SendClientMessage(playerid,blue,string);
	     SavePlayer(playerid);
	  }
	  else { // Line 25859
  		 new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
  		 if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
	         if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: Invalid amount");
	         new player1 = strval(tmp), moneys = strval(tmp2);
  		 GivePlayerMoney(player1, 0+moneys);
  		 PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]-moneys;
    		 format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
     		 SendClientMessage(playerid,blue,string);
	 	 SavePlayer(playerid);
	   }
     }
     return 1;
}
Код:
C:\Users\USER\Desktop\grandlarc.pwn(25859) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

pawn Код:
CMD:setmoneybank(playerid,params[])
{
     if(IsPlayerConnected(playerid))
     {
          if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
          if(strval(tmp2) < 0)
      {
         new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
         if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
         if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild amount");
         new player1 = strval(tmp), moneys = strval(tmp2);
         GivePlayerMoney(player1, 0-moneys);
         PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]+moneys;
         format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
         SendClientMessage(playerid,blue,string);
         SavePlayer(playerid);
      }
      else { // Line 25859
         new string[64], tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
         if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setmoneybank [playerid] [amount]");
             if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: Invalid amount");
             new player1 = strval(tmp), moneys = strval(tmp2);
         GivePlayerMoney(player1, 0+moneys);
         PlayerInfo[playerid][bank] = PlayerInfo[playerid][bank]-moneys;
             format(string, sizeof(string), "You have set {00FC00}%s {03E3FC}money to {00FC00}%d", pName(player1), PlayerInfo[playerid][bank]);
             SendClientMessage(playerid,blue,string);
         SavePlayer(playerid);
       }
     }
     return 1;
}
Reply
#3

Use sscanf
Reply
#4

It's solved anyway, +rep for both
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)