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

Solved Problem with plugin after installing newest RegameDLL


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gooday
Junior Member
Join Date: Jan 2024
Old 05-15-2024 , 14:57   Problem with plugin after installing newest RegameDLL
Reply With Quote #1

Hey there, so I installed newest regamedll 5.26, because my csstatsX doesn't work with older versions.
And I encounter a problem. I have a plugin(support is dead for years there). It's HNS DM, so the problem is, on older regamedll version when Terrorist dies by falling from the height , random CT become a Terrorist.
It does work on regamedll 5.21.0.576 but my csstatsX otherwise.

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <fun>

new const g_Plugin[] = "HNS Deathmatch";
new const 
g_Version[] = "2.2.1";
new const 
g_Author[] = "Jon";

#define m_fHasPrimary 116
#define m_iJoinedState 121
#define m_iMenu 205

#define MENU_CHOOSETEAM    1
#define MENU_CHOOSEAPPEARANCE    3

new g_CvarEnable,
    
g_CvarGameName,
    
g_CvarStabOnly,
    
g_CvarRespawnDelay,
    
g_CvarProtectionTime,
    
g_CvarNoFlash,
    
g_CvarHidersFlashbangs,
    
g_CvarHidersSmokegrenade,
    
g_CvarHidersHegrenade,
    
g_CvarSeekersFlashbangs,
    
g_CvarSeekersSmokegrenade,
    
g_CvarSeekersHegrenade,

    
Trie:g_tBuyAliases
    
Trie:g_tRemoveEntities

public plugin_init() 
{
    
register_plugin(g_Pluging_Versiong_Author);
    
set_pcvar_string(
        
register_cvar("hns_deathmatch_version"g_VersionFCVAR_SERVER),
        
g_Version
    
)
    
    
g_CvarEnable register_cvar("hnsdm_enable""1");
    
    if(!
get_pcvar_num(g_CvarEnable))
        return
    
    new 
gamename[32];
    
formatex(gamenamecharsmax(gamename), "%s %s"g_Pluging_Version);

    
g_CvarGameName register_cvar("hnsdm_gamename"gamename);
    
g_CvarStabOnly register_cvar("hnsdm_stabonly""1");
    
g_CvarRespawnDelay register_cvar("hnsdm_respawndelay""1.5");
    
g_CvarProtectionTime register_cvar("hnsdm_protectiontime""5.0");
    
g_CvarNoFlash register_cvar("hnsdm_noflash""1");
    
g_CvarHidersFlashbangs register_cvar("hnsdm_hiders_flashbangs""1")
    
g_CvarHidersSmokegrenade register_cvar("hnsdm_hiders_smokegrenade""1")
    
g_CvarHidersHegrenade register_cvar("hnsdm_hiders_hegrenade""0")
    
g_CvarSeekersFlashbangs register_cvar("hnsdm_seekers_flashbangs""0")
    
g_CvarSeekersSmokegrenade register_cvar("hnsdm_seekers_smokegrenade""0")
    
g_CvarSeekersHegrenade register_cvar("hnsdm_seekers_hegrenade""0")
    
    
register_event("DeathMsg""eventDeathMsg""a");
    
register_message(get_user_msgid("ScreenFade"), "msgScreenFade");
    
    
register_forward(FM_CmdStart"fwdCmdStart");
    
register_forward(FM_GetGameDescription,"fwdGetGameDescription");
    
    
RegisterHam(Ham_Spawn"player""eventPlayerSpawn"1);

    
register_clcmd("buy""HandleBlock");
    
register_clcmd("buyammo1""HandleBlock");
    
register_clcmd("buyammo2""HandleBlock");
    
register_clcmd("buyequip""HandleBlock");
    
register_clcmd("cl_autobuy""HandleBlock");
    
register_clcmd("cl_rebuy""HandleBlock");
    
register_clcmd("cl_setautobuy""HandleBlock");
    
register_clcmd("cl_setrebuy""HandleBlock");
    
register_clcmd("chooseteam""HandleBlock");
    
register_clcmd("say /respawn""RespawnPlayer");

    
register_clcmd("jointeam""ClCmd_jointeam")
    
register_clcmd("joinclass""ClCmd_joinclass")
    
register_clcmd("menuselect""ClCmd_joinclass")

    new 
BuyCommands[][] =
    {
        
"usp""glock""deagle""p228""elites",
        
"fn57""m3""xm1014""mp5""tmp""p90",
        
"mac10""ump45""ak47""galil""famas",
        
"sg552""m4a1""aug""scout""awp""g3sg1",
        
"sg550""m249""vest""vesthelm""flash",
        
"hegren""sgren""defuser""nvgs""shield",
        
"primammo""secammo""km45""9x19mm""nighthawk",
        
"228compact""fiveseven""12gauge""autoshotgun",
        
"mp""c90""cv47""defender""clarion""krieg552",
        
"bullpup""magnum""d3au1""krieg550",
        
"buy""buyequip""buyammo1""buyammo2"
    
}

    
g_tBuyAliases TrieCreate()
    for(new 
ii<sizeofBuyCommands ); i++)
    {
        
strtolowerBuyCommands[i] )
        
