Need help with command!
#1

Greetings, I have made command transfer money and when someone uses /transfer he get dialogs thats all good but if the player types card number of a player and if that card number isnt right he will get message player not connected etc.. and if he tries to again use command /transfer dialog wont show.

Here is the code


Код:
if(!strcmp(cmdtext, "/posaljinovac"))
	 {
	    if(PlayerInfo[playerid][CardOwner]==0) return SendClientMessage(playerid,COLOR_RED,"Nemas bankovni racun,mozes ga otvoriti u banci za 500$!");
	    else if(IsPlayerInRangeOfPoint(playerid, 3.0, 1401.0518,1319.4008,1501.0859))
	    {
	    	if(PlayerInfo[playerid][CardOwner]==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;
	}


OnDialogRespons

new transferplayer;//this will store the playerid's wich has the inserted card number
  	if(dialogid==12)
  {
	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
		 }
	  }
    }
  }
Reply
#2

cmon anyone? BUMP
Reply
#3

Try resetting these after the command has been executed:

tShow[playerid]=1;

and

OK=0;

If these are not reset after you type the command, the second time the script will bug out and behave in a way that you don't want it to.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)