Raised This Month: $ Target: $400
 0% 

AMXModX 1.8.3 FATAL ERROR, HELP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hembi
Member
Join Date: Mar 2013
Location: Hungary
Old 11-18-2014 , 17:34   AMXModX 1.8.3 FATAL ERROR, HELP
Reply With Quote #1

Hy!
No one helped me, unfortunately I have to create a new thread in, but I hope does not conflict with the rules.

So, I and other people got a problem:
Code:
[AMXX] Run time error 3: stack error
SZ_GetSpace: overflow on MessageBegin/End
SZ_GetSpace: overflow on MessageBegin/End
SZ_GetSpace: overflow on MessageBegin/End
SZ_GetSpace: overflow on MessageBegin/End
SZ_GetSpace: overflow on MessageBegin/End
SZ_GetSpace: overflow on MessageBegin/End
SZ_GetSpace: overflow on MessageBegin/End
FATAL ERROR (shutting down): MESSAGE_END called, but message buffer from .dll had overflowed

Threads and Replies:

https://forums.alliedmods.net/showthread.php?t=247167
https://forums.alliedmods.net/showpo...&postcount=693
https://forums.alliedmods.net/showpo...&postcount=492
https://forums.alliedmods.net/showthread.php?t=250714


I have installed AMXModX 1.8.3, with AMXModX 1.8.2 I don't got this error, all plugins working good.

I think this is a bug in the new AMXX version, but it may be that the plugins should be updated, but I do not understand why no one will help to me.
Hembi is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-18-2014 , 17:45   Re: AMXModX 1.8.3 FATAL ERROR, HELP
Reply With Quote #2

Try to modify the params directly instead of superceding hook and throwing show_menu again.

You should avoid to that in such hook anyway, calling a native which sends a message while you're hooking this same message, this is prone to issue (meaning you are in an infinite loop). Hard to believe it doesn't happen with 1.8.2.
__________________

Last edited by Arkshine; 11-19-2014 at 07:35.
Arkshine is offline
Unban
Junior Member
Join Date: Jul 2011
Location: Lithuania
Old 11-29-2014 , 15:35   Re: AMXModX 1.8.3 FATAL ERROR, HELP
Reply With Quote #3

I have the same problem, 1.8.2 amxmodx everything works perfectly without any errors. But when i upgrade to the 1.8.3 amxmodx, server every map crash. (in 5-25 min.)

Quote:
[AMXX] Run time error 3: stack error SZ_GetSpace: overflow on MessageBegin/End SZ_GetSpace: overflow on MessageBegin/End SZ_GetSpace: overflow on MessageBegin/End SZ_GetSpace: overflow on MessageBegin/End SZ_GetSpace: overflow on MessageBegin/End SZ_GetSpace: overflow on MessageBegin/End SZ_GetSpace: overflow on MessageBegin/End FATAL ERROR (shutting down): MESSAGE_END called, but message buffer from .dll had overflowed
Plugin:

PHP Code:
#pragma tabsize 0

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <xpsys>

#define is_user_valid_connected(%1) ((1 <= %1 <= g_maxplayers) && g_isconnected[%1])
#define is_user_valid_alive(%1) ((1 <= %1 <= g_maxplayers) && g_isalive[%1])

new const AH_CUSTOMIZATION_FILE[] = "allheroes.ini"
new const AH_HEROESCLASSES_FILE[] = "ah_heroesclasses.ini"

new CSW_MAXAMMO[33] = {-25209013211009011201001009090901001203012020032901209023590900100, -1, -1};
new 
teaminfo[][] = {"UNASSIGNED""TERRORIST""CT""SPECTATOR"};

new Array:
g_hclass_name,Array:g_hclass_team,Array:g_hclass_modelsstart,Array:g_hclass_modelsend,Array:g_hclass_playermodel,
Array:
g_hclass_modelindex,Array:g_hclass_clawmodel,Array:g_hclass_hp,Array:g_hclass_spd,Array:g_hclass_grav,
Array:
g_hclass2_realname,Array:g_hclass2_name,Array:g_hclass2_team,Array:g_hclass2_modelsstart,
Array:
g_hclass2_modelsend,Array:g_hclass2_playermodel,Array:g_hclass2_modelindex,
Array:
g_hclass2_clawmodel,Array:g_hclass2_hp,Array:g_hclass2_spd,Array:g_hclass2_grav,
Array:
g_hclass2_kb,Array:g_hclass_new,Array:g_hclass_skill1,Array:g_hclass_skill2,Array:g_hclass_skill3,
Array:
g_hclass2_skill1,Array:g_hclass2_skill2,Array:g_hclass2_skill3;

new 
g_heroesclass[33],Float:g_heroes_spd[33],HPLVLmultiplier,bool:g_newround,bool:g_isalive[33],bool:g_isconnected[33],
bool:g_isbot[33],Float:g_modelchange_delayg_heroesclassnext[33],bool:g_has_custom_model[33],hp_class[33],
bool:slilentstep[33],g_fwSetAtribHero,g_fwDummyResult,g_fwppfire,g_fwUpMenu,bool:ischoseteam[33],g_MsgSync,
bool:Hitboxes[33],savevalue[33],savedidhero[33],bool:newjoin[33],bool:roundend,bool:joined[33],g_maxplayers,
g_hclass_i,g_msgSayText,chance,bool:m_onoroffg_playermodel[33][32],g_heroes_classname[33][32],g_msg_teaminfo,
Team[33],bool:especialround,help_dirk,gHook_EntSpawn,classmonster = -1Float:g_models_targettime;

const 
Float:HUD_EVENT_X = -1.0;
const 
Float:HUD_EVENT_Y 0.17;

new const 
CMDBLOCKS[][] = {
    
"cl_autobuy","autobuy","cl_rebuy","cl_setautobuy","cl_setrebuy","glock","usp","hegren",
    
"p228","deagle","elites","fn57","mp5","smg","mac10","tmp","ump45","p90","m3","m249",
    
"xm1014","famas","m4a1","ak47","sg552","galil","aug","scout","awp","sg550","g3sg1",
    
"flash","sgren","vest","vesthelm","shield","buyammo1","buyammo2","buyequip"
};

const 
OFFSET_CSTEAMS 114;
const 
OFFSET_WEAPONOWNER 41;

const 
OFFSET_LINUX 5;
const 
OFFSET_LINUX_WEAPONS 4;

new const 
g_RemovedEntities[][] = {
    
"info_vip_start",
    
"func_vip_safetyzone",
    
"func_escapezone"
};


enum
{
    
SECTION_NONE 0,
    
SECTION_SVC_BAD
}

enum (+= 100)
{
    
TASK_MODEL 2000,
    
TASK_MDL
}

#define ID_MODEL (taskid - TASK_MODEL)

public plugin_precache()
{
    
g_hclass_name ArrayCreate(321)
    
g_hclass_team ArrayCreate(11)
    
g_hclass_modelsstart ArrayCreate(11)
    
g_hclass_modelsend ArrayCreate(11)
    
g_hclass_playermodel ArrayCreate(321)
    
g_hclass_modelindex ArrayCreate(11)
    
g_hclass_clawmodel ArrayCreate(321)
    
g_hclass_hp ArrayCreate(11)
    
g_hclass_spd ArrayCreate(11)
    
g_hclass_grav ArrayCreate(11)
    
g_hclass2_realname ArrayCreate(321)
    
g_hclass2_name ArrayCreate(321)
    
g_hclass2_team ArrayCreate(11)
    
g_hclass2_modelsstart ArrayCreate(11)
    
g_hclass2_modelsend ArrayCreate(11)
    
g_hclass2_playermodel ArrayCreate(321)
    
g_hclass2_modelindex ArrayCreate(11)
    
g_hclass2_clawmodel ArrayCreate(321)
    
g_hclass2_hp ArrayCreate(11)
    
g_hclass2_spd ArrayCreate(11)
    
g_hclass2_grav ArrayCreate(11)
    
g_hclass2_kb ArrayCreate(11)
    
g_hclass_new ArrayCreate(11)
    
g_hclass_skill1 ArrayCreate(321)
    
g_hclass_skill2 ArrayCreate(321)
    
g_hclass_skill3 ArrayCreate(321)
    
g_hclass2_skill1 ArrayCreate(321)
    
g_hclass2_skill2 ArrayCreate(321)
    
g_hclass2_skill3 ArrayCreate(321)

    
load_customization_from_files()
    
gHook_EntSpawn register_forward(FM_Spawn"fwd_Spawn")
}

public 
plugin_init()
{
    
register_plugin("[AH] All Heroes Classic Main""0.21""CLLlAgOB")
    
especialround false

    register_menucmd
(register_menuid("\yUpgrade Menu^n"), (MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6), "MenuCommand")
    
register_dictionary("allheroes.txt")

    
RegisterHam(Ham_Item_Deploy"weapon_knife""fw_Item_Deploy_Post"1)
    
HPLVLmultiplier register_cvar("ah_xp_lvlmultipliter","1.2")
    
chance register_cvar("ah_chance_sp_round","15")

    
RegisterHam(Ham_Killed"player""fw_PlayerKilled"0)
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_logevent("event_start"2"1=Round_Start")
    
register_logevent("logevent_round_end"2"1=Restart_Round""1=Game_Commencing""1=Round_End")
    
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeapon")
    
RegisterHam(Ham_Touch"weapon_shield""fw_TouchWeapon")
    
register_forwardFM_SetClientKeyValue"fw_SetClientKeyValue" )
    