TrieSetCell(g_tBuyAliasesBuyCommands[i], 1)
    }
}

public 
plugin_precache()
{
    new 
EntityClassNames[][] = 
    {
        
"func_breakable"
        
"func_door_rotating"
        
"func_door"
        
"func_vip_safetyzone"
        
"func_escapezone"
        
"hostage_entity"
        
"monster_scientist"
        
"func_bomb_target"
        
"info_bomb_target"
    
}
    
    
g_tRemoveEntities TrieCreate()
    for(new 
ii<sizeofEntityClassNames ); i++)
    {
        
TrieSetCell(g_tRemoveEntitiesEntityClassNames[i], 1)
    }
}

public 
ClCmd_jointeamid )
{
    if( 
get_pdata_int(idm_iMenu) != MENU_CHOOSETEAM )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
ClCmd_joinclassid )
{
    if( 
get_pdata_int(idm_iMenu) == MENU_CHOOSEAPPEARANCE )
    {
        
set_task(get_pcvar_float(g_CvarRespawnDelay), "RespawnPlayer"id)
    }
    return 
PLUGIN_CONTINUE
}

public 
eventDeathMsg()
{
    new 
killer read_data(1)
    new 
victim read_data(2)
    
    if(
killer == 0
    {
        if( 
cs_get_user_team(victim) == CS_TEAM_T )
        {
            new 
lucky GetRandomCT();
            if( 
lucky )
            {
                
cs_set_user_team(luckyCS_TEAM_T)
                
client_print(luckyprint_chat"[HNS] An idiot jumped off and you were lucky and got transfered to Terrorist.")
                
                
cs_set_user_team(victimCS_TEAM_CT);
                
                
GiveItems(lucky)
                
SetStealth(lucky)
            }
        }
    }
    else if(
killer != victim && cs_get_user_team(killer) == CS_TEAM_CT)
    {
        
cs_set_user_team(killerCS_TEAM_T); 
        
cs_set_user_team(victimCS_TEAM_CT); 
        
        
GiveItems(killer)
        
SetStealth(killer)
    }
            
    
set_task(get_pcvar_float(g_CvarRespawnDelay), "RespawnPlayer"victim)
}

public 
eventPlayerSpawn(id
{
    if(
is_user_alive(id)) GiveItems(id);
}

public 
RespawnPlayer(id
{
    if(!
is_user_alive(id)) ExecuteHam(Ham_CS_RoundRespawnid);    
}

public 
fwdCmdStart(idhandleseed)
{
    if(     
get_pcvar_num(g_CvarStabOnly)
    &&    
is_user_alive(id)
    &&    
cs_get_user_team(id) == CS_TEAM_CT
    
&&    get_user_weapon(id) == CSW_KNIFE    )
    {        
        static 
button
        button 
get_uc(handleUC_Buttons)

        if(
button IN_ATTACK)
        {
            
set_uc(handleUC_Buttons, (button & ~IN_ATTACK) | IN_ATTACK2)
            return 
FMRES_HANDLED
        
}
    }
  if(     
get_pcvar_num(g_CvarStabOnly)
    &&    
is_user_alive(id)
    &&    
cs_get_user_team(id) == CS_TEAM_T
    
&&    get_user_weapon(id) == CSW_KNIFE    )
    {        
        static 
button
        button 
get_uc(handleUC_Buttons)

        if((
button IN_ATTACK) | (button IN_ATTACK2))
        {
            
set_uc(handleUC_Buttons, (button & ~IN_ATTACK) & (button & ~IN_ATTACK2))
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED
}

public 
client_kill(id)
{
    return 
PLUGIN_HANDLED
}

public 
pfn_spawn(ent)
{
    if( 
is_valid_entent ) )
    {
        new class[
32]
        
pev(entpev_classname, class, charsmax(class))
        if( 
TrieKeyExists(g_tRemoveEntities, class) )
        {
            
remove_entity(ent)
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
fwdGetGameDescription()
{
    static 
gamename[32];
    if( 
get_pcvar_string(g_CvarGameNamegamenamecharsmax(gamename)) )
    {
        
forward_return(FMV_STRINGgamename)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}

public 
msgScreenFade(msgiddestid)
{
    if(        
is_user_alive(id)
    &&    
get_pcvar_num(g_CvarNoFlash) & _:cs_get_user_team(id)
    &&    
get_msg_arg_int(4) == 255
    
&&    get_msg_arg_int(5) == 255
    
&&    get_msg_arg_int(6) == 255
    
&&    get_msg_arg_int(7) > 199    )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_command(id)
{
    new 
sArg[13];
    
    if(
read_argv(0sArg12) > 11) return PLUGIN_CONTINUE

    strtolower
(sArg)
    if( 
TrieKeyExists(g_tBuyAliasessArg) )
    {
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
HandleBlock(id) return PLUGIN_HANDLED
    
public UnsetStealth(id)
{
    
set_user_rendering(id_000_0);
}

SetStealth(id)
{
    if(
get_user_health(id) != 100)
        
set_user_health(id100)
        
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransColor0);
    
set_task(get_pcvar_float(g_CvarProtectionTime), "UnsetStealth"id)
}

GiveItems(id)
{
    
cs_strip_user_weapons(id)
    
    switch( 
cs_get_user_team(id) )
    {
        case 
CS_TEAM_T:
        {    
    
give_item(id"weapon_knife")
            if(
get_pcvar_num(g_CvarHidersFlashbangs))
            {
                
give_item(id"weapon_flashbang")
                
cs_set_user_bpammo(idCSW_FLASHBANGget_pcvar_num(g_CvarHidersFlashbangs))
            }
            
            if(
get_pcvar_num(g_CvarHidersSmokegrenade))
                
give_item(id"weapon_smokegrenade")
                
            if(
get_pcvar_num(g_CvarHidersHegrenade))
                
give_item(id"weapon_hegrenade")
        }
        
        case 
CS_TEAM_CT:
        {
            
give_item(id"weapon_knife")
                
            if(
get_pcvar_num(g_CvarSeekersFlashbangs))
            {
                
give_item(id"weapon_flashbang")
                
cs_set_user_bpammo(idCSW_FLASHBANGget_pcvar_num(g_CvarSeekersFlashbangs))
            }
            
            if(
get_pcvar_num(g_CvarSeekersSmokegrenade))
                
give_item(id"weapon_smokegrenade")
                
            if(
get_pcvar_num(g_CvarSeekersHegrenade))
                
give_item(id"weapon_hegrenade")
        }
    }
}

GetRandomCT()
{
    static 
iPlayers[32], iCT_num
    get_players
(iPlayersiCT_num"ae""CT");
        
    if(!
iCT_num)
        return 
0
        
    
return iCT_num iPlayers[random(iCT_num)] : iPlayers[iCT_num 1];
}

cs_strip_user_weapons(id)
{
    
strip_user_weapons(id)
    
set_pdata_int(idm_fHasPrimary0)

I think the problem is here, but I'm not sure
PHP Code:
public eventDeathMsg()
{
    new 
killer read_data(1)
    new 
victim read_data(2)
    
    if(
killer == 0
    {
        if( 
cs_get_user_team(victim) == CS_TEAM_T )
        {
            new 
lucky GetRandomCT();
            if( 
lucky )
            {
                
cs_set_user_team(luckyCS_TEAM_T)
                
client_print(luckyprint_chat"[HNS] An idiot jumped off and you were lucky and got transfered to Terrorist.")
                
                
cs_set_user_team(victimCS_TEAM_CT);
                
                
GiveItems(lucky)
                
SetStealth(lucky)
            }
        }
    } 
Thanks for your attention

Last edited by Gooday; 05-15-2024 at 18:47.
Gooday is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old 05-15-2024 , 16:35   Re: Problem with plugin after installing newest RegameDLL
Reply With Quote #2

Quote:
Originally Posted by Gooday View Post
Hey there, so I installed newest regamedll 5.26, because my csstatsX doesn't work with older versions.
And I encounter a problem. I have a plugin(support is dead for years there). It's HNS DM, so the problem is, on older regamedll version when Terrorist dies by falling from the height , random CT become a Terrorist.
It does work on regamedll 5.21.0.576 but my csstatsX otherwise.
There has been a change in the DeathMsg event https://github.com/s1lentq/ReGameDLL...tag/5.26.0.668
Idk what that change specifically is but in 5.26 the killer is shown as yourself while in previous versions the killer is shown as world(0). So changing
PHP Code:
    if(killer == 0
to
PHP Code:
    if(killer == victim
will fix it.

Last edited by v120kaaimcfg; 05-15-2024 at 16:38.
v120kaaimcfg is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-15-2024 , 17:55   Re: Problem with plugin after installing newest RegameDLL
Reply With Quote #3

There is nothing wrong the killer is expected to be the world, if you want to add more logic to it add what v120kaaimcfg suggested

PHP Code:
if(!killer || victim == killer
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Gooday
Junior Member
Join Date: Jan 2024
Old 05-15-2024 , 18:46   Re: Problem with plugin after installing newest RegameDLL
Reply With Quote #4

v120kaaimcfg, thanks a lot, it helped!)
Have a nice day/night!)
Gooday is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old 05-15-2024 , 18:59   Re: Problem with plugin after installing newest RegameDLL
Reply With Quote #5

Quote:
Originally Posted by Gooday View Post
v120kaaimcfg, thanks a lot, it helped!)
Have a nice day/night!)
Natsheh's suggestion is better. Oversight on my part.
v120kaaimcfg 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 07:01.


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