Bank System problem?
#1

When player type transfer first time he will get the dialog and he need to input the 2nd player card number to transfer
money but if he puts wrong card number he will get the message that he entered invalid player card number or the player is disconnected. The problem is that when he tries to type transfer again the dialog wont show up why?

And one more thing.. When I restart my server and if the player wants to see his credit car number it will say he doesnt have one.

TRANSFER:
Код:
new transferplayer;//this will store the playerid's wich has the inserted card number
  	if(dialogid==13)
  	{
		if(response==0) return SendClientMessage(playerid,COLOR_RED,"Prijenos prekinut!");
		if(response==1)
		{
		  	if(!strval(inputtext)) return SendClientMessage(playerid,COLOR_RED,"Krivi broj racuna!");//again,he can only insert a numeric value in order to avoid bugs/errors
		  	else
	  		{
		 		new cardnum;
		 		cardnum=strval(inputtext);
		 		new OK=0;//this variable will tell us if there's any player with the inserted card number(1 YES,0 NO)
		 		for(new i=0;i<MAX_PLAYERS;i++)//we start the loop
		 		{
			 		if(BankInfo[i][CardNumber]==cardnum)//we check the players cardnumber,if it's the same as the inserted one
			 		{
						transferplayer=i;//if yes,we store his ID,into the variable defined earlier
						OK=1;//we make the OK variable 1(THERE IS SOMEONE with the inserted card)
						break;//we stoop the loop
			 		}
		 		}
		 		if(OK==0) SendClientMessage(playerid,COLOR_RED,"Korisnik nije konektiran ili je broj racuna krivi!");
		 		else
		 		{
		 			ShowPlayerDialog(playerid,DIALOG_TRANSFERM, DIALOG_STYLE_INPUT, ""COL_SPLAVA"Cloud-Banka:"COL_BIJELA"Transfer", "Upisite sumu novca za "COL_SPLAVA"prebacivanje", "Prebaci", "Odustani");//we show the ACTUAL TRANSFER dialog
		 		}
	  		}
    	}
  	}

	if(dialogid==14)
  	{
		if(response==0) return SendClientMessage(playerid,COLOR_RED,"Transfer prekinut!");
		if(response==1)
	 	{
			if(!strval(inputtext)) return SendClientMessage(playerid,COLOR_RED,"Kriva suma novca, pokusajte ponovo!");
			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,"Nemas toliko novca na banci!");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),"Uspjesno prebaceno %d$ novca igracu %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 je uspjesno prebacio %d$ vama!",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

				}
			}
		}
 	}
YCMD:transfer(playerid, params[], help)
{
    if(help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "PRIMJER: /transfer");
    }
    else
    {
        if(PlayerInfo[playerid][pCardOwner]==0) return SendClientMessage(playerid,COLOR_RED,"Nemas bankovni racun,mozes ga otvoriti u banci za 500$!");
	    else if(IsPlayerInRangeOfPoint(playerid, 2.0, 1407.4142, 1319.5991, 1501.0840))
	    {
	    	if(PlayerInfo[playerid][pCardOwner]==1)
			{
		   		if(tShow[playerid]==0)
		   		{
			 		tShow[playerid]=1;
		     		ShowPlayerDialog(playerid,DIALOG_CARDCHECK,DIALOG_STYLE_INPUT,""COL_SPLAVA"Cloud-Banka:"COL_BIJELA"Transfer","Upisite kod kartice igraca:","OK","Cancel");
		   		}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Moras biti u banci!");
		    }
		}
    }
    return 1;
}
CARDINFO
Код:
YCMD:racuninfo(playerid, params[], help)
{
    if(help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "PRIMJER: /racuninfo");
    }
    else
    {
        if(PlayerInfo[playerid][pCardOwner]==0) return SendClientMessage(playerid,COLOR_RED,"Nemas bankovni racun,mozes ga otvoriti u banci za 500$!");
	   	else
		{
			new string[128];
       		format(string,sizeof(string),""COL_SIVA"Vlasnik Racuna:"COL_SPLAVA" %s"COL_SIVA"\nBroj Racuna: "COL_SPLAVA"%d"COL_SIVA"\nPolozeni Novac: "COL_ZELENA"%d",BankInfo[playerid][Owner],BankInfo[playerid][CardNumber],BankInfo[playerid][DepositedMoney]);//we format the string wich will contain the player's bank data
	   		ShowPlayerDialog(playerid,DIALOG_CARDINFO,DIALOG_STYLE_MSGBOX,""COL_SPLAVA"Cloud-Banka:"COL_BIJELA"RacunInfo",string,"Uredu","Odustani");
		}
    }
    return 1;
}
Reply
#2

How are you saving the numbers that are assigned to the cards, that could be to do with the 2nd problem
Reply
#3

I solved second problem I set stock LoadBankInfo under if(fexists) under on player connect where my login system is.. the biggest problem here thats been bothering me is that first problem I cant solve it.
Reply
#4

pawn Код:
if(tShow[playerid]==0)
{
    tShow[playerid]=1;
    ShowPlayerDialog(playerid,DIALOG_CARDCHECK,DIALOG_STYLE_INPUT,""COL_SPLAVA"Cloud-Banka:"COL_BIJELA"Transfer","Upisite kod kartice igraca:","OK","Cancel");
}
It will only show the dialog if tShow for that player is 0. If for any reason such as not responding (ESC) or error returned, the variable is not reset back to 0 in those two dialogs and it will never show the dialog again.
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
if(tShow[playerid]==0)
{
    tShow[playerid]=1;
    ShowPlayerDialog(playerid,DIALOG_CARDCHECK,DIALOG_STYLE_INPUT,""COL_SPLAVA"Cloud-Banka:"COL_BIJELA"Transfer","Upisite kod kartice igraca:","OK","Cancel");
}
It will only show the dialog if tShow for that player is 0. If for any reason such as not responding (ESC) or error returned, the variable is not reset back to 0 in those two dialogs and it will never show the dialog again.
So what should I do. Do I put the code u gave me into both of the dialogs? or what?
Reply
#6

No, I just pointed out the part of code that causes the dialog not being shown the second time. Honestly, I don't see any reason of having that variable at all so you better remove it.
Reply
#7

Oh I see this tShow[playerid]=1; causes the problem in there.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)