Needing help on a script
#1

hello,
its me yvoms,
I need a little bit of help

i have this code :

Код:
CMD:transfer(playerid,params[])
{
	new string[128],ID,cmdreason;
	if(sscanf(params, "dd", ID, cmdreason))
	{
	    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /transfer (id) (Amount)");
	    return 1;
	}
	if(PlayerInfo[playerid][Spawned] != 1)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
	}
	if(PlayerInfo[playerid][IsKidnapped] == 1)
	{
	    SendClientMessage(playerid,COLOR_ERROR,"You are kidnapped. You cannot use this command.");
	    return 1;
	}
	if(!IsPlayerInDynamicCP(playerid,CP_BankMain) )
	{
	    SendClientMessage(playerid,COLOR_ERROR,"You must be in the bank checkpoint in order to transfer money to someone's account.");
	    return 1;
	}
	if(!IsPlayerConnected(ID))
	{
		format(string,sizeof(string),"The Player ID (%d) is not connected to the server. You cannot tranfer money to them.",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
		return 1;
	}
	if(ID == playerid)
	{
	    SendClientMessage(playerid,COLOR_ERROR,"You cannot transfer funds to your own bank account. Why would you waste my time?");
	    return 1;
	}
	if(BankCash[playerid] < cmdreason)
	{
	    SendClientMessage(playerid,COLOR_ERROR,"You do not have the sufficient funds in your bank account to transfer this amount.");
	    return 1;
	}
	BankCash[ID] +=cmdreason;
	format(string,sizeof(string),"[BANK ACTION] %s(%d) has transfered $%d to your bank account. Your new balance is $%d.",PlayerName(playerid),playerid,cmdreason,BankCash[ID]);
	SendClientMessage(ID,COLOR_LIGHTBLUE,string);

	BankCash[playerid] -=cmdreason;
	format(string,sizeof(string),"Account Holder: %s(%d).\nBranch Location: San Fierro.\nFunds Transfered: $%d.\nTransfered to: %s(%d).\nNew Balance: $%s.",PlayerName(playerid),playerid,cmdreason,PlayerName(ID),ID,BankCash[playerid]);
	ShowPlayerDialog(playerid,DIALOG_BANK_BALANCE,DIALOG_STYLE_MSGBOX,"Bank Balance",string,"Ok","Cancel");
	return 1;
}
Its for transferring money. (scanffd)
But it seems that players are possible to send Negative amounts of money,
Someone help me on this one please
Reply


Messages In This Thread
Needing help on a script - by yvoms - 13.04.2012, 21:48
Re: Needing help on a script - by yvoms - 13.04.2012, 22:21
Re: Needing help on a script - by iggy1 - 13.04.2012, 22:24
Re: Needing help on a script - by yvoms - 13.04.2012, 23:10
Re: Needing help on a script - by ReneG - 13.04.2012, 23:15
Re: Needing help on a script - by yvoms - 14.04.2012, 00:17
Re: Needing help on a script - by yvoms - 14.04.2012, 10:08

Forum Jump:


Users browsing this thread: 1 Guest(s)