How to script this type of command?
#1

How would I go about scripting a /loan command. So if you're at a certain area, and type /loan [Player ID] [Amount]
Then obviously you would loan a person a certain amount of cash. So if I did /loan 1 500 For example, the other player would have to type /take loan and when they do, they get the money and a Message saying "If you do not pay back the money, you will be fined and jailed"

Thanks for your help. :P I have very basic scripting knowledge, so I would appreciate some advice.
Reply
#2

I may not contribute much help to this, but bascially you can take a simple /pay command and have the other player /take loan.
I found this /pay command from another topic. Credits goes to SmiT.
pawn Код:
CMD:pay(playerid, params[])
{
    new P_NAME[ MAX_PLAYER_NAME ], T_NAME[ MAX_PLAYER_NAME ], sZ[ 128 ];
    if( sscanf ( params, "ui", params[ 0 ], params[ 1 ] ) ) return SendClientMessage( playerid -1, #Syntax /pay name ammount );
    if( params[ 0 ] == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, #Player offline );
    if( params[ 1 ] > GetPlayerMoney ( playerid ) ) return SendClientMessage( playerid, -1, #Invalid ammount );
    GetPlayerName( playerid, P_NAME, MAX_PLAYER_NAME ); GetPlayerName( params[ 0 ], T_NAME, MAX_PLAYER_NAME );
    format( sZ, sizeof ( sZ ), "You have received $%d from %s ", params[ 1 ], P_NAME );
    SendClientMessage( params[ 0 ], sZ );
    format( sZ, sizeof ( sZ ), "You have payed $%d to %s ", params[ 1 ], T_NAME );
    SendClientMessage( playerid, sZ );
    GivePlayerMoney ( playerid, - params[ 1 ] );
    GivePlayerMoney ( params[ 0 ], params[ 1 ] );
    return true;
}
Then use
pawn Код:
SendClientMessage (playerid, 0xFFFFFFFF, "If you do not pay back the money, you will be fined and jailed");
On the /take loan, I'm not that advanced for that. But just to get this topic started I wanted to contribute that ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)