Atm scripting problem
#1

Hey comm.,

im working on a GF reallife server and i see that many server have atms.
Im not so good at scripting 1-2months.
I know how can i add the object from atm but i dont know how can i make it that you can withdraw deposit etc.


Pls help and answer thx
Reply
#2

Код:
    if(strcmp(cmd, "/atmbank", true) == 0 || strcmp(cmd, "/atmdeposit", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
      if(PlayerToPoint(3.0,playerid,add here ATM position) || and here add more ATM positions
	    {
	      tmp = strtok(cmdtext, idx);
			  if(!strlen(tmp))
			  {
				SendClientMessage(playerid, COLOR_GRAD2, "Scrie : /atmbank [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			  }
			  new cashdeposit = strvalEx(tmp);
			  if(!strlen(tmp))
			  {
				SendClientMessage(playerid, COLOR_GRAD2, "Scrie : /atmbank [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			  }
			  if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
			  {
				SendClientMessage(playerid, COLOR_GRAD2, "  You dont have that much");
				return 1;
			  }
			  GivePlayerMoney(playerid,-cashdeposit);
			  new curfunds = PlayerInfo[playerid][pAccount];
			  PlayerInfo[playerid][pAccount]=cashdeposit+PlayerInfo[playerid][pAccount];
			  SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
			  format(string, sizeof(string), " Old Balance: $%d", curfunds);
			  SendClientMessage(playerid, COLOR_GRAD2, string);
			  format(string, sizeof(string), " Deposit: $%d",cashdeposit);
		    SendClientMessage(playerid, COLOR_GRAD4, string);
			  SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
			  format(string, sizeof(string), " New Balance: $%d", PlayerInfo[playerid][pAccount]);
			  SendClientMessage(playerid, COLOR_WHITE, string);
			  return 1;
	    }
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "  You are not near a ATM !");
	      return 1;
 			}
		}
		return 1;
	}
Код:
	if(strcmp(cmd, "/atmbalance", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
      if(PlayerToPoint(3.0,playerid,add here ATM position) || and here add more ATM positions
	    {
        format(string, sizeof(string), " You Have $%d in your account.",PlayerInfo[playerid][pAccount]);
			  SendClientMessage(playerid, COLOR_YELLOW, string);
	    }
	    else
			{
				SendClientMessage(playerid, COLOR_GREY, "  You are not near a ATM !");
	      return 1;
 			}
		}
		return 1;
	}
Код:
    if(strcmp(cmd, "/atmwithdraw", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
      if(PlayerToPoint(3.0,playerid,add here ATM position) || and here add more ATM positions
	    {
        tmp = strtok(cmdtext, idx);
			  if(!strlen(tmp))
			  {
				SendClientMessage(playerid, COLOR_GRAD2, "Scrie : /atmwithdraw [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			  }
			  new cashdeposit = strvalEx(tmp);
			  if(!strlen(tmp))
		 	  {
				SendClientMessage(playerid, COLOR_GRAD2, "Scrie : /atmwithdraw [amount]");
				format(string, sizeof(string), " You Have $%d in your account.", PlayerInfo[playerid][pAccount]);
				SendClientMessage(playerid, COLOR_GRAD3, string);
				return 1;
			  }
			  if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
			  {
				SendClientMessage(playerid, COLOR_GRAD2, "  You dont have that much !");
				return 1;
			  }
		    ConsumingMoney[playerid] = 1;
			  GivePlayerMoney(playerid,cashdeposit);
			  PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
		    format(string, sizeof(string), " You Have Withdrawn $%d from your account Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
			  SendClientMessage(playerid, COLOR_YELLOW, string);
			  return 1;
	    }
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "  You are not near a ATM !");
	      return 1;
 			}
		}
		return 1;
	}
Код:
if(strcmp(cmd, "/atmtransfer", true) == 0 || strcmp(cmd, "/atmwiretransfer", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(PlayerInfo[playerid][pLevel] < 3)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "  You must be level 3 !");
				return 1;
			}
			if(PlayerToPoint(3.0,playerid,add here ATM position) || and here add more ATM positions
	    {
	      tmp = strtok(cmdtext, idx);
			  if(!strlen(tmp))
			  {
				  SendClientMessage(playerid, COLOR_GRAD1, "Scrie : /atmtransfer [playerid/PartOfName] [amount]");
				  return 1;
			  }
			  giveplayerid = ReturnUser(tmp);
			  tmp = strtok(cmdtext, idx);
			  if(!strlen(tmp))
			  {
				  SendClientMessage(playerid, COLOR_GRAD1, "Scrie : /atmtransfer [playerid/PartOfName] [amount]");
				  return 1;
			  }
			  moneys = strvalEx(tmp);
			  if (IsPlayerConnected(giveplayerid))
			  {
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					 GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					 GetPlayerName(playerid, sendername, sizeof(sendername));
					 playermoney = PlayerInfo[playerid][pAccount] ;
					 if (moneys > 0 && playermoney >= moneys)
					 {
						 PlayerInfo[playerid][pAccount] -= moneys;
						 PlayerInfo[giveplayerid][pAccount] += moneys;
						 format(string, sizeof(string), "  You have transferd $%d to %s's account", moneys, giveplayer,giveplayerid);
					   PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						 SendClientMessage(playerid, COLOR_GRAD1, string);
						 format(string, sizeof(string), "  You have recieved $%d to into your account from %s", moneys, sendername, playerid);
						 SendClientMessage(giveplayerid, COLOR_GRAD1, string);
						 format(string, sizeof(string), "%s transferd $%d to %s", sendername, moneys, giveplayer);
		         if(moneys >= 500000)
						 {
							 ABroadCast(COLOR_YELLOW,string,1);
						 }
						 printf("%s", string);
						 PayLog(string);
						 PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
					 }
					 else
					 {
						 SendClientMessage(playerid, COLOR_GRAD1, "  Invalid transaction amount.");
					 }
			 		}
 				}
			 		else
			 {
			 	format(string, sizeof(string), "  %d acest player nu este activ.", giveplayerid);
			 	SendClientMessage(playerid, COLOR_GRAD1, string);
			 }
      }
		}
		return 1;
	}
Reply
#3

he said me 3errors

Код:
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(8547) : warning 202: number of arguments does not match definition
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(8549) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(8822) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(8904) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(10376) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(10413) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(11040) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(11054) : error 017: undefined symbol "strvalEx"
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(11086) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(11088) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(11119) : error 017: undefined symbol "strvalEx"
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(11171) : error 017: undefined symbol "strvalEx"
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(15878) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(17175) : warning 217: loose indentation
C:\Users\pascal_zocken\Desktop\[BETA 0.7c]\gamemodes\GFF.pwn(17197) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)