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

Most Valuable Player (MVP) (1.0.3 - 22.03.2014)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-04-2015 , 11:17   Re: Most Valuable Player (MVP) (1.0.3 - 22.03.2014)
Reply With Quote #33

Quote:
Originally Posted by mforce View Post
- code fixes
- removed hostage support
- money bonus for mvp
- kill count in mvp dhud
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <dhudmessage>
#include <csx>

#define PLUGIN "MVP"
#define VERSION "1.0.3"
#define AUTHOR "Kia"

#define MVP_MONEY 1000

new const PREFIX[] = "^4[ProKillers]^1"

#define NO_BOMB_PLANTED 9191
#define NO_BOMB_DEFUSED 1919
#define CHECK_DELAY 0.5


/* Integers */

new g_iEnemiesKilled[33]

new 
g_iBombPlanter
new g_iBombDefuser

/* Boolean */

new bool:g_bBombExploded

// ===============================================================================
//     plugin_init
// ===============================================================================

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
/* Events */
    
    
register_event("HLTV""Event_NewRound""a""1=0""2=0"
    
    
register_event("SendAudio""Event_RoundWon_T" "a""2&%!MRAD_terwin"
    
register_event("SendAudio""Event_RoundWon_CT""a""2&%!MRAD_ctwin")
    
    
register_event("DeathMsg""Event_DeathMsg""a")
}

// ===============================================================================
//     Event_NewRound - Called when a new Round begins
// ===============================================================================

public Event_NewRound()
{
    
g_iBombPlanter NO_BOMB_PLANTED
    g_iBombDefuser 
NO_BOMB_DEFUSED
    
    g_bBombExploded 
false
    
    arrayset
(g_iEnemiesKilled0sizeof(g_iEnemiesKilled))
}

// ===============================================================================
//     Event_RoundWon_T - Called when the Counter-Terrorists when the Round
// ===============================================================================

public Event_RoundWon_T()
{
    
set_task(CHECK_DELAY"CheckTConditions")
}

public 
CheckTConditions()
{
    if(
g_iBombPlanter != NO_BOMB_PLANTED && g_bBombExploded == true)
    {
        
ShowMVPMessage(g_iBombPlanter3)
    }
    else
    {
        new 
iTopKiller GetTopKiller(1)
        
ShowMVPMessage(iTopKiller1)
    }
}

// ===============================================================================
//     Event_RoundWon_CT - Called when the Counter-Terrorists when the Round
// ===============================================================================

public Event_RoundWon_CT()
{
    
set_task(CHECK_DELAY"CheckCTConditions")
}

public 
CheckCTConditions()
{
    if(
g_iBombDefuser != NO_BOMB_DEFUSED)
    {
        
ShowMVPMessage(g_iBombDefuser2)
    }
    else
    {
        new 
iTopKiller GetTopKiller(2)
        
ShowMVPMessage(iTopKiller1)
    }
}

// ===============================================================================
//     Event_DeathMsg - Called when someone dies
// ===============================================================================

public Event_DeathMsg() {
    new 
killer read_data(1)
    new 
victim read_data(2)
    new 
kteam get_user_team(killer)
    new 
vteam get_user_team(victim)
    
    if(
killer != victim && kteam != vteam)
        
g_iEnemiesKilled[killer]++
}

// ===============================================================================
//     bomb_planted - Called when the Bomb was planted
// ===============================================================================

public bomb_planted(iPlanter)
    
g_iBombPlanter iPlanter
    
// ===============================================================================
//      bomb_explode - Called when the Bomb exploded
// ===============================================================================

public bomb_explode(iPlanteriDefuser)
    
g_bBombExploded true
    
// ===============================================================================
//     bomb_defused - Called when the Bomb was defused
// ===============================================================================

public bomb_defused(iDefuser)
    
g_iBombDefuser iDefuser
    
// ===============================================================================
//     GetTopKiller - Returns the id of the player who made the most kills
// ===============================================================================

GetTopKiller(iTeam// 1 : Terrorist - 2 : Counter-Terrorists
{
    new 
iPlayers[32], iPlayersnum;
    
    
get_players(iPlayersiPlayersnum"e"iTeam == "TERRORIST" "CT")
    
SortCustom1D(iPlayersiPlayersnum"SortByKills")
    
    return 
iPlayers[0]
}

public 
SortByKills(elem1elem2
{
    if ( 
g_iEnemiesKilled[elem1] > g_iEnemiesKilled[elem2] )
        return -
1
    
else
        return 
1
    
return 0
}

// ===============================================================================
//     ShowMVPMessage - Shows the Director HUD Message
// ===============================================================================

ShowMVPMessage(iMVPiReason// 1 : Kills - 2 : Bomb defused - 3 : Bomb exploded
{
    new 
szMVPName[32]
    
get_user_name(iMVPszMVPNamecharsmax(szMVPName))
    
    
cs_set_user_money(iMVPcs_get_user_money(iMVP)+MVP_MONEY)
    
ChatColor(iMVP"%s You received^3 %d$^1, because you are the best in this round."PREFIXMVP_MONEY)
    
    
set_dhudmessage(02550, -1.00.1506.012.0)
    
    switch(
iReason)
    {
        case 
1show_dhudmessage(0"MVP : %s for making the most kills (%d) in this round."szMVPNameg_iEnemiesKilled[iMVP])
        case 
2show_dhudmessage(0"MVP : %s for defusing the Bomb."szMVPName)
        case 
3show_dhudmessage(0"MVP : %s for planting the Bomb."szMVPName)
    }        
}

stock ChatColor(const id, const szMessage[], any:...) {
    static 
pnumplayers[32], szMsg[190], IdMsg
    
vformat(szMsgcharsmax(szMsg), szMessage3);
    
    if(!
IdMsgIdMsg get_user_msgid("SayText");
    
    if(
id) {
        if(!
is_user_connected(id)) return;
        
players[0] = id;
        
pnum 1
    } 
    else 
get_players(playerspnum"ch");
    
    for(new 
ipnumi++) {
        
message_begin(MSG_ONEIdMsg, .player players[i]);
        
write_byte(players[i]);
        
write_string(szMsg);
        
message_end();
    }

Neat that someone still looks after my plugin(s).
btw, remove that server in your signature, non-steam advertisment is not allowed.
__________________
Kia 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:51.


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