register_forward(FM_ClientDisconnect"fw_ClientDisconnect")
    
RegisterHam(Ham_TakeDamage"player""player_TakeDamage")
    
register_message(get_user_msgid("Health"), "message_health")

    
help_dirk register_cvar("ah_helpdirk","/addons/amxmodx/data/lang/heroes/helph.txt")
    
register_clcmd("buy""redir")
    
register_clcmd("changerace""redir")
    
register_clcmd("ppfire""cmdShot")
    
register_clcmd("ultimate""cmdShot")

    for (new 
0sizeof CMDBLOCKSi++)
    {
        if (
CMDBLOCKS[i][0])
            
register_clcmd(CMDBLOCKS[i], "bblocked");
    }

    
register_event("CurWeapon""event_curweapon""be""1=1")
    
register_event("WeapPickup""event_weap_pickup""be""1!29")
    
register_clcmd("chooseteam""hook_changeteam")
    
register_clcmd("fullupdate","cmd_FullUpDate")
    
register_forward(FM_SetModel,"Hook_SetModel"1)
    
//register_concmd("ah_monster", "cmdmonster", ADMIN_BAN, "<name/id>") 
    //register_concmd("ah_boss", "cmdmonster", ADMIN_BAN, "<name/id>") 

    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")

    
g_fwSetAtribHero CreateMultiForward("set_atrib_hero"ET_CONTINUEFP_CELL)
    
g_fwppfire CreateMultiForward("cmdShoot"ET_CONTINUEFP_CELL)
    
g_fwUpMenu CreateMultiForward("seeXP"ET_CONTINUEFP_CELL)

    
g_msgSayText get_user_msgid("SayText")
    
g_MsgSync CreateHudSyncObj()
    
g_maxplayers get_maxplayers()
    
g_msg_teaminfo get_user_msgid("TeamInfo")

    
unregister_forward(FM_SpawngHook_EntSpawn)
    
set_task(0.1"M_onoroff_save_class")
}

public 
plugin_natives()
{
    
register_native("ah_register_heroes_class""native_register_heroes_class"1)
    
register_native("ah_set_heroes_hp""native_ah_set_heroes_hp"1)
    
register_native("ah_set_heroes_spd""native_ah_set_heroes_spd"1)
    
register_native("ah_get_heroes_spd""native_ah_get_heroes_spd"1)
    
register_native("ah_num_heroes""native_ah_num_heroes"1)
    
register_native("ah_get_user_heroes_class""native_get_user_heroes_class"1)
    
register_native("ah_get_hp_class""native_get_hp_class"1)
    
register_native("ah_menu_lvl","native_ah_menu_lvl"1)
    
register_native("ah_reload_knife_models","native_reload_knife_models"1)
    
register_native("ah_get_hero_name","native_ah_get_hero_name")
    
register_native("ah_got_a_class_idmonster","got_a_class_idmonster"1)
    
register_native("ah_is_hero_monster","native_is_hero_monster"1)
    
register_native("ah_set_user_footsteps","native_ah_set_user_footsteps"1)
}

public 
plugin_cfg()
{
    
save_customization()
}

public 
M_onoroff_save_class()
{
    if (
monster_onoroff())
        
m_onoroff true;

    else
        
m_onoroff false;

    static class, 
buffer2;

    for (class = 
0; class < g_hclass_i; class++)
    {
        
buffer2 ArrayGetCell(g_hclass_team, class);

        if (
buffer2 == 0)
        {
            
classmonster = class;
        }
    }
}

public 
cmd_FullUpDate()
{
    return 
PLUGIN_HANDLED
}

public 
RemovePickedWeapon(id) {
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
PLUGIN_CONTINUE

    
new wpnList[32]     
    new 
number
    get_user_weapons
(id,wpnList,number
    for (new 
0;number ;i++) { 
        if (
wpnList[i] != CSW_KNIFE)
        {
            if(
wpnList[i] != CSW_HEGRENADE)
            {
                if(
wpnList[i] != CSW_C4)
                    
fm_strip_user_gun(idwpnList[i])
            }
        }
    }

    return 
PLUGIN_HANDLED
}

public 
event_weap_pickup(id)
{
    if(
g_isbot[id]) {
        
set_task(0.1"RemovePickedWeapon"id)
    }
    return 
PLUGIN_HANDLED
}

public 
message_show_menu(msgiddestid)
{
    if (
joined[id])
        return 
PLUGIN_CONTINUE

    
static team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)

    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE

    show_team_menu
(id)
    return 
PLUGIN_HANDLED
}

public 
message_vgui_menu(msgiddestid) {
    if (
get_msg_arg_int(1) != || joined[id])
        return 
PLUGIN_CONTINUE

    show_team_menu
(id)
    return 
PLUGIN_HANDLED
}

public 
player_TakeDamage(victiminflictorattackerFloat:damagedamagetype) {
    if(
roundend)
        return 
HAM_SUPERCEDE

    
return HAM_IGNORED
}

