AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Give money to everyone in server (https://forums.alliedmods.net/showthread.php?t=331791)

HowToRuski 04-07-2021 14:19

Give money to everyone in server
 
Hello i wanted to ask if someone has a free time, could you help me make a plugin which donates your money to everyone in server? It splits it to everyone...

Napoleon_be 04-07-2021 16:38

Re: Give money to everyone in server
 
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(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /donatemoney""DonateMoney");
}

public 
DonateMoney(id)
{
    new 
iPlayers[MAX_PLAYERS], iNum;
    
get_players(iPlayersiNum"ch"); 

    new 
iMoney cs_get_user_money(id);
    new 
Float:fEndAmount float(iMoney) / float(iNum);
    new 
iEndAmount floatround(fEndAmountfloatround_floor); // Round down since you can't donate money you don't own.

    
if(iMoney 0)
    {
        new 
iPlayer;
        
cs_set_user_money(id0);

        for(new 
iiNumi++)
        {
            
iPlayer iPlayers[i];
            
cs_set_user_money(iPlayercs_get_user_money(iPlayer) + iEndAmount);
        }
    }



HowToRuski 04-08-2021 10:40

Re: Give money to everyone in server
 
Quote:

Originally Posted by Napoleon_be (Post 2743358)
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(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /donatemoney""DonateMoney");
}

public 
DonateMoney(id)
{
    new 
iPlayers[MAX_PLAYERS], iNum;
    
get_players(iPlayersiNum"ch"); 

    new 
iMoney cs_get_user_money(id);
    new 
Float:fEndAmount float(iMoney) / float(iNum);
    new 
iEndAmount floatround(fEndAmountfloatround_floor); // Round down since you can't donate money you don't own.

    
if(iMoney 0)
    {
        new 
iPlayer;
        
cs_set_user_money(id0);

        for(new 
iiNumi++)
        {
            
iPlayer iPlayers[i];
            
cs_set_user_money(iPlayercs_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(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /donatemoney""DonateMoney");
}

public 
DonateMoney(id)
{
    new 
iPlayers[MAX_PLAYERS], iNum;
    
get_players(iPlayersiNum"ch"); 

    new 
iMoney zp_get_user_ammo_packs(id);
    new 
Float:fEndAmount float(iMoney) / float(iNum);
    new 
iEndAmount floatround(fEndAmountfloatround_floor); // Round down since you can't donate money you don't own.

    
if(iMoney 0)
    {
        new 
iPlayer;
        
zp_set_user_ammo_packs(id0);
                
client_print(idprint_chat"You donated all your ammo packs to everyone in server!")

        for(new 
iiNumi++)
        {
            
iPlayer iPlayers[i];
            
zp_set_user_ammo_packs(iPlayerzp_get_user_ammo_packs(iPlayer) + iEndAmount);
        }
    }



Napoleon_be 04-08-2021 19:26

Re: Give money to everyone in server
 
what exactly isn't working? have you tried using my original plugin in the first place?

HowToRuski 04-09-2021 00:02

Re: Give money to everyone in server
 
Quote:

Originally Posted by Napoleon_be (Post 2743469)
what exactly isn't working? have you tried using my original plugin in the first place?

Well im using zombie plague... I edited yours for my needs and as i write /donate nothing happens but my client print just shows

fysiks 04-09-2021 00:25

Re: Give money to everyone in server
 
Quote:

Originally Posted by HowToRuski (Post 2743487)
Well im using zombie plague... I edited yours for my needs and as i write /donate nothing happens but my client print just shows

You should try the original plugin and see if that works if you are unable to debug your own version yourself.


All times are GMT -4. The time now is 19:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.