Help with loan
#1

Ok well how would I make it to where if a player loans $50,000 then he cant get more and if he tries it will say
" You have all ready borrowed the max limit" or something like that. also I need a command so players can pay back money.

heres what I have so far
Code:
 	if(strcmp(cmd, "/loan", true) == 0)	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(PlayerToPoint(5.0,playerid,BankPosition[X],BankPosition[Y],BankPosition[Z]))
	    {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /loan [amount]");
					return 1;
				}
				new cashdeposit = strval(tmp);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "USAGE: /loan [amount]");
					return 1;
				}
	 		  if(PlayerInfo[playerid][pLevel] < 5)
	    	{
	   	 	  SendClientMessage(playerid, COLOR_LIGHTRED, " You are not high enough level, must be level 5.");
	    	  return 1;
	    	}
				if(PlayerInfo[playerid][pBank] >= cashdeposit)
    		{
					GivePlayerCash(playerid,cashdeposit);
					PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank];
					format(string, sizeof(string), "[INFO:] You have loaned $%d",PlayerInfo[playerid][pBank]);
					SendClientMessage(playerid, COLOR_WHITE, string);
                   PlayerActionMessage(playerid,15.0,"recieves a package full of money from the bank clerk.");
                    OnPlayerDataSave(playerid);
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't all ready borrowed up to $50000!");
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not at the bank!");
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)