public 
fwd_Spawn(ent) {
    if(!
pev_valid(ent) || is_plugin_loaded("[AH] Just Capture the Flag",false) > -1)
        return 
FMRES_IGNORED;
    
    static 
ClassName[32], isize;
    
pev(entpev_classnameClassName31);
    
size sizeof(g_RemovedEntities);
    for(
i=0sizei++) 
    {
        if(
equali(ClassNameg_RemovedEntities[i]))
        {
            
engfunc(EngFunc_RemoveEntityent);
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;
}

public 
fw_TouchWeapon(weaponid)
{
    if (!
is_user_valid_connected(id))
        return 
HAM_IGNORED;

    new 
modelname[32]     
    
pev(weaponpev_modelmodelname31)
    if(
equali(modelname"models/w_backpack.mdl")) 
        return 
HAM_IGNORED;
    
    return 
HAM_SUPERCEDE;
}

public 
Hook_SetModel(ent,model[])
{
    if(
pev_valid(ent) && ent>g_maxplayers)
    {
        if(
containi(model,"models/w_")==&& containi(model,"models/w_backpack")!=&& containi(model,"models/w_c4")!=0)
        {
            if(
containi(model,"nade")!=-|| containi(model,"flash")!=-1)
            {
                
set_task(2.0,"remove_nade_ent",ent,model,31)
            }
            else
            {
                
set_task(0.1,"remove_ent",ent,model,31)
            }
        }
    }
}

public 
remove_ent(model[32],ent)
{
    if(
pev_valid(ent))
    {
        static 
model2[32]
        
pev(ent,pev_model,model2,31)

        if(
equal(model,model2))
            
engfunc(EngFunc_RemoveEntity,ent)
    }
}

public 
remove_nade_ent(model[32],ent)
{
    if(
pev_valid(ent))
    {
        static 
model2[32]
        
pev(ent,pev_model,model2,31)
        if(
equal(model,model2))
        {
            static 
Float:velocity[3]
            
pev(ent,pev_velocity,velocity)
    
            if(!
velocity[0] && !velocity[1] && !velocity[2])
                
set_pev(ent,pev_flags,FL_KILLME)
        }
    }
}

public 
native_ah_set_user_footsteps(idbool:onoff){
    
slilentstep[id] = onoff
}

public 
bblocked(id)
{
    return 
PLUGIN_HANDLED
}
    
public 
redir(id)
{
    
show_menu_hclass(id)
    return 
PLUGIN_HANDLED
}
    
#define MAX_CLASS_LEN 31

new namesh[32][20]
public 
show_hclass_help(id)
{
    if (!
g_isconnected[id] || g_isbot[id])
        return;

    static 
menuidmenu[128]
    new 
0

    formatex
(menucharsmax(menu), "%L\r"id"MENU_HCLASS_TITLE")
    
menuid menu_create(menu"menu_hclass_help")

    new Array:
processedNames ArrayCreate(MAX_CLASS_LEN+1ArraySize(g_hclass_name))
    
    for(new 
0!= g_hclass_i; ++i)
    {
        static 
currentName[MAX_CLASS_LEN+1], nameLen
        ArrayGetString
(g_hclass_nameicurrentNamecharsmax(currentName))
     
        
nameLen strlen(currentName)
     
        static const 
_RED[] = " RED"
        
static const _BLUE[] = " BLUE"
     
        
if(nameLen charsmax(_RED) && equali(currentName[nameLen charsmax(_RED)], _REDcharsmax(_RED)))
        {
            
currentName[nameLen charsmax(_RED)] = '^0'
            
nameLen -= charsmax(_RED)
        }
        else if(
nameLen charsmax(_BLUE) && equali(currentName[nameLen charsmax(_BLUE)], _BLUEcharsmax(_BLUE)))
        {
            
currentName[nameLen charsmax(_BLUE)] = '^0'
            
nameLen -= charsmax(_BLUE)
        }
     
        for(new 
0!= ArraySize(processedNames); ++j)
        {
            static 
processedName[MAX_CLASS_LEN+1]
            
ArrayGetString(processedNamesjprocessedNamecharsmax(processedName))
            if(  
equali(currentNameprocessedName)  )
                goto 
continue2
        
}
     
        static const 
_SY[] = " \y"
         
        
copy(menunameLencurrentName)
        
copy(menu[nameLen], charsmax(_SY), _SY)
        
menu_additem(menuidmenu)

        
ArrayPushString(processedNamescurrentName)
        
copy(namesh[X], nameLencurrentName)
        
X++
        
continue2:
    }
    
ArrayDestroy(processedNames)

    
formatex(menucharsmax(menu), "%L"id"MENU_BACK")
    
menu_setprop(menuidMPROP_BACKNAMEmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_NEXT")
    
menu_setprop(menuidMPROP_NEXTNAMEmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_EXIT")
    
menu_setprop(menuidMPROP_EXITNAMEmenu)
    
    
menu_display(idmenuid)
}

public 
menu_hclass_help(idmenuidkey)
{
    if (
key == MENU_EXIT)
    {
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
    }
    new 
dir[129]
    
formatex(dircharsmax(dir), "/addons/amxmodx/data/lang/heroes/%s.txt"namesh[key])
    
show_motd(iddir,"Help hero")
    
menu_destroy(menuid)
    return 
PLUGIN_HANDLED;
}

public 
Showmain(id)
{
    if (!
g_isconnected[id] || g_isbot[id])
        return;
        
    static 
menuidmenu[256]
    
formatex(menucharsmax(menu), "%L\r"id"MENU_HMAIN_TITLE")
    
menuid menu_create(menu"menu_hmain")
    
    
formatex(menucharsmax(menu), "%L"id"MENU_HMAIN_CH")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_HMAIN_CHT")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_HMAIN_AB")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_HMAIN_STATS")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_HMAIN_HELP")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_LANG_TITLE")
    
menu_additem(menuidmenu)
    
    
formatex(menucharsmax(menu), "%L"id"MENU_EXIT")
    
menu_setprop(menuidMPROP_EXITNAMEmenu)
    
    
menu_display(idmenuid)
}

public 
menu_hmain(idmenuidkey)
{
    if (
key == MENU_EXIT)
    {
        
menu_destroy(menuid)
        return 
PLUGIN_HANDLED;
    }
    switch (
key) {
        case 
0: { 
            
show_menu_hclass(id)
        }
        case 
1: { 
            
ischoseteam[id] = true
            show_team_menu
(id)
        }
        case 
2: { 
            
func_autobind(id)
        }
        case 
3: { 
            
client_cmd(id,"lvl")
        }
        case 
4: { 
            
show_menu_hhelp(id)
        }
        case 
5: { 
            
show_menu_lang(id)
        }
    }
    
menu_destroy(menuid)
    return 
PLUGIN_HANDLED;
}

public 
show_team_menu(id)
{
    if (!
g_isconnected[id] || g_isbot[id])
        return;
        
    static 
menuidmenu[256]

    
formatex(menucharsmax(menu), "%L\r"id"MENU_TEAM_TITLE")
    
menuid menu_create(menu"menu_team_menu")
    
formatex(menucharsmax(menu), "%L"id"MENU_TEAM_RED")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_TEAM_BLUE")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_TEAM_SPEC")
    
menu_additem(menuidmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_EXIT")
    
menu_setprop(menuidMPROP_EXITNAMEmenu)
    
menu_display(idmenuid)
}

public 
menu_team_menu(idmenuidkey)
{
    if (
key == MENU_EXIT)
    {
        
ischoseteam[id] = false
        menu_destroy
(menuid)

        if(!
joined[id])
            
show_team_menu(id)

        return 
PLUGIN_HANDLED;
    }
    switch (
key) {
        case 
0: { 
            
client_cmd(id,"chooseteam")
            
set_task(0.1"task_force_team_join_T"id)
            
joined[id] = true
        
}
        case 
1: { 
            
client_cmd(id,"chooseteam")
            
set_task(0.1"task_force_team_join_CT"id)
            
joined[id] = true
        
}
        case 
2: {
            if(!
is_user_alive(id)){
                
engclient_cmd(id"jointeam" "6")
                
joined[id] = true    
            
} else {
                
client_print(idprint_center"You cannot become a spectator")
            }
            
        }
    }
    
menu_destroy(menuid)
    return 
PLUGIN_HANDLED;
}

public 
task_force_team_join_T(id) {
    
engclient_cmd(id"jointeam" "1")
    
set_task(0.1"join_class"id)
}

public 
task_force_team_join_CT(id) {
    
engclient_cmd(id"jointeam" "2")
    
set_task(0.1"join_class"id)
}

public 
join_class(id){
    
engclient_cmd(id"joinclass""5")
    
show_menu_hclass(id)
}

public 
show_menu_lang(id)
{
    if (!
g_isconnected[id] || g_isbot[id])
        return;
        
    static 
menuidhmenu[256]
    
formatex(menucharsmax(menu), "%L\r"id"MENU_LANG_TITLE")
    
menuidh menu_create(menu"menu_lang")
    
    
formatex(menucharsmax(menu), "%L"id"MENU_LANG_RUS")
    
menu_additem(menuidhmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_LANG_ENG")
    
menu_additem(menuidhmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_EXIT")
    
menu_setprop(menuidhMPROP_EXITNAMEmenu)

    
menu_display(idmenuidh)
}

public 
menu_lang(idmenuidhkey)
{
    if (
key == MENU_EXIT)
    {
        
menu_destroy(menuidh)
        return 
PLUGIN_HANDLED;
    }
    switch (
key) { 
        case 
0: { 
            
set_user_info(id"lang""ru")
        }
        case 
1: { 
            
set_user_info(id"lang""en")
        }
    }
    
menu_destroy(menuidh);
    return 
PLUGIN_HANDLED;
}

public 
show_menu_hhelp(id)
{
    if (!
g_isconnected[id] || g_isbot[id])
        return;
        
    static 
menuidhmenu[256]
    
formatex(menucharsmax(menu), "%L\r"id"MENU_HHELP_TITLE")
    
menuidh menu_create(menu"menu_hhelp")
    
    
formatex(menucharsmax(menu), "%L"id"MENU_HHELP_CNTR")
    
menu_additem(menuidhmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_HHELP_HR")
    
menu_additem(menuidhmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_BACK")
    
menu_additem(menuidhmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_EXIT")
    
menu_setprop(menuidhMPROP_EXITNAMEmenu)

    
menu_display(idmenuidh)
}

public 
menu_hhelp(idmenuidhkey)
{
    if (
key == MENU_EXIT)
    {
        
menu_destroy(menuidh)
        return 
PLUGIN_HANDLED;
    }
    switch (
key) { 
        case 
0: { 
            
ah_helpk(id);
        }
        case 
1: { 
            
show_hclass_help(id);
        }
        case 
2: { 
            
Showmain(id);
        }
    }
    
menu_destroy(menuidh);
    return 
PLUGIN_HANDLED;
}

public 
ah_helpk(id)
{
    new 
dir[129]
    
get_pcvar_string(help_dirk,dir,128)
    
show_motd(iddir,"Helps keys")
}

public 
delaychose(id){
    
ischoseteam[id] = false
}

public 
func_autobind(id)
{
    
client_cmd(id,"bind p pcview")
    
client_cmd(id,"bind mouse3 ppfire")
    
client_cmd(id," setinfo autobind v1.0")
    
console_print(id,"Key Defaults are bound. ENJOY!")
    return 
PLUGIN_HANDLED
}

public 
hook_changeteam(id)
{
    new 
team fm_cs_get_user_team(id)

    if (
team == 0)
        return 
PLUGIN_CONTINUE;

    if (!
ischoseteam[id]){
        
Showmain(id)
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id)
{
    
g_isconnected[id] = true
    joined
[id] = false
    reset_vars
(id1)
    
newjoin[id] = true
    
if (!is_user_bot(id)){
        
set_task(0.1"disable_minmodels"id)
    }else{
        
g_isbot[id] = true
    
}
}

public 
fw_ClientDisconnect(id)
{
    
g_isconnected[id] = false
    g_isbot
[id] = false
    g_isalive
[id] = false
    newjoin
[id] = false
    remove_task
(id)
}

public 
disable_minmodels(id)
{
    if (!
g_isconnected[id])
        return;

    
client_cmd(id"cl_minmodels 0")
    
client_cmd(id,"setinfo _vgui_menus 0");
    
client_cmd(id,"cl_minmodels 0");
}

#define MAX "Max LVL skill"

public native_ah_menu_lvl(id)
{    
    if(!
g_isbot[id]){
        static 
buffer[33],buffer2[33],buffer3[33]
        
ArrayGetString(g_hclass_skill1g_heroesclass[id], buffercharsmax(buffer))
        
ArrayGetString(g_hclass_skill2g_heroesclass[id], buffer2charsmax(buffer2))
        
ArrayGetString(g_hclass_skill3g_heroesclass[id], buffer3charsmax(buffer3))
        new 
0
        
new keys
        
new szMenuBody[256]
        new 
nLen format(szMenuBody255"\yUpgrade Menu^n" )
        if( 
lvlHeroSkill(id,1,g_heroesclass[id]) == 3){
            
nLen += format(szMenuBody[nLen], 255-nLen"\d%d. %s^n\w", ++bMAX)
        } else {
            
keys |= (1<<b)
            
nLen += format(szMenuBody[nLen], 255-nLen"\w%d. %s^n", ++b,buffer)
        }
        if(
lvlHeroSkill(id,2,g_heroesclass[id]) == 3){
            
nLen += format(szMenuBody[nLen], 255-nLen"\d%d. %s^n\w", ++bMAX)
        } else {
            
keys |= (1<<b)
            
nLen += format(szMenuBody[nLen], 255-nLen"\w%d. %s^n", ++b,buffer2)
        }
        if(
lvlHeroSkill(id,3,g_heroesclass[id]) == 3){
            
nLen += format(szMenuBody[nLen], 255-nLen"\d%d. %s^n\w", ++bMAX)
        } else {
            
keys |= (1<<b)
            
nLen += format(szMenuBody[nLen], 255-nLen"\w%d. %s^n", ++b,buffer3)
        }
        
show_menuidkeysszMenuBody, -)
    } else {
        if(
lvlHeroSkill(id,1,g_heroesclass[id])==3){
            if(
lvlHeroSkill(id,2,g_heroesclass[id])==3){
                if(
lvlHeroSkill(id,3,g_heroesclass[id])==3){
                    return 
PLUGIN_CONTINUE
                

                else if(
lvlHeroSkill(id,3,g_heroesclass[id])==2){
                    
set_lvlHeroSkill(id,3,g_heroesclass[id],3)
                }
                else if(
lvlHeroSkill(id,3,g_heroesclass[id])==1){
                    
set_lvlHeroSkill(id,3,g_heroesclass[id],2
                }
                else if(
lvlHeroSkill(id,3,g_heroesclass[id])==0){
                    
set_lvlHeroSkill(id,3,g_heroesclass[id],1)
                }
            }
            else if(
lvlHeroSkill(id,2,g_heroesclass[id])==2){
                
set_lvlHeroSkill(id,2,g_heroesclass[id],3)
            }
            else if(
lvlHeroSkill(id,2,g_heroesclass[id])==1){
                
set_lvlHeroSkill(id,2,g_heroesclass[id],2)
            }
            else if(
lvlHeroSkill(id,2,g_heroesclass[id])==0){
                
set_lvlHeroSkill(id,2,g_heroesclass[id],1)
            }
        }
        else if(
lvlHeroSkill(id,1,g_heroesclass[id])==2){
            
set_lvlHeroSkill(id,1,g_heroesclass[id],3)             
            }
        else if(
lvlHeroSkill(id,1,g_heroesclass[id])==1){
            
set_lvlHeroSkill(id,1,g_heroesclass[id],2)
            }
        else if(
lvlHeroSkill(id,1,g_heroesclass[id])==0){
            
set_lvlHeroSkill(id,1,g_heroesclass[id],1)
        }
    }    
    return 
PLUGIN_CONTINUE
}

public 
show_menu_hclass(id)
{
    if (!
g_isconnected[id] || g_isbot[id])
        return;

    static 
menuidmenu[128], class, buffer[33], buffer2[33]
    
formatex(menucharsmax(menu), "%L\r"id"MENU_HCLASS_TITLE")
    
menuid menu_create(menu"menu_hclass")

    new 
team fm_cs_get_user_team(id)

    if(
team == ){
        for (class = 
0; class < g_hclass_i; class++)
        {
            
ArrayGetString(g_hclass_name, class, buffercharsmax(buffer))
            
buffer2[id] = ArrayGetCell(g_hclass_team, class)

            if(
buffer2[id] == 2){
                if (class == 
g_heroesclassnext[id])
                    
formatex(menucharsmax(menu), "\d%s"buffer)
                else
                    
formatex(menucharsmax(menu), "%s \y"buffer)
                
buffer[0] = class
                
menu_additem(menuidmenubuffer)
            }
            
buffer[1] = 0
        
}
    }
    else if(
team == ){
        for (class = 
0; class < g_hclass_i; class++)
        {
            
ArrayGetString(g_hclass_name, class, buffercharsmax(buffer))
            
buffer2[id] = ArrayGetCell(g_hclass_team, class)

            if(
buffer2[id] == 1){
                if (class == 
g_heroesclassnext[id])
                    
formatex(menucharsmax(menu), "\d%s"buffer)
                else
                    
formatex(menucharsmax(menu), "%s \y"buffer)
                
buffer[0] = class
                
menu_additem(menuidmenubuffer)
            }
            
buffer[1] = 0
        
}
    
    }

    
formatex(menucharsmax(menu), "%L"id"MENU_BACK")
    
menu_setprop(menuidMPROP_BACKNAMEmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_NEXT")
    
menu_setprop(menuidMPROP_NEXTNAMEmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_EXIT")
    
menu_setprop(menuidMPROP_EXITNAMEmenu)
    
    
menu_display(idmenuid)
}

public 
menu_hclass(idmenuiditem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menuid);
        return 
PLUGIN_HANDLED;
    }

    static 
buffer[2], dummyclassid;
    
menu_item_getinfo(menuiditemdummybuffercharsmax(buffer), __dummy);
    
classid buffer[0];

    if(!
ischoseteam[id]){
        if (
g_heroesclassnext[id] == -1) {
            
g_heroesclassnext[id] = classid;
            
herome(id);
        }
        else
        {
            
g_heroesclassnext[id] = classid;
        }
    } else {
        
ischoseteam[id] = false;
        
g_heroesclassnext[id] = classid;
        
g_heroesclass[id] = classid;
    }

    static 
name[32];
    
ArrayGetString(g_hclass_nameg_heroesclassnext[id], namecharsmax(name));

    
ah_colored_print(id"^x04[AH]^x01 %L: %s"id"HERO_SELECT"name);
    new 
hp_cl,hp;
    
hp = (ArrayGetCell(g_hclass_hpg_heroesclassnext[id]));

    if(
lvlHeroSkill(id,1,g_heroesclassnext[id]) > 0)
    {
        if(
lvlHeroSkill(id,1,g_heroesclassnext[id]) == 1hp_cl floatround(hp/get_pcvar_float(HPLVLmultiplier)/get_pcvar_float(HPLVLmultiplier));
        if(
lvlHeroSkill(id,1,g_heroesclassnext[id]) == 2hp_cl floatround(hp/get_pcvar_float(HPLVLmultiplier));
        if(
lvlHeroSkill(id,1,g_heroesclassnext[id]) == 3hp_cl hp;
    }

    else
    {
        
hp_cl floatround(hp/get_pcvar_float(HPLVLmultiplier)/get_pcvar_float(HPLVLmultiplier)/get_pcvar_float(HPLVLmultiplier));
    }

    
ah_colored_print(id"^x04[AH]^x01 %L: %d %L: %d %L: %d %L %d"id"HERO_ATTRIB1"hp_clid"HERO_ATTRIB2"ArrayGetCell(g_hclass_spdg_heroesclassnext[id]),
    
id"HERO_ATTRIB3"floatround(Float:ArrayGetCell(g_hclass_gravg_heroesclassnext[id]) * 800.0), id"HERO_LVL" lvlHero(id,g_heroesclassnext[id]), id);

    
menu_destroy(menuid);
    return 
PLUGIN_HANDLED;
}

public 
MenuCommand(idkey){
    static 
buffer[33],buffer2[33],buffer3[33]
    
ArrayGetString(g_hclass_skill1g_heroesclass[id], buffercharsmax(buffer))
    
ArrayGetString(g_hclass_skill2g_heroesclass[id], buffer2charsmax(buffer2))
    
ArrayGetString(g_hclass_skill3g_heroesclass[id], buffer3charsmax(buffer3))
    switch( 
key ){
        case 
0:{
            if(
lvlHeroSkill(id,1,g_heroesclass[id])==3){
                return 
PLUGIN_CONTINUE
            
}
            if(
lvlHeroSkill(id,1,g_heroesclass[id])==2){
                
set_lvlHeroSkill(id,1,g_heroesclass[id],3
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer)            
            }
            if(
lvlHeroSkill(id,1,g_heroesclass[id])==1){
                
set_lvlHeroSkill(id,1,g_heroesclass[id],2)
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer)
            }
            if(
lvlHeroSkill(id,1,g_heroesclass[id])==0){
                
set_lvlHeroSkill(id,1,g_heroesclass[id],1)
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer)
            }
        }
        case 
1:{
            if(
lvlHeroSkill(id,2,g_heroesclass[id])==3){
                return 
PLUGIN_CONTINUE
            
}
            if(
lvlHeroSkill(id,2,g_heroesclass[id])==2){
                
set_lvlHeroSkill(id,2,g_heroesclass[id],3)
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer2)
            }
            if(
lvlHeroSkill(id,2,g_heroesclass[id])==1){
                
set_lvlHeroSkill(id,2,g_heroesclass[id],2)
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer2)
            }
            if(
lvlHeroSkill(id,2,g_heroesclass[id])==0){
                
set_lvlHeroSkill(id,2,g_heroesclass[id],1)
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer2)
            }
        }
        case 
2:{
            if(
lvlHeroSkill(id,3,g_heroesclass[id])==3){
                return 
PLUGIN_CONTINUE
            
}
            if(
lvlHeroSkill(id,3,g_heroesclass[id])==2){
                
set_lvlHeroSkill(id,3,g_heroesclass[id],3)
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer3)
            }
            if(
lvlHeroSkill(id,3,g_heroesclass[id])==1){
                
set_lvlHeroSkill(id,3,g_heroesclass[id],2
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer3)
            }
            if(
lvlHeroSkill(id,3,g_heroesclass[id])==0){
                
set_lvlHeroSkill(id,3,g_heroesclass[id],1)
                
ah_colored_print(id,"^x04[AH]^x01 Next round %s",buffer3)
            }
        }
    }
    
ExecuteForward(g_fwUpMenug_fwDummyResultid);
    return 
PLUGIN_CONTINUE
}

public 
native_register_heroes_class(const name[], team, const model[], const clawmodel[],const skill1[],const skill2[],const skill3[], hpspeedFloat:gravity)
{
    
param_convert(1)
    
//param_convert(2)
    
param_convert(3)
    
param_convert(4)
    
param_convert(5)
    
param_convert(6)
    
param_convert(7)

    
ArrayPushString(g_hclass_namename)
    
ArrayPushString(g_hclass_skill1,skill1)
    
ArrayPushString(g_hclass_skill2,skill2)
    
ArrayPushString(g_hclass_skill3,skill3)
    
ArrayPushCell(g_hclass_modelsstartArraySize(g_hclass_playermodel))
    
ArrayPushString(g_hclass_playermodelmodel)
    
ArrayPushCell(g_hclass_modelsendArraySize(g_hclass_playermodel))
    
ArrayPushCell(g_hclass_modelindex, -1)
    
    
ArrayPushString(g_hclass_clawmodelclawmodel)
    
ArrayPushCell(g_hclass_teamteam)
    
ArrayPushCell(g_hclass_hphp)
    
ArrayPushCell(g_hclass_spdspeed)
    
ArrayPushCell(g_hclass_gravgravity)
    
    
ArrayPushCell(g_hclass_new1)
    
    new 
ikbuffer[33], Float:buffer2nummodels_customnummodels_defaultprec_mdl[100], size ArraySize(g_hclass2_realname)
    for (
0sizei++)
    {
        
ArrayGetString(g_hclass2_realnameibuffercharsmax(buffer))

        if (!
equal(namebuffer))
            continue;
        
        
ArraySetCell(g_hclass_newg_hclass_i0)
        
        
ArrayGetString(g_hclass2_nameibuffercharsmax(buffer))
        
ArraySetString(g_hclass_nameg_hclass_ibuffer)
        
        
ArrayGetString(g_hclass2_skill1ibuffercharsmax(buffer))
        
ArraySetString(g_hclass_skill1g_hclass_ibuffer)
        
ArrayGetString(g_hclass2_skill2ibuffercharsmax(buffer))
        
ArraySetString(g_hclass_skill2g_hclass_ibuffer)
        
ArrayGetString(g_hclass2_skill3ibuffercharsmax(buffer))
        
ArraySetString(g_hclass_skill3g_hclass_ibuffer)
        
        
nummodels_custom ArrayGetCell(g_hclass2_modelsendi) - ArrayGetCell(g_hclass2_modelsstarti)
        
nummodels_default ArrayGetCell(g_hclass_modelsendg_hclass_i) - ArrayGetCell(g_hclass_modelsstartg_hclass_i)

        for (
0min(nummodels_customnummodels_default); k++)
        {
            
ArrayGetString(g_hclass2_playermodelArrayGetCell(g_hclass2_modelsstarti) + kbuffercharsmax(buffer))
            
ArraySetString(g_hclass_playermodelArrayGetCell(g_hclass_modelsstartg_hclass_i) + kbuffer)
                
            
formatex(prec_mdlcharsmax(prec_mdl), "models/player/%s/%s.mdl"bufferbuffer)
            
ArraySetCell(g_hclass_modelindexArrayGetCell(g_hclass_modelsstartg_hclass_i) + kengfunc(EngFunc_PrecacheModelprec_mdl))
        }

        if (
nummodels_custom nummodels_default)
        {
            for (
nummodels_defaultnummodels_customk++)
            {
                
ArrayGetString(g_hclass2_playermodelArrayGetCell(g_hclass2_modelsstarti) + kbuffercharsmax(buffer))
                
ArrayInsertStringAfter(g_hclass_playermodelArrayGetCell(g_hclass_modelsstartg_hclass_i) + 1buffer)

                
formatex(prec_mdlcharsmax(prec_mdl), "models/player/%s/%s.mdl"bufferbuffer)
                
ArrayInsertCellAfter(g_hclass_modelindexArrayGetCell(g_hclass_modelsstartg_hclass_i) + 1engfunc(EngFunc_PrecacheModelprec_mdl))
            }
                
            
ArraySetCell(g_hclass_modelsendg_hclass_iArrayGetCell(g_hclass_modelsendg_hclass_i) + (nummodels_custom nummodels_default))
        }

        
ArrayGetString(g_hclass2_clawmodelibuffercharsmax(buffer))
        
ArraySetString(g_hclass_clawmodelg_hclass_ibuffer)

        
formatex(prec_mdlcharsmax(prec_mdl), "models/allheroes/%s"buffer)
        if(!
equali(prec_mdl"models/allheroes/v_knife.mdl")){
            
engfunc(EngFunc_PrecacheModelprec_mdl)
        } 

        
buffer[0] = ArrayGetCell(g_hclass2_hpi)
        
ArraySetCell(g_hclass_hpg_hclass_ibuffer[0])
        
buffer[0] = ArrayGetCell(g_hclass2_teami)
        
ArraySetCell(g_hclass_teamg_hclass_ibuffer[0])
        
buffer[0] = ArrayGetCell(g_hclass2_spdi)
        
ArraySetCell(g_hclass_spdg_hclass_ibuffer[0])
        
buffer2 Float:ArrayGetCell(g_hclass2_gravi)
        
ArraySetCell(g_hclass_gravg_hclass_ibuffer2)
    }

    if (
ArrayGetCell(g_hclass_newg_hclass_i))
    {
        
formatex(prec_mdlcharsmax(prec_mdl), "models/player/%s/%s.mdl"modelmodel)
        
ArraySetCell(g_hclass_modelindexArrayGetCell(g_hclass_modelsstartg_hclass_i), engfunc(EngFunc_PrecacheModelprec_mdl))

        
formatex(prec_mdlcharsmax(prec_mdl), "models/allheroes/%s"clawmodel)
        if(!
equali(prec_mdl"models/allheroes/v_knife.mdl")){
            
engfunc(EngFunc_PrecacheModelprec_mdl)
        }
    }

    
g_hclass_i++
    return 
g_hclass_i-1;
}

save_customization()
{
    new 
ikbuffer[512]
    
    new 
path[64]
    
get_configsdir(pathcharsmax(path))
    
format(pathcharsmax(path), "%s/%s"pathAH_HEROESCLASSES_FILE)
    
    new 
file fopen(path"at"), size ArraySize(g_hclass_name)
    
    for (
0sizei++)
    {
        if (
ArrayGetCell(g_hclass_newi))
        {
            
ArrayGetString(g_hclass_nameibuffercharsmax(buffer))
            
format(buffercharsmax(buffer), "^n[%s]"buffer)
            
fputs(filebuffer)
            
            
ArrayGetString(g_hclass_nameibuffercharsmax(buffer))
            
format(buffercharsmax(buffer), "^nNAME = %s"buffer)
            
fputs(filebuffer)
            
            
ArrayGetString(g_hclass_skill1ibuffercharsmax(buffer))
            
format(buffercharsmax(buffer), "^nSKILL1 = %s"buffer)
            
fputs(filebuffer)
            
ArrayGetString(g_hclass_skill2ibuffercharsmax(buffer))
            
format(buffercharsmax(buffer), "^nSKILL2 = %s"buffer)
            
fputs(filebuffer)
            
ArrayGetString(g_hclass_skill3ibuffercharsmax(buffer))
            
format(buffercharsmax(buffer), "^nSKILL3 = %s"buffer)
            
fputs(filebuffer)
            
            
formatex(buffercharsmax(buffer), "^nTEAM = %d"ArrayGetCell(g_hclass_teami))
            
fputs(filebuffer)
            
            for (
ArrayGetCell(g_hclass_modelsstarti); ArrayGetCell(g_hclass_modelsendi); k++)
            {
                if (
== ArrayGetCell(g_hclass_modelsstarti))
                {
                    
ArrayGetString(g_hclass_playermodelkbuffercharsmax(buffer))
                }
                else
                {
                    
ArrayGetString(g_hclass_playermodelkpathcharsmax(path))
                    
format(buffercharsmax(buffer), "%s , %s"bufferpath)
                }
            }
            
format(buffercharsmax(buffer), "^nMODELS = %s"buffer)
            
fputs(filebuffer)
            
            
ArrayGetString(g_hclass_clawmodelibuffercharsmax(buffer))
            
format(buffercharsmax(buffer), "^nCLAWMODEL = %s"buffer)
            
fputs(filebuffer)
            
            
formatex(buffercharsmax(buffer), "^nHEALTH = %d"ArrayGetCell(g_hclass_hpi))
            
fputs(filebuffer)
            
            
formatex(buffercharsmax(buffer), "^nSPEED = %d"ArrayGetCell(g_hclass_spdi))
            
fputs(filebuffer)
            
            
formatex(buffercharsmax(buffer), "^nGRAVITY = %.2f^n"Float:ArrayGetCell(g_hclass_gravi))
            
fputs(filebuffer)
        }
    }
    
fclose(file)

    
ArrayDestroy(g_hclass2_realname)
    
ArrayDestroy(g_hclass2_name)
    
ArrayDestroy(g_hclass2_skill1)
    
ArrayDestroy(g_hclass2_skill2)
    
ArrayDestroy(g_hclass2_skill3)
    
ArrayDestroy(g_hclass2_team)
    
ArrayDestroy(g_hclass2_modelsstart)
    
ArrayDestroy(g_hclass2_modelsend)
    
ArrayDestroy(g_hclass2_playermodel)
    
ArrayDestroy(g_hclass2_modelindex)
    
ArrayDestroy(g_hclass2_clawmodel)
    
ArrayDestroy(g_hclass2_hp)
    
ArrayDestroy(g_hclass2_spd)
    
ArrayDestroy(g_hclass2_grav)
    
ArrayDestroy(g_hclass2_kb)
    
ArrayDestroy(g_hclass_new)
}

load_customization_from_files()
{
    new 
path[64]
    
get_configsdir(pathcharsmax(path))
    
format(pathcharsmax(path), "%s/%s"pathAH_CUSTOMIZATION_FILE)
    
    if (!
file_exists(path))
    {
        new 
error[100]
        
formatex(errorcharsmax(error), "Cannot load customization file %s!"path)
        
log_amx("%s"error)
        return
    }

    new 
linedata[1024], key[64], value[960], section

    
new file fopen(path"rt")
    
    while (
file && !feof(file))
    {
        
fgets(filelinedatacharsmax(linedata))
        
replace(linedatacharsmax(linedata), "^n""")

        if (!
linedata[0] || linedata[0] == ';')
            continue;

        if (
linedata[0] == '[')
        {
            
section++
            continue;
        }

        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')

        
trim(key)
        
trim(value)
        
        switch (
section)
        {
            case 
SECTION_SVC_BAD:
            {
                if (
equal(key"MODELCHANGE DELAY")){
                    
g_modelchange_delay str_to_float(value)
                }
            }
        }
    }

    if (
file)
        
fclose(file)

    
get_configsdir(pathcharsmax(path))
    
format(pathcharsmax(path), "%s/%s"pathAH_HEROESCLASSES_FILE)

    if (
file_exists(path))
    {
        
file fopen(path"rt")
        
        while (
file && !feof(file))
        {
            
fgets(filelinedatacharsmax(linedata))
            
replace(linedatacharsmax(linedata), "^n""")

            if (!
linedata[0] || linedata[0] == ';')
                continue;

            if (
linedata[0] == '[')
            {
                
linedata[strlen(linedata) - 1] = 0
                copy
(linedatacharsmax(linedata), linedata[1])

                
ArrayPushString(g_hclass2_realnamelinedata)
                continue;
            }

            
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')

            
trim(key)
            
trim(value)
            
            if (
equal(key"NAME"))
                
ArrayPushString(g_hclass2_namevalue)
            else if (
equal(key"TEAM"))
                
ArrayPushCell(g_hclass2_teamstr_to_num(value))
            else if (
equal(key"SKILL1"))
                
ArrayPushString(g_hclass2_skill1value)
            else if (
equal(key"SKILL2"))
                
ArrayPushString(g_hclass2_skill2value)
            else if (
equal(key"SKILL3"))
                
ArrayPushString(g_hclass2_skill3value)
            else if (
equal(key"TEAM"))
                
ArrayPushString(g_hclass_teamvalue)
            else if (
equal(key"MODELS"))
            {
                
ArrayPushCell(g_hclass2_modelsstartArraySize(g_hclass2_playermodel))

                while (
value[0] != && strtok(valuekeycharsmax(key), valuecharsmax(value), ','))
                {
                    
trim(key)
                    
trim(value)

                    
ArrayPushString(g_hclass2_playermodelkey)
                    
ArrayPushCell(g_hclass2_modelindex, -1)
                }

                
ArrayPushCell(g_hclass2_modelsendArraySize(g_hclass2_playermodel))
            }
            else if (
equal(key"CLAWMODEL"))
                
ArrayPushString(g_hclass2_clawmodelvalue)
            else if (
equal(key"HEALTH"))
                
ArrayPushCell(g_hclass2_hpstr_to_num(value))
            else if (
equal(key"SPEED"))
                
ArrayPushCell(g_hclass2_spdstr_to_num(value))
            else if (
equal(key"GRAVITY"))
                
ArrayPushCell(g_hclass2_gravstr_to_float(value))
        }
        if (
file)
            
fclose(file)
    }
}

ah_colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscount
    argscount 
numargs()

    if (!
target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            if (!
g_isconnected[player])
                continue;

            static 
changed[5], changedcount
            changedcount 
0

            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }

            
vformat(buffercharsmax(buffer), message3)

            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()

            for (
0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }

    else
    {    
        
vformat(buffercharsmax(buffer), message3)

        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }
}

public 
cmdShot(id)
{
    if(
g_isalive[id])
        
ExecuteForward(g_fwppfireg_fwDummyResultid);

    return 
PLUGIN_HANDLED;
}

public 
herome(id)
{
    if(!
is_user_valid_connected(id) || g_heroesclassnext[id] == -1)
        return 
PLUGIN_CONTINUE;

    
g_heroesclass[id] = g_heroesclassnext[id];
    
g_heroes_spd[id] = float(ArrayGetCell(g_hclass_spdg_heroesclass[id]));
    
ArrayGetString(g_hclass_nameg_heroesclass[id], g_heroes_classname[id], charsmax(g_heroes_classname[]));

    new 
hp ArrayGetCell(g_hclass_hpg_heroesclass[id]);

    if(
g_heroesclassnext[id] != got_a_class_idmonster())
    {
        if(
lvlHeroSkill(id,1,g_heroesclassnext[id]) > 0)
        {
            if(
lvlHeroSkill(id,1,g_heroesclass[id]) == 1hp_class[id] = floatround(hp/get_pcvar_float(HPLVLmultiplier)/get_pcvar_float(HPLVLmultiplier));
            if(
lvlHeroSkill(id,1,g_heroesclass[id]) == 2hp_class[id] = floatround(hp/get_pcvar_float(HPLVLmultiplier));
            if(
lvlHeroSkill(id,1,g_heroesclass[id]) == 3hp_class[id] = hp;
        }
        else
        {
            
hp_class[id] = floatround(hp/get_pcvar_float(HPLVLmultiplier)/get_pcvar_float(HPLVLmultiplier)/get_pcvar_float(HPLVLmultiplier));
        }
    }
    else
    {
        
hp_class[id] = hp;
    }
    
fm_set_user_health(idhp_class[id])
    
set_pev(idpev_gravityFloat:ArrayGetCell(g_hclass_gravg_heroesclass[id]))

    static 
currentmodel[32], tempmodel[32], iiRand
    g_has_custom_model
[id] = false

    fm_cs_get_user_model
(idcurrentmodelcharsmax(currentmodel))

    for (
ArrayGetCell(g_hclass_modelsstartg_heroesclass[id]); ArrayGetCell(g_hclass_modelsendg_heroesclass[id]); i++)
    {
        
ArrayGetString(g_hclass_playermodelitempmodelcharsmax(tempmodel))

        if (
equal(currentmodeltempmodel)) {
            
g_has_custom_model[id] = true
        
}
    }

    if (!
g_has_custom_model[id])
    {
        if(
Hitboxes[id])
            
fm_cs_set_user_model_index(idsavevalue[id])

        
iRand random_num(ArrayGetCell(g_hclass_modelsstartg_heroesclass[id]), ArrayGetCell(g_hclass_modelsendg_heroesclass[id]) - 1)
        
ArrayGetString(g_hclass_playermodeliRandg_playermodel[id], charsmax(g_playermodel[]))

        if (
ArrayGetCell(g_hclass_teamg_heroesclass[id]) == got_a_class_idmonster())
        {
            
fm_cs_set_user_model_index(idArrayGetCell(g_hclass_modelindexiRand))
        }
        else
        {
            
savevalue[id] = fm_cs_save_user_model_index(id)
            
Hitboxes[id] = true
        
}
    }

    if (!
g_has_custom_model[id])
    {
        if (
g_newround)
        {
            
set_task(5.0 g_modelchange_delay"fm_user_model_update"id+TASK_MODEL)
        }
        else
        {
            
fm_user_model_update(id+TASK_MODEL)
        }
    }

    
cs_set_user_zoom(idCS_RESET_ZOOM1)
    
native_ah_set_user_footsteps(id,false)
    
set_pev(idpev_armorvalue0.0)
    
fm_set_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,255)

    new 
wpnList[32],number
    get_user_weapons
(id,wpnList,number)

    for (new 
0;number ;i++) { 
        if (
wpnList[i] != CSW_KNIFE && wpnList[i] != CSW_C4
            
fm_strip_user_gun(idwpnList[i])
    }
    
    
client_cmd(id,"cl_forwardspeed 999")
    
client_cmd(id,"cl_backspeed 999")
    
client_cmd(id,"cl_sidespeed 999")
    
client_cmd(id,"weapon_knife")
    
native_reload_knife_models(id)
    
client_cmd(id,"stopsound")
    
ExecuteForward(g_fwSetAtribHerog_fwDummyResultid);
    return 
PLUGIN_CONTINUE
}

public 
event_round_start()
{
    
g_newround true
    
if(m_onoroff && is_plugin_loaded("[AH] Just Capture the Flag",false) == -1){ 
        if(
random_num(1,100) > 100-get_pcvar_num(chance)){ 
            if(
num_players() > 3)
            {    
                
set_task(5.0"task_newround"3028)
                
set_hudmessage(2505050HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
                
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"SPECIAL")    
                
PlaySound("fvox/beep.wav")
            } 
        }
    }
    return 
PLUGIN_CONTINUE


public 
num_players(){
    new 
num
    
static i
    
for (1<= g_maxplayersi++)
    {
        if(
is_user_valid_alive(i))
            
num++
    }
    return 
num
}

public 
task_newround()
{
    static 
players[32], numinewboss,team
    get_players
(playersnum"h")
    
newboss players[random(num)]
    if(
num || !is_user_connected(newboss) || !is_user_alive(newboss))
    {
        for(
0numi++){ 
            if(
is_user_alive(players[i])){
                
task_newround()
                break;
            }
        }
        return;
    }
    
especialround true
    
for (1<= g_maxplayersi++)
    {
        if(
is_user_connected(i)){
            
team fm_cs_get_user_team(i)
            if(
team == || team == ){
                
newjoin[i] = false
                save_team
(i)
                
save_idhero(i)
                
remove_bomb(i)
                if(
newboss == && g_isalive[i]){
                    
domonster(i)
                    
cs_set_user_team(iCS_TEAM_T)
                }
                else
                {
                    
cs_set_user_team(iCS_TEAM_CT)
                }
            }
        }
    }
}

public 
remove_bomb(id){
    new 
wpnList[32],number
    get_user_weapons
(id,wpnList,number
    for (new 
0;number ;i++) { 
        if (
wpnList[i] == CSW_C4
            
fm_strip_user_gun(idwpnList[i])
    }
}

public 
save_team(id){
    
Team[id] = fm_cs_get_user_team(id)
}

public 
save_idhero(id){
    
savedidhero[id] = g_heroesclass[id]
}

public 
load_team(){
    static 
a
    
for (1<= g_maxplayersa++)
    {
        if(
is_user_connected(a) && <= Team[a] <= && !newjoin[a]){
            if(
g_heroesclass[a] != savedidhero[a]){ 
                
g_heroesclassnext[a] = savedidhero[a]
                
herome(a)
            }
            if(
Team[a] == ){
                
cs_set_user_team(aCS_TEAM_CT)
            } else if(
Team[a] == 1) {
                
cs_set_user_team(aCS_TEAM_T)
            }
        }
    }
}

public 
load_teamNewPlayers(){

    static 
i,b
    
new team
    
new teamB 0
    
new teamR 0
    
for (1<= g_maxplayersi++)
    {
        if(
is_user_connected(i) && !newjoin[i]){
            
team fm_cs_get_user_team(i)
            if(
team == teamB++
            if(
team == teamR++
        }
    }
    for (
1<= g_maxplayersb++)
    {
        if(
is_user_connected(b)){
            if(
newjoin[b] && <= fm_cs_get_user_team(b) >= 2){
                if(
teamB <  teamR){
                    
cs_set_user_team(bCS_TEAM_CT)
                    
teamB++
                } else {
                    
cs_set_user_team(bCS_TEAM_T)
                    
teamR++
                }
                
random_hero(b)
                
set_task(0.1,"herome",b)
                
set_task(0.2"show_menu_hclass"b)
                
newjoin[b]= false
            
}
        }
    }
}

public 
domonster(id){
    
g_heroesclassnext[id] = got_a_class_idmonster()
    
herome(id);
}

public 
cmdmonster(idlevelcid){
    if (!
cmd_access(idlevelcid2)) {
        
console_print(id,"[AH] Monster NO enjoin lvl acces"
        return 
PLUGIN_HANDLED
    
}
    if(
especialround){
        
load_team();        
        
load_teamNewPlayers();
    }
    if(!
m_onoroff){
        
console_print(id,"[AH] Monster NO load plugin monster"
        return 
PLUGIN_HANDLED
    
}
    if(
is_plugin_loaded("[AH] Just Capture the Flag",false) > -1){
        
console_print(id,"[AH] Monster stoped CTF MODE ON!"
        return 
PLUGIN_HANDLED
    
}
    new 
arg[32]
    
read_argv(1,arg,31)
    new 
player cmd_target(id,arg,7)
    if (!
player
    {
        
console_print(id,"[AH] Monster NO player found"
        return 
PLUGIN_HANDLED
    
}
    static 
players[32], numiid2newboss
    get_players
(playersnum"h")
    if(
num && is_user_connected(player))
    {
        
newboss player
    
} else {
        
console_print(id,"[AH] Monster players num < 2");
        return 
PLUGIN_HANDLED
    
}
    
especialround true
    
for(0<  numi++)
    {
        
id2 players[i]
        if(
g_isalive[id2]){
            
remove_bomb(id2)
            
save_team(id2)
            
save_idhero(id2)

            if(
newboss != id2)
                
cs_set_user_team(id2CS_TEAM_CT)
        }
    }
    
domonster(newboss)
    
cs_set_user_team(newbossCS_TEAM_T)
    
remove_task(3028)
    return 
PLUGIN_HANDLED
}

public 
got_a_class_idmonster(){ 
    return 
classmonster;
}

public 
monster_onoroff(){
    static class, 
buffer2
    
for (class = 0; class < g_hclass_i; class++)
    {
        
buffer2 ArrayGetCell(g_hclass_team, class)
        if(
buffer2 == 0){
            return 
true;
        }
    }
    return 
false;
}

public 
event_start(){
    
g_newround false
    roundend 
false
}

public 
logevent_round_end(){
    
remove_task(3028)

    if(!
roundend){
        if(
especialround){
            if(
native_find_hero_monster()){
                
set_hudmessage(240100100HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
                
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"WIN_MONSTER")
                
PlaySound("spk x/x_laugh2.wav")
            }
            else {
                
set_hudmessage(656565HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
                
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"WIN_HEROES")
                
PlaySound("fvox/bell.wav")
            }
            
especialround false
            load_team
();
            
load_teamNewPlayers();
        } else if(!
find_hero_team(2)){
            
set_hudmessage(21139HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
            
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"WIN_RED")    
            
PlaySound("fvox/bell.wav")
        } else if(!
find_hero_team(1)){
            
set_hudmessage(343211HUD_EVENT_XHUD_EVENT_Y00.03.02.01.0, -1)
            
ShowSyncHudMsg(0g_MsgSync"%L"LANG_PLAYER"WIN_BLUE")    
            
PlaySound("fvox/bell.wav")
        }
        
roundend true
    
}
}

public 
fw_PlayerKilled(victimattackershouldgib)
{
    
g_isalive[victim] = false
}

public 
fw_PlayerPreThink(id)
{
    if (!
g_isalive[id])
        return;

    if (
g_heroesclassnext[id] != -1){
        
set_pev(idpev_maxspeedg_heroes_spd[id])
    }
    else if (
g_newround)
    {
        return;
    }
    else 
    {
        
set_pev(idpev_maxspeedg_heroes_spd[id])
    } 
    if(
slilentstep[id])
    {
        
set_pev(idpev_flTimeStepSound999)
    }
}

public 
fw_SetClientKeyValueid, const infobuffer[], const key[])
{
    if (
g_has_custom_model[id] && equalkey"model"))
        return 
FMRES_SUPERCEDE;

    return 
FMRES_IGNORED;
}

public 
fw_PlayerSpawn_Post(id)
{
    if (!
is_user_alive(id) || fm_cs_get_user_team(id) < 1){
        return;
    }

    
g_isalive[id] = true
    
new team fm_cs_get_user_team(id)
    new 
buffer2[33
    if(
g_heroesclass[id] != -1){
        
buffer2[id] = ArrayGetCell(g_hclass_teamg_heroesclass[id])

        if(
team == 2  && buffer2[id] != 2)
            
reset_vars(id1)

        else if(
team == 1  && buffer2[id] != 1)
            
reset_vars(id1)
    }

    if (
g_heroesclassnext[id] == -1){
        
random_hero(id)
        
set_task(0.1,"herome",id)
        
set_task(0.2"show_menu_hclass"id)
        
set_task(0.3"check_specialround"id)
    } else {
        
set_task(0.1,"herome",id)
    }
}

public 
random_hero(id){
    static class, 
buffer[33],numberCT[33],number[33]

    new 
numCT = -1
    
new numT = -1
    
new team fm_cs_get_user_team(id)
    if(
team == ){
        for (class = 
0; class < g_hclass_i; class++)
        {
            
buffer[id] = ArrayGetCell(g_hclass_team, class)
            if(
buffer[id] == 2){
                
numCT++
                
numberCT[numCT] = class
            }
            
        }
        
g_heroesclassnext[id] = numberCT[random_num(0,numCT)]
        static 
class_name[32]
        
ArrayGetString(g_hclass_nameg_heroesclassnext[id], class_namecharsmax(class_name))
    }
    else if(
team == ){
        for (class = 
0; class < g_hclass_i; class++)
        {
            
buffer[id] = ArrayGetCell(g_hclass_team, class)

            if(
buffer[id] == 1){
                
numT++
                
number[numT] = class
            }
        }
        
g_heroesclassnext[id] = number[random_num(0,numT)]
        static 
class_name[32]
        
ArrayGetString(g_hclass_nameg_heroesclassnext[id], class_namecharsmax(class_name))
    }
}

public 
check_specialround(id){
    if(
especialround && newjoin[id]){
        
save_team(id)
        
save_idhero(id)
        
remove_bomb(id)
        
cs_set_user_team(idCS_TEAM_CT)
    }
}

public 
fm_user_model_update(taskid)
{
    static 
Float:current_time
    current_time 
get_gametime()
    
    if (
current_time g_models_targettime >= g_modelchange_delay)
    {
        
fm_cs_set_user_model(taskid)
        
g_models_targettime current_time
    
}
    else
    {
        
set_task((g_models_targettime g_modelchange_delay) - current_time"fm_cs_set_user_model"taskid)
        
g_models_targettime g_models_targettime g_modelchange_delay
    
}
}

public 
fm_cs_set_user_model(taskid)
{
    
engfuncEngFunc_SetClientKeyValueID_MODELengfuncEngFunc_GetInfoKeyBufferID_MODEL ), "model"g_playermodel[ID_MODEL] )
    
g_has_custom_model[ID_MODEL] = true
}

reset_vars(idresetall)
{
    if (
resetall)
    {
        
g_heroesclass[id] = -1
        g_heroesclassnext
[id] = -1
        g_heroes_spd
[id] = 0.000001
        g_has_custom_model
[id] = false
        hp_class
[id] = 1
    
}
}

public 
fw_Item_Deploy_Post(weapon_ent)
{
    if (
pev_valid(weapon_ent) != 2)
        return 
HAM_IGNORED

    
static owner
    owner 
fm_cs_get_weapon_ent_owner(weapon_ent)
    
    static 
weaponid
    weaponid 
cs_get_weapon_id(weapon_ent)

    
replace_weapon_models(ownerweaponid)
    return 
HAM_IGNORED
}

replace_weapon_models(idweaponid)
{
    if(
g_heroesclass[id] == -1)
        return;

    switch (
weaponid)
    {
        case 
CSW_KNIFE:
        {
            static 
clawmodel[100]
            
ArrayGetString(g_hclass_clawmodelg_heroesclass[id], clawmodelcharsmax(clawmodel))
            
format(clawmodelcharsmax(clawmodel), "models/allheroes/%s"clawmodel)

            if(!
equali(clawmodel"models/allheroes/v_knife.mdl"))
            {
                
set_pev(idpev_viewmodel2clawmodel)
            }
            else
            {
                
set_pev(idpev_viewmodel2"models/v_knife.mdl")
                
set_pev(idpev_weaponmodel2"models/p_knife.mdl")
            }
        }
    }
}

public 
message_health(msg_idmsg_destmsg_entity)
{
    static 
health
    health 
get_msg_arg_int(1)

    if (
health 256)
        return;

    if (
health 256 == 0)
        
fm_set_user_health(msg_entitypev(msg_entitypev_health) + 1)

    
set_msg_arg_int(1get_msg_argtype(1), 255)
}

stock fm_cs_get_user_team(id)
{
    if (
pev_valid(id) != 2)
        return 
0

    
return get_pdata_int(idOFFSET_CSTEAMSOFFSET_LINUX);
}

stock fm_set_user_health(idhealth)
{
    if (
health 0)
        
set_pev(idpev_healthfloat(health))

    else
        
dllfunc(DLLFunc_ClientKillid);
}

stock fm_give_item(id, const item[])
{
    static 
ent
    ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem))

    if (!
pev_valid(ent))
        return;
    
    static 
Float:originF[3]
    
pev(idpev_originoriginF)
    
set_pev(entpev_originoriginF)
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN)
    
dllfunc(DLLFunc_Spawnent)
    
    static 
save
    save 
pev(entpev_solid)
    
dllfunc(DLLFunc_Touchentid)
    if (
pev(entpev_solid) != save)
        return;
    
    
engfunc(EngFunc_RemoveEntityent)
}

stock fm_cs_get_user_model(playermodel[], len)
{
    
get_user_info(player"model"modellen)
}

stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16)
{
    static 
Float:color[3]
    
color[0] = float(r)
    
color[1] = float(g)
    
color[2] = float(b)
    
    
set_pev(entitypev_renderfxfx)
    
set_pev(entitypev_rendercolorcolor)
    
set_pev(entitypev_rendermoderender)
    
set_pev(entitypev_renderamtfloat(amount))
}

stock fm_cs_get_weapon_ent_owner(ent)
{
    return 
get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS);
}

public 
native_ah_set_heroes_hp(idhp)
{
    if (
hp <= 0)
        return 
0;
    
    
hp_class[id] = hp
    
return 1;
}

public 
native_ah_set_heroes_spd(idFloat:spd)
{
    if (
spd <= 0)
        return 
0;
    
    
g_heroes_spd[id] = spd
    
return 1;
}

public 
native_ah_get_heroes_spd(id)
{
    return 
floatround(g_heroes_spd[id]);
}

public 
native_ah_num_heroes()
{
    return 
g_hclass_i;
}

public 
native_get_user_heroes_class(id)
{
    if(
g_heroesclass[id] == -1)
        return 
false;

    return 
g_heroesclass[id];
}

public 
native_is_hero_monster(id)
{
    if(
g_heroesclass[id] == got_a_class_idmonster())
        return 
true;

    return 
false;
}

public 
native_find_hero_monster(){
    static 
i
    
for (1<= g_maxplayersi++)
    {
        if(
g_isalive[i])
        {
            if(
native_is_hero_monster(i))
                return 
true;
        }
    }
    return 
false;
}

public 
find_hero_team(team){
    static 
inumteam 
    numteam 
0
    
for (1<= g_maxplayersi++)
    {
        if(
g_isalive[i]){
            if(
fm_cs_get_user_team(i) == team)
                
numteam++
        }
    }
    return 
numteam;
}

public 
native_get_hp_class(id){
    if(
hp_class[id])
        return 
hp_class[id];

    return 
0;
}

public 
native_ah_get_hero_name(idnumParams
{
    static 
class_name[32]
    if(
g_heroesclass[get_param(1)] == -1){
        
copy(class_namecharsmax(class_name), "NONE")    
        
set_string(2class_nameget_param(3));
    } else {
        
ArrayGetString(g_hclass_nameg_heroesclass[get_param(1)], class_namecharsmax(class_name))
        
set_string(2class_nameget_param(3));
    }
    return 
1;
}

public 
native_reload_knife_models(id
{
    if(
g_heroesclass[id] == -1)
        return;
    static 
clawmodel[100]
    
ArrayGetString(g_hclass_clawmodelg_heroesclass[id], clawmodelcharsmax(clawmodel))
    
format(clawmodelcharsmax(clawmodel), "models/allheroes/%s"clawmodel)

    if(!
equali(clawmodel"models/allheroes/v_knife.mdl"))
    {
        
set_pev(idpev_viewmodel2clawmodel)
    }
    else
    { 
        
set_pev(idpev_viewmodel2"models/v_knife.mdl")
        
set_pev(idpev_weaponmodel2"models/p_knife.mdl")
    }
}

public 
event_curweapon(id)
{
    if(!
is_user_valid_alive(id))
        return 
PLUGIN_CONTINUE;

    new 
weaponIDread_data(2)
    if(
weaponID == || weaponID==CSW_C4 || weaponID==CSW_KNIFE || weaponID==CSW_HEGRENADE || weaponID==CSW_SMOKEGRENADE || weaponID==CSW_FLASHBANG)
        return 
PLUGIN_CONTINUE;
    
    if(
cs_get_user_bpammo(idweaponID)!=CSW_MAXAMMO[weaponID])
        
cs_set_user_bpammo(idweaponIDCSW_MAXAMMO[weaponID])

    return 
PLUGIN_CONTINUE;
}

stock bool:fm_strip_user_gun(indexwid 0, const wname[] = "") {
    new 
ent_class[32];
    if (!
wid && wname[0])
    {
        
copy(ent_classsizeof ent_class 1wname);
    }
    else
    {
        new 
weapon widclipammo;
        if (!
weapon && !(weapon get_user_weapon(indexclipammo)))
            return 
false;
        
        
get_weaponname(weaponent_classsizeof ent_class 1);
    }

    new 
ent_weap fm_find_ent_by_owner(-1ent_classindex);
    if (!
ent_weap)
        return 
false;

    
engclient_cmd(index"drop"ent_class);

    new 
ent_box pev(ent_weappev_owner);
    if (!
ent_box || ent_box == index)
        return 
false;

    
dllfunc(DLLFunc_Thinkent_box);
    return 
true;
}

stock fm_find_ent_by_owner(index, const classname[], ownerjghgtype 0) {
    new 
strtype[11] = "classname"ent index;
    switch (
jghgtype) {
        case 
1strtype "target";
        case 
2strtype "targetname";
    }

    while ((
ent engfunc(EngFunc_FindEntityByStringentstrtypeclassname)) && pev(entpev_owner) != owner)
    {
    }

    return 
ent;
}

stock fm_cs_set_user_model_index(idvalue)
{
    if (
pev_valid(id) != 2)
        return

    
set_pdata_int(id491valueOFFSET_LINUX)
}

stock fm_cs_save_user_model_index(id)
{
    if (
pev_valid(id) != 2)
        return 
0

    
new value get_pdata_int(id,491,OFFSET_LINUX);
    return 
value;
}

stock cs_set_user_team2(index, {CsTeams,_}:teamupdate 1)
{
    if (
pev_valid(index) != 2)
        return 
0

    set_pdata_int
(index114_:team)
    
set_pev(indexpev_team_:team)

    if(
update)
    {
        
message_begin(MSG_BROADCASTg_msg_teaminfo)
        
write_byte(index)
        
write_string(teaminfo[_:team])
        
message_end()
    }
    return 
1
}

PlaySound(const sound[])
{
    
client_cmd(0"spk ^"%s^""sound)


Last edited by Unban; 11-29-2014 at 16:53.
Unban is offline
Send a message via Skype™ to Unban
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-29-2014 , 17:14   Re: AMXModX 1.8.3 FATAL ERROR, HELP
Reply With Quote #4

I can't test your plugin as it is, but tried just by hooking ShowMenu and VGuiMenu ; and sending a new menu, and I can't reproduce. So, what to do to reproduce? In case of your plugin, it happens when exactly?
__________________
Arkshine 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:35.


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