Jump to content
  • -1

Cum compar inputtext cu o data pentru comanda de deposit


ShaggyShaggy

Question

       if(IsNumeric(inputtext))
    	{
    		if(inputtext[playerid] <= PlayerInfo[playerid][pBani]);  eroare 36
	    	{
   		        PlayerInfo[playerid][pBani] -= inputtext[playerid];
    		    PlayerInfo[playerid][pBaniBanca] += inputtext[playerid];
		        new string[128];
				format(string, sizeof(string), "Ai depozitat %s", inputtext[playerid]);
  				SCM(playerid, galben, string);
    			GivePlayerMoney(playerid, -inputtext[playerid]);
      		}
       		else     eroare 29
      	 	{
		         SCM(playerid, rosu, "EROARE: Nu ai suficienti bani!");
   			}
   		}
    	else
    	{
 	       SCM(playerid, rosu, "EROARE: Trebuie sa introduci doar cifre!");
     	}

Erori: error 036: empty statement
error 029: invalid expression, assumed zero

In cod sunt mai ordonate dar cand le-am bagat aici s-au mutat si sunt strambe, oricum vreau sa stiu doar cum fac acolo cu if(inputtext... 

Edited by ShaggyShaggy
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

Nu poti compara un string cu un numar in felul acesta si in nici un caz nu poti stoca un string intr-o variabila de tip numeric si inputtext nu are playerid, e string are doar index de la 0 la 144(parca) nu stiu exact care e maximum pe care un player il poate scrie intr-un dialog

if(IsNumeric(inputtext))
    	{
            new bani = strval(inputtext);
    		if(bani <= PlayerInfo[playerid][pBani]) 
	    	{
   		        PlayerInfo[playerid][pBani] -= bani;
    		    PlayerInfo[playerid][pBaniBanca] += bani;
		        new string[128];
				format(string, sizeof(string), "Ai depozitat %s", bani);
  				SCM(playerid, galben, string);
    			GivePlayerMoney(playerid, bani);
      		}
       		else    
      	 	{
		         SCM(playerid, rosu, "EROARE: Nu ai suficienti bani!");
   			}
   		}
    	else
    	{
 	       SCM(playerid, rosu, "EROARE: Trebuie sa introduci doar cifre!");
     	}

Si nu pui punct si virgula la un if, niciodata

Edited by Banditul
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.