Raised This Month: $127 Target: $400
 31% 

Compensation [v0.4]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   HamletEagle (26)
EFFx
Veteran Member
Join Date: Feb 2016
Location: [<o>]
Old 10-31-2016 , 15:24   Compensation [v0.4]
Reply With Quote #1

COMPENSATION


First update: 10/31/2016
Last update: 11/23/2016

- Description
This plugin is like CSGO: When you disconnect/suicide, it'll give a compensation with X value (changed by a cvar) to a random enemy player.

- Cvars
compensation_enable 1/0 - Turn on/off this plugin
compensation_first_money <ammount> - The first chance for the money you got.
compensation_second_money <ammount> - The second chance for the money you got.

- Change logs
Spoiler
Attached Files
File Type: sma Get Plugin or Get Source (Compensation.sma - 175 views - 3.4 KB)
File Type: txt compensation.txt (1.2 KB, 67 views)
__________________
PUBG Mod coming soon...

Last edited by EFFx; 10-10-2017 at 16:53.
EFFx is offline
Send a message via Skype™ to EFFx
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-31-2016 , 23:42   Re: Compensation [v0.1]
Reply With Quote #2

See my comments and spoiler below.
PHP Code:
public GiveCompensationiDeadPlayer 

    
//This should be placed on top of Event_DeathMsg and client_disconnect(). This would result in only 1 native call
    //if it was disabled instead of 2 (disconnect) to 4 (deathmsg) the way you have it now. 
    
if ( !get_pcvar_numg_pPluginEnable ) )
        return 
PLUGIN_HANDLED

    
new iPlayers32 ] , iNumPlayers iRandom iMoneyBonus 
    
new szCompensateName32 ] , szDeadName32 ] , iCompensatePlayer 
    
    
//Better off passing the opposite team in get_players(). It will save you multiple cs_get_user_team() native calls.
    //In addition, you can eliminate other condition checking (see below).
    
get_playersiPlayers iNumPlayers "h" 
    
    
//This is not needed since it was my assumption that the money was for iDeadPlayers teammates. This is why
    //it checks for > 1 since there must be a player on his team besides himself. This can be changed to > 0.
    
if ( iNumPlayers 
    {     
        
//This loop is not needed since random() will always get a compensate player. Previously, I thought it was to 
        //compensate teammates so it needed to check randoms until it found one that was != dead player.
        
for ( new iNumPlayers i++ ) 
        { 
            
//With get_players() using opposite team, you can set the player id directly here: iCompensate = ...
            
iRandom iPlayersrandomiNumPlayers ) ] 
            
            
//With get_players() using opposite team, you do not need to check if random != dead player and you do 
            //not need any team checking.
            
if ( ( iRandom != iDeadPlayer ) && ( cs_get_user_teamiRandom ) != cs_get_user_teamiDeadPlayer ) ) )
            { 
                if ( 
HaveAnTeamiRandom ) )
                {
                    
iCompensatePlayer iRandom 
                    
break 
                }
            } 
        } 
        
        
iMoneyBonus get_pcvar_numg_pBonusMoney 
        
        
get_user_nameiCompensatePlayer szCompensateName charsmaxszCompensateName ) ) 
        
get_user_nameiDeadPlayer szDeadName charsmaxszDeadName ) ) 
        
        
cs_set_user_moneyiCompensatePlayer cs_get_user_moneyiCompensatePlayer ) + iMoneyBonus 
        
        for ( new 
iNumPlayers i++ ) 
        { 
            
//With get_players() using opposite team, you do not need any team checking.
            
if ( ( iPlayers] != iCompensatePlayer ) && ( cs_get_user_teamiRandom ) == cs_get_user_team iPlayers] ) ) )
            { 
                
client_print_coloriPlayers] , GREY "%s Your teammate %s was awarded^x04 +$%d^x01 compensation for the suicide of %s" szPrefix szCompensateName iMoneyBonus szDeadName 
            } 
        } 
    } 
    return 
PLUGIN_CONTINUE

Spoiler
__________________

Last edited by Bugsy; 10-31-2016 at 23:50.
Bugsy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: [<o>]
Old 11-01-2016 , 09:50   Re: Compensation [v0.1]
Reply With Quote #3

Plugin Updated.
__________________
PUBG Mod coming soon...

Last edited by EFFx; 11-01-2016 at 09:53.
EFFx is offline
Send a message via Skype™ to EFFx
EFFx
Veteran Member
Join Date: Feb 2016
Location: [<o>]
Old 11-07-2016 , 16:14   Re: Compensation [v0.2]
Reply With Quote #4

Plugin updated:

Spoiler
__________________
PUBG Mod coming soon...

Last edited by EFFx; 11-07-2016 at 16:14.
EFFx is offline
Send a message via Skype™ to EFFx
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 11-07-2016 , 21:00   Re: Compensation [v0.2]
Reply With Quote #5

Quote:
Originally Posted by EFFx View Post
Plugin updated:

Spoiler
Include only chatcolor.inc if amxx is not 1.8.3, with #ifdef directive.
Will avoid my work to remove it and compile on my amxx 1.8.3 for example

Thanks
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar,get_pcvar_num(pCvar) ? 1); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
EFFx
Veteran Member
Join Date: Feb 2016
Location: [<o>]
Old 11-23-2016 , 13:02   Re: Compensation [v0.2]
Reply With Quote #6

Plugin updated, see the spoiler on description for more informations.
__________________
PUBG Mod coming soon...
EFFx is offline
Send a message via Skype™ to EFFx
Craxor
Veteran Member
Join Date: Jan 2016
Location: Europe (ro)
Old 11-24-2016 , 05:27   Re: Compensation [v0.3]
Reply With Quote #7

Sorry man, i do not play CSGO, can you please re-write a better description? When you suicide give to you or to a random players or what?

However nice code, i like it!
Craxor is offline
Send a message via ICQ to Craxor
EFFx
Veteran Member
Join Date: Feb 2016
Location: [<o>]
Old 11-24-2016 , 14:25   Re: Compensation [v0.3]
Reply With Quote #8

Quote:
Originally Posted by Craxor View Post
Sorry man, i do not play CSGO, can you please re-write a better description? When you suicide give to you or to a random players or what?

However nice code, i like it!
When you disconnect or you suicide, a player from enemy team receive an ammount, controlled by cvar.
__________________
PUBG Mod coming soon...
EFFx is offline
Send a message via Skype™ to EFFx
Craxor
Veteran Member
Join Date: Jan 2016
Location: Europe (ro)
Old 11-24-2016 , 15:15   Re: Compensation [v0.3]
Reply With Quote #9

If I voluntary retry more times what's happen?

If I retry 15 times in a min ?

Last edited by Craxor; 11-24-2016 at 15:15.
Craxor is offline
Send a message via ICQ to Craxor
EFFx
Veteran Member
Join Date: Feb 2016
Location: [<o>]
Old 11-24-2016 , 16:26   Re: Compensation [v0.3]
Reply With Quote #10

Like csgo, an enemy will receive the bonus every disconnect. But i dont recommend it for public server, this plugin is good for pug servers. But if you guys want him for public server, who is me for be against?
__________________
PUBG Mod coming soon...

Last edited by EFFx; 11-24-2016 at 16:28.
EFFx is offline
Send a message via Skype™ to EFFx
Reply


Thread Tools
Display Modes

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


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