PHP Code:
/* Sublime AMXX Editor v2.2 */
#pragma semicolon 1
#include <amxmodx>
// #include <amxmisc>
#include <cstrike>
// #include <engine>
// #include <fakemeta>
// #include <hamsandwich>
// #include <fun>
// #include <xs>
// #include <sqlx>
#define PLUGIN "DonateMoney in pieces"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32;
#endif
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /donatemoney", "DonateMoney");
}
public DonateMoney(id)
{
new iPlayers[MAX_PLAYERS], iNum;
get_players(iPlayers, iNum, "ch");
new iMoney = cs_get_user_money(id);
new Float:fEndAmount = float(iMoney) / float(iNum);
new iEndAmount = floatround(fEndAmount, floatround_floor); // Round down since you can't donate money you don't own.
if(iMoney > 0)
{
new iPlayer;
cs_set_user_money(id, 0);
for(new i; i < iNum; i++)
{
iPlayer = iPlayers[i];
cs_set_user_money(iPlayer, cs_get_user_money(iPlayer) + iEndAmount);
}
}
}
__________________