Quick help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Quick help (
/showthread.php?tid=552121)
Quick help -
ZachKnoxx - 22.12.2014
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;
}
Re: Quick help -
M4D - 22.12.2014
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 ................
Re: Quick help -
ZachKnoxx - 22.12.2014
Works wonders, +REPPED.