Raised This Month: $ Target: $400
 0% 

Give money to everyone in server


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 04-08-2021 , 10:40   Re: Give money to everyone in server
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
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);
        }
    }


Last edited by HowToRuski; 04-08-2021 at 11:00.
HowToRuski is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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