Ive got some errors!
#1

So I followed this https://sampforum.blast.hk/showthread.php?tid=372580&page=2 guide for makeing Bank system and everything was fine until I got to this code
Код:
if(dialogid==23)
  {
	 if(response==0) return SendClientMessage(playerid,COLOR_RED,"Action canceled!");
	 if(response==1)
	 {
		if(!strval(inputtext)) return SendClientMessage(playerid,COLOR_RED,"Invalid ammount of money!");
		else
		{
			new transmoney;
			transmoney=strval(inputtext);//so we get the inserted ammount wich the player wishes to transfer
			if(transmoney>BankInfo[playerid][DepositedMoney]) {SendClientMessage(playerid,COLOR_RED,"You don't have that much money on bank!");tShow[playerid]=0;//the variable that stops the dialogs from overwriting is now 0,because it's like he exited the pickup ;)}//BUT,if his deposited ammount is smaller than the inserted ammount,then he won't be able to transfer money anymore
			else
			{
			   BankInfo[playerid][DepositedMoney]=BankInfo[playerid][DepositedMoney]-transmoney;//first we modify the actual player's deposited ammount
			   new INI:bFile=INI_Open(BankDB(playerid));//we open his file
			   INI_SetTag(bFile,"BankData");//we set the tag
			   INI_WriteInt(bFile,"DepositedMoney",BankInfo[playerid][DepositedMoney]);//we store the new deposited ammount
			   INI_Close(bFile);//we close the file
			   BankInfo[transferplayer][DepositedMoney]=BankInfo[transferplayer][DepositedMoney]+transmoney;//NOW we modify the deposited ammount OF the player that the money has been transfered TO
			   new INI:bFile2=INI_Open(BankDB(transferplayer));//we open HIS DataBase
			   INI_SetTag(bFile2,"BankData");//we set the tag
               INI_WriteInt(bFile2,"DepositedMoney",BankInfo[transferplayer][DepositedMoney]);//we store the new ammount
               INI_Close(bFile2);//and we close his file
               new pName[24],pName2[24];//variables to store the player's name
               GetPlayerName(transferplayer,pName2,sizeof(pName2));
               GetPlayerName(playerid,pName,sizeof(pName));
               new string[256],string2[256];//informative messages
			   format(string,sizeof(string),"Succesfully transfered %d$ to %s!",transmoney,pName2);//we format the message wich will look like "Succesfully transfered 20$ to John"
			   SendClientMessage(playerid,COLOR_GREEN,string);//we inform the player
			   PlayerPlaySound(playerid,1057,0,0,0);
			   format(string2,sizeof(string2),"%s has succesfully transfered you %d$!",pName,transmoney);//again,informative messages
			   SendClientMessage(transferplayer,COLOR_GREEN,string2);
			   PlayerPlaySound(transferplayer,1057,0,0,0);//just a confirmation sound
			   tShow[playerid]=0;//again we make the variable that prevents dialogs from overwriting 0
			}
		}
	}
 }
I think there is some missing brackets or something when I put one more closing bracket on the end it shows me this errors
Код:
C:\Users\Rocky\Desktop\HomeServer\gamemodes\gmm-v1.pwn(1143) : error 029: invalid expression, assumed zero 
and the error is on the second else statment
Reply
#2

Quote:
Originally Posted by baba1234
Посмотреть сообщение
So I followed this https://sampforum.blast.hk/showthread.php?tid=372580&page=2 guide for makeing Bank system and everything was fine until I got to this code
Код:
if(dialogid==23)
  {
	 if(response==0) return SendClientMessage(playerid,COLOR_RED,"Action canceled!");
	 if(response==1)
	 {
		if(!strval(inputtext)) return SendClientMessage(playerid,COLOR_RED,"Invalid ammount of money!");
		else
		{
			new transmoney;
			transmoney=strval(inputtext);//so we get the inserted ammount wich the player wishes to transfer
			if(transmoney>BankInfo[playerid][DepositedMoney]) {SendClientMessage(playerid,COLOR_RED,"You don't have that much money on bank!");tShow[playerid]=0;//the variable that stops the dialogs from overwriting is now 0,because it's like he exited the pickup ;)}//BUT,if his deposited ammount is smaller than the inserted ammount,then he won't be able to transfer money anymore
			else
			{
			   BankInfo[playerid][DepositedMoney]=BankInfo[playerid][DepositedMoney]-transmoney;//first we modify the actual player's deposited ammount
			   new INI:bFile=INI_Open(BankDB(playerid));//we open his file
			   INI_SetTag(bFile,"BankData");//we set the tag
			   INI_WriteInt(bFile,"DepositedMoney",BankInfo[playerid][DepositedMoney]);//we store the new deposited ammount
			   INI_Close(bFile);//we close the file
			   BankInfo[transferplayer][DepositedMoney]=BankInfo[transferplayer][DepositedMoney]+transmoney;//NOW we modify the deposited ammount OF the player that the money has been transfered TO
			   new INI:bFile2=INI_Open(BankDB(transferplayer));//we open HIS DataBase
			   INI_SetTag(bFile2,"BankData");//we set the tag
               INI_WriteInt(bFile2,"DepositedMoney",BankInfo[transferplayer][DepositedMoney]);//we store the new ammount
               INI_Close(bFile2);//and we close his file
               new pName[24],pName2[24];//variables to store the player's name
               GetPlayerName(transferplayer,pName2,sizeof(pName2));
               GetPlayerName(playerid,pName,sizeof(pName));
               new string[256],string2[256];//informative messages
			   format(string,sizeof(string),"Succesfully transfered %d$ to %s!",transmoney,pName2);//we format the message wich will look like "Succesfully transfered 20$ to John"
			   SendClientMessage(playerid,COLOR_GREEN,string);//we inform the player
			   PlayerPlaySound(playerid,1057,0,0,0);
			   format(string2,sizeof(string2),"%s has succesfully transfered you %d$!",pName,transmoney);//again,informative messages
			   SendClientMessage(transferplayer,COLOR_GREEN,string2);
			   PlayerPlaySound(transferplayer,1057,0,0,0);//just a confirmation sound
			   tShow[playerid]=0;//again we make the variable that prevents dialogs from overwriting 0
			}
		}
	}
 }
I think there is some missing brackets or something when I put one more closing bracket on the end it shows me this errors
Код:
C:\Users\Rocky\Desktop\HomeServer\gamemodes\gmm-v1.pwn(1143) : error 029: invalid expression, assumed zero 
and the error is on the second else statment
the bracket is commented so change this line

Код:
	if(transmoney>BankInfo[playerid][DepositedMoney]) {SendClientMessage(playerid,COLOR_RED,"You don't have that much money on bank!");tShow[playerid]=0;//the variable that stops the dialogs from overwriting is now 0,because it's like he exited the pickup ;)}//BUT,if his deposited ammount is smaller than the inserted ammount,then he won't be able to transfer money anymore
to this

Код:
if(transmoney>BankInfo[playerid][DepositedMoney]) { SendClientMessage(playerid,COLOR_RED,"You don't have that much money on bank!");tShow[playerid]=0; }
also, indenting is a little bit off, and try to decrease the amount of comments, or remove them all

i use comments for tiny amounts of info that help me remember things, or to find the part i was scripting at
Reply
#3

Ty didnt see that one
Reply
#4

no worries
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)