Needing help on a script
#6

so it would be like this?

Код:
CMD:transfer(playerid,params[])
{
	new string[128],ID,cmdreason;
	if(sscanf(params, "ud", 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;
	}
	if(cmdreason < 0) // If the money the player typed is less than Zero.
	{
    // Then it sends them a message and stops processing the command.
    SendClientMessage(playerid, -1, "You cannot give negative amounts.");
    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;
}
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)