Invalid ATM ID!! HELP
#1

hello i been trying my hard to fix this bug i type createatm it works fine but when i want to move it or something it keeps saying Invalid ATM ID even tho the ATM ID is 1 there are few commands you might want to look i can not fix this


Код:

CMD:atm(playerid, params[])
{
	    new string [128];
	    new sendername[ MAX_PLAYER_NAME ];
	    GetPlayerName(playerid, sendername, sizeof(sendername));
    	for(new i = 0; i < sizeof(ATMInfo); i++)
		{
			if(IsPlayerInRangeOfPoint(playerid, 2, ATMInfo[i][ATMX], ATMInfo[i][ATMY], ATMInfo[i][ATMZ]))
 			{
				if(!(PlayerInfo[playerid][pATMcard] == 1)) return SendClientMessage(playerid,COLOR_GREY,"   You don't have a ATM Card - Get One from any Bank");
				{
				if(ATMInfo[i][ATMLocked] == 0)
				{
					PlayerInfo[playerid][ATMID] = i;
					format(string,sizeof(string),"Los Santos ATM\nYou have a total of $%d in your Bank account\nType below the amount of money you want to withdraw:", PlayerInfo[playerid][pAccount]);
		    		ShowPlayerDialog(playerid,59,DIALOG_STYLE_INPUT,"Los Santos ATM",string,"Withdraw","Cancel");
		    		format(string, sizeof(string), "* %s presses a button and checks their balance.", GetPlayerName(playerid));
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				else
				{
					GameTextForPlayer(playerid, "~r~ATM is unavailable!", 1000, 5);
				}
			}
		}
		
	}
	return 0;
}


CMD:createatm(playerid, params[])
{
	new Usage[128], string[128], locked[128];
	if( sscanf( params, "s", Usage))
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createatm [name]" );
			SendClientMessage(playerid, COLOR_GREY, "Available Names: Exterior and Complete" );
		}
	}
	else
	{
	    if(PlayerInfo[playerid][pAdmin] >= 4)
	    {
    		if(strcmp(Usage, "exterior", true) == 0)
	    	{
				PlayerInfo[playerid][ATMExterior]++;
    			GetPlayerPos( playerid, PlayerInfo[playerid][dExtX], PlayerInfo[playerid][dExtY], PlayerInfo[playerid][dExtZ]);
    			GetPlayerFacingAngle(playerid, PlayerInfo[playerid][dAngle]);
     			format( string, sizeof( string ), "Exterior set! (X: %f, Y: %f, Z: %f, A: %f).", PlayerInfo[playerid][dExtX], PlayerInfo[playerid][dExtY], PlayerInfo[playerid][dExtZ], PlayerInfo[playerid][dAngle]);
      			SendClientMessage( playerid, COLOR_WHITE, string);
   			}
       		if(strcmp(Usage, "complete", true) == 0)
       		{
       			if(PlayerInfo[playerid][ATMExterior] > 0)
        		{
       	 			new NewATMID = SpawnedATM+1;
          			if(NewATMID >= MAX_ATM)
           			{
            			SendClientMessage( playerid, COLOR_WHITE, "Too many ATMs are currently spawned!");
             		}
             		format( string, sizeof( string ), "ATMs/ATM_%d.ini", NewATMID);
             		if(dini_Exists(string))
             		{
						SpawnedATM++;
         		    	format( string, sizeof( string ), "ATM (ID: %d) already exist!", NewATMID);
           	    		SendClientMessage( playerid, COLOR_GREY, string);
         		    	SendClientMessage( playerid, COLOR_YELLOW, "Please try again by typing /createatm complete" );
              		}
          	    	else
      	        	{
						ATMInfo[NewATMID][ATMX] = PlayerInfo[playerid][dExtX];
						ATMInfo[NewATMID][ATMY] = PlayerInfo[playerid][dExtY];
						ATMInfo[NewATMID][ATMZ] = PlayerInfo[playerid][dExtZ];
						ATMInfo[NewATMID][ATMAngle] = PlayerInfo[playerid][dAngle];
						ATMInfo[NewATMID][ATMLocked] = 1;
						ATMInfo[NewATMID][ATMCash] = 500000;
						ATMInfo[NewATMID][ATMFee] = 10;
						dini_Create(string);
						dini_IntSet( string, "Cash", ATMInfo[NewATMID][ATMCash]);
		            	dini_IntSet( string, "Fee", ATMInfo[NewATMID][ATMFee]);
		            	dini_IntSet( string, "Locked", ATMInfo[NewATMID][ATMLocked]);
           				dini_FloatSet( string, "X", ATMInfo[NewATMID][ATMX]);
		            	dini_FloatSet( string, "Y", ATMInfo[NewATMID][ATMY]);
		            	dini_FloatSet( string, "Z", ATMInfo[NewATMID][ATMZ]);
		            	dini_FloatSet( string, "Angle", ATMInfo[NewATMID][ATMAngle]);
            			PlayerInfo[playerid][ATMExterior]--;
            			SpawnedATM++;
            			if(ATMInfo[NewATMID][ATMLocked] == 0)
						{
			    			locked = "Yes";
						}
						else
						{
							locked = "No";
						}
						ATMInfo[NewATMID][ATMObjectID] = CreateDynamicObject(2942, ATMInfo[NewATMID][ATMX], ATMInfo[NewATMID][ATMY], ATMInfo[NewATMID][ATMZ]-0.5, 0, 0, ATMInfo[NewATMID][ATMAngle],0,0,-1,250);
            			format(string, sizeof(string), "{01FCFF}[ATM]{F0CC00}\nTotal Cash: $%d\nPercent Fee: %d\nAvailable: %s\nID: %d", ATMInfo[NewATMID][ATMCash], ATMInfo[NewATMID][ATMFee],locked, NewATMID);
						atm[NewATMID] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, ATMInfo[NewATMID][ATMX], ATMInfo[NewATMID][ATMY], ATMInfo[NewATMID][ATMZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
   						SendClientMessage( playerid, COLOR_LIGHTBLUE, "Successfully created ATM!" );
      					format(string, sizeof( string ), "Please now proceed to use /atmfee, /lockatm and /atmcash to setup ATM (ID: %d).", NewATMID);
        				SendClientMessage(playerid, COLOR_WHITE, string);
    				}
              	}
		  	}
        }
        else
		{
			SendClientMessage( playerid, COLOR_GREY, "You are not authorized to use this command!" );
		}
	}
	return 1;
}
CMD:atmcard(playerid, params[])
{

	if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] != 8)
    		{
	            SendClientMessage(playerid, COLOR_GREY, "   You are not at the bank!");
	            return 1;
	        }
			SendClientMessage(playerid,COLOR_WHITE,"You Have sent a Request to get an ATM Card - It will be Accepted in Few");
			PlayerInfo[playerid][pATMcard] = 1;
			return 1;
}
CMD:moveatm(playerid, params[])
{
	new id, string[128], locked[128];
	if( sscanf( params, "d", id) )
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
		    SendClientMessage( playerid, COLOR_WHITE, "USAGE: /moveatm [atmid]" );
		}
	}
	else
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
	        format( string, sizeof( string ), "ATMs/ATM_%d.ini", id);
        	if(!dini_Exists(string))
        	{
    	    	SendClientMessage( playerid, COLOR_GREY, "Invalid ATM ID!" );
         		return 1;
        	}
        	else
        	{
     	    	GetPlayerPos( playerid, ATMInfo[id][ATMX], ATMInfo[id][ATMZ], ATMInfo[id][ATMZ]);
     	    	GetPlayerFacingAngle(playerid, ATMInfo[id][ATMAngle]);
      	    	if(ATMInfo[id][ATMLocked] == 0)
				{
				    locked = "Yes";
				}
				else
				{
					locked = "No";
				}
				DestroyDynamicObject(ATMInfo[id][ATMObjectID]);
    			DestroyDynamic3DTextLabel(atm[id]);
			    ATMInfo[id][ATMObjectID] = CreateDynamicObject(2942, ATMInfo[id][ATMX], ATMInfo[id][ATMY], ATMInfo[id][ATMZ]-0.5, 0, 0, ATMInfo[id][ATMAngle],0,0,-1,250);
				format(string, sizeof(string), "{01FCFF}[ATM]{F0CC00}\nTotal Cash: $%d\nPercent Fee: %d\nAvailable: %s\nID: %d", ATMInfo[id][ATMCash], ATMInfo[id][ATMFee],locked, id);
				atm[id] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, ATMInfo[id][ATMX], ATMInfo[id][ATMY], ATMInfo[id][ATMZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
				SendClientMessage( playerid, COLOR_WHITE, "ATM moved!");
				SaveATM(id);
  			}
      	}
	}
	return 1;
}
CMD:atmcash(playerid, params[])
	{
	new cash, id, string[128], locked[128];
	if( sscanf( params, "dd", id, cash) )
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
		    SendClientMessage( playerid, COLOR_WHITE, "USAGE: /atmcash [atmid] [cash]" );
		}
	}
	else
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
            if(ATMInfo[id][ATMLocked] == 0)
			{
				locked = "Yes";
			}
			else
			{
				locked = "No";
			}
	        format( string, sizeof( string ), "ATMs/ATM_%d.ini", id);
        	if(!dini_Exists( string) )
        	{
        	    SendClientMessage( playerid, COLOR_GREY, "Invalid ATM ID!" );
            	return 1;
        	}
        	else
        	{
        	    ATMInfo[id][ATMCash] = cash;
				format(string, sizeof(string), "{01FCFF}[ATM]{F0CC00}\nTotal Cash: $%d\nPercent Fee: %d\nAvailable: %s\nID: %d", ATMInfo[id][ATMCash], ATMInfo[id][ATMFee],locked, id);
				UpdateDynamic3DTextLabelText(atm[id], COLOR_DCHAT, string);
        	    format( string, sizeof( string ), "You have set the ATM (ID: %d) cash to $%d.", id, cash);
        	    SendClientMessage( playerid, COLOR_WHITE, string);
        	    SaveATM(id);
        	}
		}
	}
	return 1;
}
CMD:atmfee(playerid, params[])
	{
	new fee, id, string[128], locked[128];
	if( sscanf( params, "dd", id, fee) )
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
		    SendClientMessage( playerid, COLOR_WHITE, "USAGE: /atmfee [atmid] [percentfee]" );
		}
	}
	else
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
            if(ATMInfo[id][ATMLocked] == 0)
			{
				locked = "Yes";
			}
			else
			{
				locked = "No";
			}
	        format( string, sizeof( string ), "ATMs/ATM_%d.ini", id);
        	if(!dini_Exists( string) )
        	{
        	    SendClientMessage( playerid, COLOR_GREY, "Invalid ATM ID!" );
            	return 1;
        	}
        	else
        	{
        	    ATMInfo[id][ATMFee] = fee;
				format(string, sizeof(string), "{01FCFF}[ATM]{F0CC00}\nTotal Cash: $%d\nPercent Fee: %d\nAvailable: %s\nID: %d", ATMInfo[id][ATMCash], ATMInfo[id][ATMFee],locked, id);
				UpdateDynamic3DTextLabelText(atm[id], COLOR_DCHAT, string);
        	    format( string, sizeof( string ), "You have set the ATM (ID: %d) percent fee to %d.", id, fee);
        	    SendClientMessage( playerid, COLOR_WHITE, string);
        	    SaveATM(id);
        	}
		}
	}
	return 1;
}
CMD:lockatm(playerid, params[])
{
	new id, string[128], locked[128];
	if( sscanf( params, "d", id) )
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4 )
	    {
		    SendClientMessage( playerid, COLOR_WHITE, "USAGE: /lockatm [atmid]" );
		}
	}
	else
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
	        format( string, sizeof( string ), "ATMs/ATM_%d.ini", id);
        	if(!dini_Exists( string) )
        	{
        	    SendClientMessage( playerid, COLOR_GREY, "Invalid ATM ID!" );
            	return 1;
        	}
        	if(ATMInfo[id][ATMLocked] == 1)
   			{
	        	ATMInfo[id][ATMLocked] = 0;
	        	if(ATMInfo[id][ATMLocked] == 0)
				{
				    locked = "Yes";
				}
				else
				{
					locked = "No";
				}
				format(string, sizeof(string), "{01FCFF}[ATM]{F0CC00}\nTotal Cash: $%d\nPercent Fee: %d\nAvailable: %s\nID: %d", ATMInfo[id][ATMCash], ATMInfo[id][ATMFee],locked, id);
				UpdateDynamic3DTextLabelText(atm[id], COLOR_DCHAT, string);
	        	GameTextForPlayer(playerid, "~g~ATM is now available to withdraw money!", 1000, 5);
	        	format( string, sizeof( string ), "You have set ATM (ID: %d) available to withdraw money.", id);
        	    SendClientMessage( playerid, COLOR_WHITE, string);
        	    SaveATM(id);
	    	}
	    	else
	    	{
	        	ATMInfo[id][ATMLocked] = 1;
	        	if(ATMInfo[id][ATMLocked] == 0)
				{
				    locked = "Yes";
				}
				else
				{
					locked = "No";
				}
				format(string, sizeof(string), "{01FCFF}[ATM]{F0CC00}\nTotal Cash: $%d\nPercent Fee: %d\nAvailable: %s\nID: %d", ATMInfo[id][ATMCash], ATMInfo[id][ATMFee],locked, id);
				UpdateDynamic3DTextLabelText(atm[id], COLOR_DCHAT, string);
	        	GameTextForPlayer(playerid, "~g~ATM is now unavailable to withdraw money!", 1000, 5);
	        	format( string, sizeof( string ), "You have set ATM (ID: %d) unavailable to withdraw money.", id);
        	    SendClientMessage( playerid, COLOR_WHITE, string);
        	    SaveATM(id);
	    	}
		}
	}
	return 1;
}
CMD:deleteatm(playerid, params[])
{
	new id, string[128], FileName[128];
	if( sscanf( params, "d", id) )
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
		    SendClientMessage( playerid, COLOR_WHITE, "USAGE: /deleteatm [atmid]" );
		}
	}
	else
	{
	    if( PlayerInfo[playerid][pAdmin] >= 4)
	    {
	        format( string, sizeof( string ), "ATMs/ATM_%d.ini", id);
        	if(!fexist( string) )
        	{
        	    SendClientMessage( playerid, COLOR_GREY, "Invalid ATM ID!" );
            	return 1;
        	}
        	else
        	{
				ATMInfo[id][ATMX] = 0;
				ATMInfo[id][ATMY] = 0;
				ATMInfo[id][ATMZ] = 0;
				ATMInfo[id][ATMAngle] = 0;
    			DestroyDynamicObject(ATMInfo[id][ATMObjectID]);
    			DestroyDynamic3DTextLabel(atm[id]);
				format(string, sizeof(string), "You have delete the ATM (ID: %d).", id);
   				SendClientMessage( playerid, COLOR_WHITE, string);
   	    		format(FileName, sizeof(FileName), "ATMs/ATM_%d.ini", id);
    	    	dini_Remove(FileName);
    	    	SpawnedATM--;
        	}
		}
	}
	return 1;
}
Reply
#2

Yes becouse you need to break the loop as it finds a result so just put like
pawn Код:
return 1;
At the end if the found/closes ATM location
Reply
#3

on what command i put this mate
Reply
#4

I'm on my phone I can't copy the whole thing, well I can but its long.

Look where u have your IsPlayerInRangeOf
before the closing bracket of that if statement and before the else statment try puting return 1;

The ATM cmd
Reply
#5

okay i think i done it testing will reply if not fixed ino u cant to much put if i do it wrong would be helpful for someone else to do it for me due to you on your phone thanks for telling me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)