SA-MP Forums Archive
what's wrong with this CMD ? - 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: what's wrong with this CMD ? (/showthread.php?tid=385626)



what's wrong with this CMD ? - Amine_Mejrhirrou - 16.10.2012

looks like this cmd don't alwas work in game! sometime even if the player have money server send the msg that he don't have founds
Код:
CMD:withdraw(playerid, params[])
{
	new amount,str[128];
	new PlayerName[24];
	if(!IsPlayerInRangeOfPoint(playerid, 10, 2657.0344, 712.1418, 17.0300)) return SendClientMessage(playerid, 0xFF0000AA, "You must be at Dealers Market to withdraw your cash!");
	if (sscanf(params, "d", amount)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /withdraw [amount]");
	if (amount < 0) return SendClientMessage(playerid, 0xFF0000AA, "you can't withdraw a negative amount");
	if (amount < dini_Int(file, "BANK") )
	{
		GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
		format(file, 128, USER_FILE, PlayerName);
 		dini_IntSet(file, "BANK", dini_Int(file, "BANK")-amount);
        GivePlayerMoney(playerid,(amount-(amount/10)));
        format(str, sizeof(str), "  You have withdraw $%d in your bank account(taxes $%d $), you have $%d in your account", amount,amount/10, dini_Int(file, "BANK"));
        SendClientMessage(playerid, 0x00FF00AA, str);
	}else return SendClientMessage(playerid, 0xFF0000AA, "You don't have that amount in bank");
	return 1;
}



Re: what's wrong with this CMD ? - HuSs3n - 16.10.2012

try changing
if (amount < dini_Int(file, "BANK") )

to

if (amount <= dini_Int(file, "BANK") )


Re : what's wrong with this CMD ? - Amine_Mejrhirrou - 16.10.2012

that wont change a lot (only 1$ diference)