Quote:
Originally Posted by Napoleon_be
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); } } }
|
I don't get it. it wont work for me. I just edited your code a little bit for my needs. But it wont work :/ It just shows a client_print i added
PHP Code:
/* Sublime AMXX Editor v2.2 */
#include <amxmodx>
#include <cstrike>
#include <zombieplague>
#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 = zp_get_user_ammo_packs(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;
zp_set_user_ammo_packs(id, 0);
client_print(id, print_chat, "You donated all your ammo packs to everyone in server!")
for(new i; i < iNum; i++)
{
iPlayer = iPlayers[i];
zp_set_user_ammo_packs(iPlayer, zp_get_user_ammo_packs(iPlayer) + iEndAmount);
}
}
}