Raised This Month: $51 Target: $400
 12% 

Bounty Hunter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pendimonium
New Member
Join Date: Nov 2023
Old 02-16-2024 , 16:40   Bounty Hunter
Reply With Quote #1

Greetings guys

I need a plugin for bounties that works like that:

Only Admins with flag "e" (ADMIN_SLAY) can call for a bounty on a player's head with the comand "amx_bounty". Example: amx_bounty NicknamePlayer OR "amx_bounty Player 8500" where 8500 is a custom sum for the bounty. This bounty is valid only for the round it was created in. If the player who's head is on bounty survives the round without being killed he receives $5000 + HE grenade + 100 Armor (NO HELMET). If the marked player is killed during the round his killer will receive $2500 (for body kill) OR $5000 + HE grenade + 100 Armor (NO HELMET) (headshot kill). And a chat message for when awards are given to the player.

Chat text when admin calls for bounty on player's head:
"AdminNick PUT A BOUNTY ON BountyPlayer 's HEAD FOR $5000"

Sound effect when admin calls for bounty on player and also the same sound when the bounty player is killed.

Would be extra nice if the results of every bounty is put in a log file and saved to be able to see statistics for later.

Would this be possible?

Last edited by pendimonium; 02-17-2024 at 06:52.
pendimonium is offline
JuanitoAlimana
Senior Member
Join Date: Aug 2021
Old 02-16-2024 , 22:07   Re: Bounty Hunter
Reply With Quote #2

That's an awesome idea!
JuanitoAlimana is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-18-2024 , 14:24   Re: Bounty Hunter
Reply With Quote #3

Hardly tested and the logging piece needs to be added:

CVars:
bh_adminflags - Admin flag(s) needed to start a bounty
bh_awardmoney - Default award money if no value is specified when bounty is started.
bh_hsbonus - Bonus money awarded for headshot.

PHP Code:

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

new const Version[] = "0.1";

new 
g_iBountyPlayer;
new 
g_iBountyMoney g_pHSBonus;
new 
g_pBountyFlags g_pBountyAward;

public 
plugin_precache()
{
    
precache_sound"/sound/events/task_complete.wav" );
}
    
public 
plugin_init() 
{
    
register_plugin"Bounty Hunter" Version "bugsy" );
    
    
register_logevent"RoundEnd" "1=Round_End" );
    
register_event"DeathMsg" "DeathMsgEvent" "a" );
    
    
g_pBountyFlags register_cvar"bh_adminflags" "e" );
    
g_pBountyAward register_cvar"bh_awardmoney" "3000" );
    
g_pHSBonus register_cvar"bh_hsbonus" "2000" );
    
    
register_concmd"amx_bounty" "BountyCmd" );
}

public 
BountyCmdid )
{
    if ( 
g_iBountyPlayer )
    {
        
console_printid "There is already an active bounty, please wait until the next round or the current bounty ends." );
    }
    else
    {
        new 
szBountyName33 ] , szBountyAmount] , szFlags26 ] , iFlagsNeeded;
        
read_argvszBountyName charsmaxszBountyName ) );
        
read_argvszBountyAmount charsmaxszBountyAmount ) );
        
        
get_pcvar_stringg_pBountyFlags szFlags charsmaxszFlags ) );
        
iFlagsNeeded read_flagsszFlags );
        
        if ( ( 
get_user_flagsid ) & iFlagsNeeded ) == iFlagsNeeded 
        {
            new 
iPlayer cmd_targetid szBountyName );
            
            if ( 
iPlayer )
            {    
                new 
szAdminName33 ];
                
                
get_user_nameid szAdminName charsmaxszAdminName ) );
                
get_user_nameiPlayer szBountyName charsmaxszBountyName ) );
                
                
g_iBountyPlayer iPlayer;
                
g_iBountyMoney = ( szBountyAmount] != EOS && isdigitszBountyAmount] ) ) ? str_to_numszBountyAmount ) : get_pcvar_numg_pBountyAward );
                
                
client_cmd,"spk events/task_complete.wav" );
                
client_printprint_chat "* %s PUT A BOUNTY ON %s's HEAD FOR $%d!" szAdminName szBountyName g_iBountyMoney );
                
console_printid "Bounty created for %s for $%d" szBountyName g_iBountyMoney );
            }
        }
    }
    
    return 
PLUGIN_HANDLED;
}

public 
DeathMsgEvent()
{
    if( 
g_iBountyPlayer )
    {
        new 
iVictim read_data);
        
        if ( 
iVictim == g_iBountyPlayer )
        {
            new 
szKiller33 ] , szBountyName33 ];
            new 
iKiller read_data);
            new 
bool:bIsHeadshot bool:!!read_data);
            new 
iTotalAwardMoney g_iBountyMoney + ( bIsHeadshot get_pcvar_numg_pHSBonus ) : );
            
            
client_cmd,"spk events/task_complete.wav" );
            
            
get_user_nameiKiller szKiller charsmaxszKiller ) );
            
get_user_nameg_iBountyPlayer szBountyName charsmaxszBountyName ) );
            
            
cs_set_user_moneyiKiller clampcs_get_user_moneyiKiller ) + iTotalAwardMoney iTotalAwardMoney 16000 ) , true );
            
            if ( 
bIsHeadshot )
            {
                
give_itemiKiller "weapon_hegrenade" );
                
cs_set_user_armoriKiller clampcs_get_user_armoriKiller ) + 100 100 ) , CS_ARMOR_KEVLAR );
            }
            
            
client_printprint_chat "* %s HAS EXECUTED THE BOUNTY ON %s AND WAS AWARDED $%d!" szKiller szBountyName iTotalAwardMoney );
            
g_iBountyPlayer 0;
        }
    }
}

public 
RoundEnd()
{
    if ( 
g_iBountyPlayer )
    {
        if ( 
is_user_connectedg_iBountyPlayer ) )
        {
            new 
szName33 ];
            
get_user_nameg_iBountyPlayer szName charsmaxszName ) );
            
            
cs_set_user_moneyg_iBountyPlayer clampcs_get_user_moneyg_iBountyPlayer ) + g_iBountyMoney g_iBountyMoney 16000 ), true );
            
give_itemg_iBountyPlayer "weapon_hegrenade" );
            
cs_set_user_armorg_iBountyPlayer clampcs_get_user_armorg_iBountyPlayer ) + 100 100 ) , CS_ARMOR_KEVLAR );
            
            
client_printprint_chat "* %s SURVIVED THE BOUNTY AND WAS AWARDED $%d!" szName g_iBountyMoney );
        }
    }
    
    
g_iBountyPlayer 0;

__________________

Last edited by Bugsy; 02-23-2024 at 10:57.
Bugsy is offline
pendimonium
New Member
Join Date: Nov 2023
Old 02-19-2024 , 13:58   Re: Bounty Hunter
Reply With Quote #4

Sadly it doesn't work. It says amx_bounty is unknown command and it doesn't do anything.
pendimonium is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-19-2024 , 17:19   Re: Bounty Hunter
Reply With Quote #5

Quote:
Originally Posted by pendimonium View Post
Sadly it doesn't work. It says amx_bounty is unknown command and it doesn't do anything.
It was coded using a chat command, not console, which is probably why it did not work for you. The above code was updated to use console instead of chat.
__________________
Bugsy is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 02-19-2024 , 17:19   Re: Bounty Hunter
Reply With Quote #6

It's a say command.
__________________
DJEarthQuake is offline
Reply



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 14:34.


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