Help with this command please? - 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: Help with this command please? (
/showthread.php?tid=291032)
Help with this command please? -
rangerxxll - 18.10.2011
I'm trying to make it, so if a person does /loan then the target they did /loan on would have to "/take loan" In order to receive it. How would I add it to this?
pawn Код:
CMD:loan(playerid, params[])
{
new Target, Amount;
if( !sscanf(params, "ui", Target, Amount) )
{
if( Amount < 5000 ) return SendClientMessage(playerid, -1, "You can only pay a minimum ammount of 5000");
if( Target == INVALID_PLAYER_ID ) return SendClientMessage(playerid, -1, "That person is Offline");
if( Target == playerid ) return SendClientMessage(playerid, -1, "You can not give a loan to yourself!");
if( GetPlayerMoney(playerid) < Amount ) return SendClientMessage(playerid, -1, "You don't have enough cash.");
GivePlayerMoney(playerid, -Amount);
GivePlayerMoney(Target, Amount);
} else return SendClientMessage(playerid, -1, "Usage: /loan [playerid] [amount]");
return 1;
}
Thanks for your help.
Re: Help with this command please? -
Ensconce - 18.10.2011
You need to create a variable like
Then when someone executes /loan, Make LoanBy[target] = playerid.
In the /take command, create a loan parameter then check if LoanBy[playerid] is an actual player.
To make it more secure you could also add a LoanTo[MAX_PLAYERS], then when someone offers a Loan, make the LoanTo of that player to the person he offered a loan to. Then check whether the Loan was issued by a player to a player by using LoanTo[LoanBy[playerid]] = playerid in the /loan take command.