Quick help
#1

So pretty much I wan't it so there is a limit to how much you can deposit into your savings. I wan't it so if you have 50k in your savings account, you can't deposit any more money in. Can anyone help me?
Код:
CMD:sdeposit(playerid, params[])
{
	new amount, string[256];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!IsPlayerNearBankBooth(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a bank booth.");
	if(sscanf(params, "i", amount)) return SendClientMessage(playerid, USAGE, "[Usage]: /sdeposit [amount]");
	if(amount > PlayerInfo[playerid][pMoney]) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you.");
	if(amount <= 0)  return SendClientMessage(playerid, COLOR_GREY, "Invalid money amount.");
//SCROLL OVER//	if(amount <= 0)  return SendClientMessage(playerid, COLOR_GREY, "You cannot deposit any more into your savings account."); // I WANT THIS TO MAKE IT SO IF THERE IS 50k IN MY SAVINGS ACCOUNT, I CANT PUT ANY MORE IN.
	PlayerInfo[playerid][pSavings] += amount;
	GiveDodMoney(playerid, -amount);
	format(string, sizeof(string), " You have deposited $%d into your savings account, your savings balance is now: $%d.", amount, PlayerInfo[playerid][pSavings]);
	SendClientMessage(playerid, COLOR_GREY, string);
	return 1;
}
Reply
#2

try:
pawn Код:
CMD:sdeposit(playerid, params[])
{
    new amount, string[256];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsPlayerNearBankBooth(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not near a bank booth.");
    if(sscanf(params, "i", amount)) return SendClientMessage(playerid, USAGE, "[Usage]: /sdeposit [amount]");
    if(amount > PlayerInfo[playerid][pMoney]) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you.");
    if(amount <= 0)  return SendClientMessage(playerid, COLOR_GREY, "Invalid money amount.");
    if(PlayerInfo[playerid][pSavings]+amount > 50000 || PlayerInfo[playerid][pSavings] >= 50000)  return SendClientMessage(playerid, COLOR_GREY, "You cannot deposit any more into your savings account.");
    PlayerInfo[playerid][pSavings] += amount;
    GiveDodMoney(playerid, -amount);
    format(string, sizeof(string), " You have deposited $%d into your savings account, your savings balance is now: $%d.", amount, PlayerInfo[playerid][pSavings]);
    SendClientMessage(playerid, COLOR_GREY, string);
    return 1;
}
pawn Код:
if(PlayerInfo[playerid][pSavings]+amount > 50000 || PlayerInfo[playerid][pSavings] >= 50000)  return ................
Reply
#3

Works wonders, +REPPED.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)