AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   CurWeapon and AMMOX problem (https://forums.alliedmods.net/showthread.php?t=313258)

tolpecek 01-02-2019 13:54

CurWeapon and AMMOX problem
 
Hello, i have a problem with curweapon and ammox, it crashes server randomly with message
PF_MessageBegin_I: New message started when msg '66' has not been sent yet
PF_MessageBegin_I: New message started when msg '99' has not been sent yet

Code:

register_event("CurWeapon" , "ev_CurWeapon" , "be" , "1=1");
register_event("AmmoX", "ev_AmmoX", "be", "1=1", "1=2", "1=3", "1=4", "1=5", "1=6", "1=7", "1=8", "1=9", "1=10")

Code:

public ev_CurWeapon(id)
{   
       
        if(read_data(2) == CSW_KNIFE)
        {
                if(cs_get_user_team(id) == CS_TEAM_T)
                {
                        set_pev(id, pev_viewmodel2, KNIFE2)
                }
        }
       
        if (g_iszombie[id])
        {
                new Float:SPLevel = float(g_unSPLevel[id])
                SPLevel*=5
                set_user_maxspeed(id, 260.0+SPLevel)
        }
        else if (g_item_oma[id])
        {
                static wpnid, clip;
                wpnid = read_data(2);
                clip = read_data(3);
               
                if(wpnid==CSW_C4 || wpnid==CSW_KNIFE || wpnid==CSW_HEGRENADE || wpnid==CSW_SMOKEGRENADE || wpnid==CSW_FLASHBANG )
                        return PLUGIN_HANDLED;
               
                if(!clip)
                {
                        static weapname[33];
                        get_weaponname(wpnid , weapname , 32);
                       
                        static wpn
                        wpn = -1;
                        while((wpn = find_ent_by_class(wpn , weapname)) != 0)
                        {
                                if(id == entity_get_edict(wpn , EV_ENT_owner))
                                {
                                        cs_set_weapon_ammo(wpn , maxclip(wpnid))
                                        break;
                                }
                        }
                }
        }
        return PLUGIN_HANDLED
}

Code:

public ev_AmmoX(id)
{
        set_pdata_int(id, AMMO_SLOT + read_data(1), 200, 5)
}

thank u all

tolpecek 01-02-2019 14:14

Re: CurWeapon and AMMOX problem
 
Last time it crashed while one player was reloading
and it was after i removed ammox event


All times are GMT -4. The time now is 07:30.

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