AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ED_Alloc: no free edicts (https://forums.alliedmods.net/showthread.php?t=93714)

alan_el_more 06-01-2009 07:52

ED_Alloc: no free edicts
 
hi,
i have this:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>

#define VERSION "1.2"

new g_enableg_hudkf_enableknife_fightg_maxplayers
new g_IsBot[33], g_IsConnected[33]

public 
plugin_init()
{
    
register_plugin("Knife Fight""VERSION""alan_el_more")
    
register_cvar("kf_version"VERSIONFCVAR_SERVER)
    
register_dictionary("Knife_Fight.txt")
    
g_enable register_cvar("kf_enable""1")
    
g_hud register_cvar("kf_hud""1")
    
register_clcmd("say /kf""cmdkf"ADMIN_KICK)
    
register_clcmd("buy""cmdbuy")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeapon")
    
RegisterHam(Ham_Touch"armoury_entity""fw_TouchWeapon")
    
RegisterHam(Ham_Touch"weapon_shield""fw_TouchWeapon")
    
g_maxplayers get_maxplayers()
}

public 
cmdkf(idlevelcid)
{
    if(
get_pcvar_num(g_enable))
    {
        if (!
cmd_access(idlevelcid1))
            return 
PLUGIN_HANDLED;
        
        if(
kf_enable)
        {
            
client_print(idprint_chat"[KF] %L"id"ALREADY_ENABLE")
            return 
PLUGIN_HANDLED;
        }
        
        if(
get_pcvar_num(g_hud))
        {
            new 
name[33]
            
get_user_name(idname32)
            
set_hudmessage(255000.30.010.05.01.01.0, -1)
            
show_hudmessage(0"[KF] %L"LANG_PLAYER"HUD_ENABLE"name)
        }
        
        
kf_enable true
    
}
    else
        
client_print(idprint_chat"[KF] %L"id"KF_DISABLE")
    
    return 
PLUGIN_CONTINUE
}

public 
event_round_start()
{
    if(!
kf_enable)
        return 
PLUGIN_HANDLED
    
    
if(!knife_fight)
        
knife_fight true
    
else
        
knife_fight false
    
    set_hudmessage
(255000.30.010.05.01.01.0, -1)
    
show_hudmessage(0"[KF] %L"LANG_PLAYER"HUD_FK")
    
    for(new 
id 1id <= g_maxplayersid++)
    {
        if(
is_user_alive(id))
        {
            
strip_user_weapons(id)
            
give_item(id"weapon_knife")
        }
    }
    
    
kf_enable false
    
    
return PLUGIN_CONTINUE
}

public 
fw_TouchWeapon(weaponid)
{
    if (
knife_fight && (<= id <= g_maxplayers) && !g_IsBot[id])
        return 
HAM_SUPERCEDE;
    
    return 
HAM_IGNORED;
}

public 
cmdbuy(id)
{
    if(
knife_fight)
        return 
PLUGIN_CONTINUE
        
    
return PLUGIN_HANDLED
}

public 
client_putinserverid )
{
    
g_IsConnected[id] = true;
    
    
g_IsBot[id] = is_user_bot(id)


The problem is that when start a round with the knife fight on, the error (ED_Alloc: no free edicts) appears :S

Arkshine 06-01-2009 10:33

Re: ED_Alloc: no free edicts
 
It's probably because of another plugin. This error happens when there are too many entities spawn in the map. I guess when you strip all the weapons, the free entities are used by another plugin and when you when to readd the knife there are already no more available entities, I think.

It happens whatever the maps ? Did you try to use onyl this plugin ?

alan_el_more 06-02-2009 10:09

Re: ED_Alloc: no free edicts
 
I tried it only with zombie plague deactivated and only in cs_assault

AntiBots 06-02-2009 17:17

Re: ED_Alloc: no free edicts
 
You Can Use Ham_Spawn Post, And Check This

PHP Code:

    if(!knife_fight)
        
knife_fight true
    
else
        
knife_fight false 

</SPAN>

And This:
PHP Code:

register_plugin("Knife Fight""VERSION""alan_el_more"

</SPAN>

Sylwester 06-03-2009 06:56

Re: ED_Alloc: no free edicts
 
I think it works wrong because you are trying to give/strip player weapons in new round. Try to do it in player spawn and add some delays.

PHP Code:

register_event("HLTV""event_round_start""a""1=0""2=0"

this is new round (players are not spawned yet), not round start


All times are GMT -4. The time now is 13:55.

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