AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HLP] give money to player(s) (https://forums.alliedmods.net/showthread.php?t=160043)

alonelive 06-24-2011 11:29

[HLP] give money to player(s)
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>


#define PLUGIN_NAME "Bomb Plant/Defuse Money Bonus"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "Locks"

new plantbonus
new boombonus
new defusebonus

public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_event("23","Event_TargetBombed","a","1=17","6=-105","7=17");
    
plantbonus register_cvar("amx_plant_bonus""100")
    
boombonus register_cvar("amx_boom_bonus""100")
    
defusebonus register_cvar("amx_defuse_bonus""200")
}

public 
bomb_planted(id)
{
  
    new 
players[32], num
    get_players
(playersnum)
    new 
player
    
new bonus get_pcvar_num(boombonus)
    for(new 
i;i<num;i++)
    {
        
player=players[i]
        new 
CsTeams:Team cs_get_user_team(player)
        if(
Team == CS_TEAM_T)
        
cs_set_user_money(playercs_get_user_money(player) + bonus)
    
    }
}

public 
Event_TargetBombed(id)
{
  
    new 
players[32], num
    get_players
(playersnum)
    new 
player
    
new bonus get_pcvar_num(plantbonus)
    for(new 
i;i<num;i++)
    {
        
player=players[i]
        new 
CsTeams:Team cs_get_user_team(player)
        if(
Team == CS_TEAM_T)
        
cs_set_user_money(playercs_get_user_money(player) + bonus)
    
    }
}

public 
bomb_defused()
{
  
    new 
players[32], num
    get_players
(playersnum)
    new 
player
    
new bonus get_pcvar_num(defusebonus)
    for(new 
i;i<num;i++)
    {
        
player=players[i]
        new 
CsTeams:Team cs_get_user_team(player)
        if(
Team == CS_TEAM_CT)
        
cs_set_user_money(playercs_get_user_money(player) + bonus)
    
    }


This plugin gives money for the bomb plant \ boom \ defuse events.
How to make money was given to all players in the team?

fysiks 06-24-2011 16:14

Re: [HLP] give money to player(s)
 
Quote:

Originally Posted by alonelive (Post 1495220)
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>


#define PLUGIN_NAME "Bomb Plant/Defuse Money Bonus"
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "Locks"

new plantbonus
new boombonus
new defusebonus

public plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_event("23","Event_TargetBombed","a","1=17","6=-105","7=17");
    
plantbonus register_cvar("amx_plant_bonus""100")
    
boombonus register_cvar("amx_boom_bonus""100")
    
defusebonus register_cvar("amx_defuse_bonus""200")
}

public 
bomb_planted(id)
{
  
    new 
players[32], num
    get_players
(playersnum)
    new 
player
    
new bonus get_pcvar_num(boombonus)
    for(new 
i;i<num;i++)
    {
        
player=players[i]
        new 
CsTeams:Team cs_get_user_team(player)
        if(
Team == CS_TEAM_T)
        
cs_set_user_money(playercs_get_user_money(player) + bonus)
    
    }
}

public 
Event_TargetBombed(id)
{
  
    new 
players[32], num
    get_players
(playersnum)
    new 
player
    
new bonus get_pcvar_num(plantbonus)
    for(new 
i;i<num;i++)
    {
        
player=players[i]
        new 
CsTeams:Team cs_get_user_team(player)
        if(
Team == CS_TEAM_T)
        
cs_set_user_money(playercs_get_user_money(player) + bonus)
    
    }
}

public 
bomb_defused()
{
  
    new 
players[32], num
    get_players
(playersnum)
    new 
player
    
new bonus get_pcvar_num(defusebonus)
    for(new 
i;i<num;i++)
    {
        
player=players[i]
        new 
CsTeams:Team cs_get_user_team(player)
        if(
Team == CS_TEAM_CT)
        
cs_set_user_money(playercs_get_user_money(player) + bonus)
    
    }


This plugin gives money for the bomb plant \ boom \ defuse events.
How to make money was given to all players in the team?

The code already does give money to the whole team. But, bomb_planted() and bomb_defused() are never executed.

DjOptimuS 06-25-2011 02:57

Re: [HLP] give money to player(s)
 
add

#include <csx>

and all should be fine

fysiks 06-25-2011 03:20

Re: [HLP] give money to player(s)
 
Quote:

Originally Posted by DjOptimuS (Post 1495852)
add

#include <csx>

and all should be fine

Oh, I never thought about them being forwards. :|

alonelive 06-25-2011 03:43

Re: [HLP] give money to player(s)
 
and how do I "title" the blocks of plugin?

public
bomb_planted(id) ---> Event_B
ombPlanted(id) ?

fysiks 06-25-2011 03:52

Re: [HLP] give money to player(s)
 
Quote:

Originally Posted by alonelive (Post 1495867)
and how do I "title" the blocks of plugin?

public
bomb_planted(id) ---> Event_B
ombPlanted(id) ?

I didn't realize that those were forwards so you should only need to do what DjOptimuS told you.


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

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