Thread: GIVECASH
View Single Post
Old 29/11/2017, 09:27 PM   #4
RageCraftLV
Big Clucker
 
Join Date: Jun 2016
Location: Latvia <3
Posts: 56
Reputation: 4
Default Re: GIVECASH

Code:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	if(!IsPlayerConnected(clickedplayerid)) return SendClientMessage(playerid, -1, "Player not online!");
	if(clickedplayerid == playerid) return SendClientMessage(playerid, -1, "Cannot give money to yourself!");
	Dialog_Show(playerid, GiveMoney, DIALOG_STYLE_INPUT, "Give money", "Please specify how much money you want to give (ID, amount)", "OK", "Cancel");
	SetPVarInt(playerid, "ClickedPlayer", clickedplayerid);
	return 1;
}

Dialog:GiveMoney(playerid, response, listitem, inputtext[])
{
	if(!response) return 1;
	new 
		clickedplayer = GetPVarInt(playerid, "ClickedPlayer"),
		amount;
	if(sscanf(inputtext, "i", amount)) return Dialog_Show(playerid, GiveMoney, DIALOG_STYLE_INPUT, "Give money", "Please specify how much money you want to give", "OK", "Cancel");
	if(amount > GetPlayerMoney(playerid)) return SendClientMessage(playerid, -1, "Not enough money!");
	GivePlayerMoney(playerid, -amount);
	GivePlayerMoney(clickedplayer, amount);
	return 1;
}
This should give you the rough idea. Not tested!
__________________
RageCraftLV is offline   Reply With Quote