Raised This Month: $32 Target: $400
 8% 

[HELP] MVP not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 08-23-2017 , 10:43   [HELP] MVP not working
Reply With Quote #1

Can't get Kia's MVP plugin to work, please help.
Using 1.8.3 amxx.
Using colorchat.inc because Im used to it

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta_util>
#include <csgo>
#include <csx>
#include <colorchat>

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

// ===============================================================================
//  Variables
// ===============================================================================

/* Defines */

#define NO_BOMB_PLANTED 9191
#define NO_BOMB_DEFUSED 1919

#define CHECK_DELAY 0.5

/* Integers */

new g_iEnemiesKilled[33]
new 
g_iHostagesRescued[33]

new 
g_iBombPlanter
new g_iBombDefuser

/* Boolean */

new bool:g_bBombExploded
new bool:g_bAllHostagesRescued

// ===============================================================================
//  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("TextMsg""Event_AllHostagesRescued""a""2&#All_Hostages_R");
    
    
register_logevent("Event_HostageRescued"3"2=Rescued_A_Hostage"
    
    
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
    g_bAllHostagesRescued 
false
    
    arrayset
(g_iEnemiesKilled0sizeof(g_iEnemiesKilled))
    
arrayset(g_iHostagesRescuedsizeof(g_iHostagesRescued))
}

// ===============================================================================
//  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 == false)
    {
        new 
iTopKiller GetTopKiller(1)
        
ShowMVPMessage(iTopKiller1)
        
        return 
PLUGIN_HANDLED
    
}
    
    
/*new iTopKiller = GetTopKiller(1)
    ShowMVPMessage(iTopKiller, 1)*/
    
    
return PLUGIN_HANDLED
}

// ===============================================================================
//  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)
        return 
PLUGIN_HANDLED
    
}
    
    if(
g_bAllHostagesRescued)
    {
        new 
iTopRescuer GetTopRescuer()
        
ShowMVPMessage(iTopRescuer4)
        
        return 
PLUGIN_HANDLED
    
}
    
    new 
iTopKiller GetTopKiller(2)
    
ShowMVPMessage(iTopKiller1)
    
    return 
PLUGIN_HANDLED
}

// ===============================================================================
//  Event_AllHostagesRescued - Called when ALL Hostages were rescued
// ===============================================================================

public Event_AllHostagesRescued()
{
    
g_bAllHostagesRescued true
    
    
new iTopRescuer GetTopRescuer()
    
ShowMVPMessage(iTopRescuer4)  
}

// ===============================================================================
//  Event_HostageRescued - Called when ONE Hostage was rescued
// ===============================================================================

public Event_HostageRescued()
{
    static 
szLog[80], szName[32], id
    
    read_logargv
(0szLogcharsmax(szLog))
    
parse_loguser(szLogszNamecharsmax(szName))
    
    
id get_user_index(szName)
    
    
g_iHostagesRescued[id]++
}   

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

public Event_DeathMsg()
    
g_iEnemiesKilled[read_data(1)]++

// ===============================================================================
//  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
    ShowMVPMessage
(g_iBombPlanter3)
}
    
// ===============================================================================
//  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
// ===============================================================================

public 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 if ( g_iEnemiesKilled[elem1] < g_iEnemiesKilled[elem2] )
        return 
1
    
return 0
}

// ===============================================================================
//  GetTopRescuer - Returns the id of the player who rescued the most hostages
// ===============================================================================

public GetTopRescuer() // 1 : Terrorist - 2 : Counter-Terrorists
{
    new 
iPlayers[32], iPlayersnum;
    
    
get_players(iPlayersiPlayersnum"e""CT")
    
SortCustom1D(iPlayersiPlayersnum"SortByHostages")
    
    return 
iPlayers[0]
}

public 
SortByHostages(elem1elem2
{
    if ( 
g_iHostagesRescued[elem1] > g_iHostagesRescued[elem2] )
        return -
1
    
else if ( g_iHostagesRescued[elem1] < g_iHostagesRescued[elem2] )
        return 
1
    
return 0
}

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

public ShowMVPMessage(iMVPiReason// 1 : Kills - 2 : Bomb defused - 3 : Bomb exploded - 4 : Hostage rescued
{
    new 
szMVPName[33]
    
get_user_name(iMVPszMVPNamecharsmax(szMVPName))
    
    switch(
iReason)
    {
        case 
1: { 
            
ColorChat(0GREEN"MVP : %s ^1su daugiausiai nužudymų. ^3 +10 SR."szMVPName)
            
set_user_points(iMVPget_user_points(iMVP) + 10);
        }
        case 
2: {
            
ColorChat(0GREEN"MVP : %s ^1su išminuota c4. ^3 +10 SR."szMVPName)
            
set_user_points(iMVPget_user_points(iMVP) + 10);
        }
        case 
3: { 
            
ColorChat(0GREEN"MVP : %s ^1su užminuota c4. ^3 +10 SR."szMVPName)
            
set_user_points(iMVPget_user_points(iMVP) + 10);
        }
        case 
4: {
            
ColorChat(0GREEN"MVP : %s su išgelbėtais ^4%i ^1įkaitais.^3 +10 SR."szMVPNameg_iHostagesRescued[iMVP])
            
set_user_points(iMVPget_user_points(iMVP) + 10);
        }
    }       
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par }
*/ 
__________________
Airkish is offline
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 07:13.


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