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=107320)

One 10-25-2009 07:44

ED_Alloc: no free edicts
 
PHP Code:

if(is_user_alive(id))
                {
                    
set_user_maxspeed(id,0.0)
                    
strip_user_weaponsid )
                    
set_user_godmode(id,1)
                    
fade_2_black(id1);
                    
message_begin(MSG_ALLget_user_msgid("ScoreAttrib"),{0,0,0},0
                    
write_byte(id
                    
write_byte(4
                    
message_end() 

                }

stock fade_2_black(idtype)
{
    
message_begin(MSG_ONE_UNRELIABLEgmsgScreenFade_id);
    
write_short(5000);
    
write_short(5000);
    
write_short(type==1?5:0);
    
write_byte(0);
    
write_byte(20);
    
write_byte(40);
    
write_byte(255);
    
message_end();
}

gmsgScreenFade    get_user_msgid("ScreenFade"); 

:( error = ED_Alloc: no free edicts

know anyone a better way to made black fade?
or just do 30 sec. black fade on player :P

Arkshine 10-25-2009 07:50

Re: ED_Alloc: no free edicts
 
I doubt the error is because of this code.

This error is more you use too much entities at once. There is a limit which can be calculated like this :max_entities = 900 + 15 * ( max_clients - 1 ).

You can define a custom value to up the limit using the switch "-num_edicts" in your line command line. eg : [...] -map blabla -num_edicts 2047

If you can't it's probably a plugin badly coded which don't remove properly entities which create or a plugin which create too much entities at once.


About the black fade, you maye be interested by this stock.

One 10-25-2009 07:55

Re: ED_Alloc: no free edicts
 
ty.
i tried this one here but i get errors :


PHP Code:

UTIL_FadeToBlack(id,30.0,false,true

idk why i cant compile my code with this :(

Arkshine 10-25-2009 07:57

Re: ED_Alloc: no free edicts
 
What's the error ?

One 10-25-2009 07:59

Re: ED_Alloc: no free edicts
 
Warning: Expression has no effect on line 140

:(

edit: i got it but the same error ( ED_Alloc: no free edicts ):(

Arkshine 10-25-2009 08:02

Re: ED_Alloc: no free edicts
 
Show more code, your error is not from this line.

One 10-25-2009 08:03

Re: ED_Alloc: no free edicts
 
here the full code

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <screenfade_util>

new g_spieler_anzahl_checked 0
new g_first_round 0
new g_MaxPlayers

public plugin_init() 
{
    
register_plugin("Versteck dich""1.0""Dr.One")
    
register_event("HLTV""Start_new_round""a""1=0""2=0")
    
g_MaxPlayers get_maxplayers()
    
register_logevent("round_end"2"1=Round_End")
    
register_event"ResetHUD""Event_ResetHUD""be" );
}
public 
Start_new_round()
{
    
/*Zuerst abfrage für spieler anzhal auf dem server*/
    
new g_Spieler_anzahl;
    
g_Spieler_anzahl get_playersnum(1);
    
    
/*nun abfragen ob wir das spiel stanten können*/
    
if( g_Spieler_anzahl && g_spieler_anzahl_checked == 0)
    {
        
Start_the_MOD()
        
client_print(0,print_chat,"Enough players on server!The game has begonn")
        
server_cmd("sv_restart 10")
        
g_spieler_anzahl_checked 1
        g_first_round 
1
    
}
    else if( 
g_Spieler_anzahl 3)
    {
        
client_print(0,print_chat,"Not enough players on server!Waiting for more players to begin the game")
        
g_spieler_anzahl_checked 0
    
}
    else if(
g_spieler_anzahl_checked == && g_Spieler_anzahl 3)
    {
        
g_spieler_anzahl_checked 0
        g_first_round 
0
    
}
}
public 
Start_the_MOD()
{
    
/*alles für erste runde kommt hier rein*/
    
client_print(0,print_chat,"ich wills")
    
/*fürs erste setzen wir alle in T*/
    
for(new id 1id <= g_MaxPlayersid++)
    {
        if(
is_user_connected(id))
        {
            
cs_set_user_team(id,CS_TEAM_T)
        }
    }
    
/*jetzt einer geht Random zu CT*/
    
new iPlayers32 ], iNumiPlayer;
    
get_playersiPlayersiNum );
    
    
iPlayer iPlayersrandomiNum ) ];
    if(
is_user_connected(iPlayer)||cs_get_user_team(iPlayer) == CS_TEAM_CT || cs_get_user_team(iPlayer) == CS_TEAM_T)
    {
        
cs_set_user_team(iPlayer,CS_TEAM_CT)
    }
}
public 
round_end()
{
    if(
g_spieler_anzahl_checked == 1)
    {
        new 
alive_Ts[33], Ts[33], alive_CTs[33], CTs[33]
        new 
alive_Ts_numTs_numalive_CTs_numCTs_numid
        
for(new 1<= g_MaxPlayersi++)
        {
            if(!
is_user_connected(i))
                continue
                
            switch(
cs_get_user_team(i))
            {
                case 
CS_TEAM_CT:
                {
                    
CTs[CTs_num++] = i
                    
if(is_user_alive(i))
                    
alive_CTs[alive_CTs_num++] = i
                
}
                case 
CS_TEAM_T:
                {
                    
Ts[Ts_num++] = i
                    
if(is_user_alive(i))
                    
alive_Ts[alive_Ts_num++] = i
                
}
            }
        }

        if(
CTs_num Ts_num 2)
            return  
// not enough players
    
        
if(alive_Ts_num 0)
        {
            
cs_set_user_team(alive_Ts[random(alive_Ts_num)], CS_TEAM_CT)
        }
        
        else if(
alive_CTs_num 0)
        {
            
id alive_CTs[random(alive_CTs_num)]
        }
            
        else if(
Ts_num 0)
        {
            
cs_set_user_team(Ts[random(Ts_num)], CS_TEAM_CT)
        }
            
        else if(
CTs_num 0)
        {
            
id CTs[random(CTs_num)]
        }

        for(new 
i=0i<CTs_numi++)
        {
            if(
CTs[i] != id)
            
cs_set_user_team(CTs[i], CS_TEAM_T)
        }
    }
}
public 
Event_ResetHUD()
{
    if(
g_spieler_anzahl_checked == 1)
    {
        for(new 
id 1id <= g_MaxPlayersid++)
        {
            if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
            {
                
                
//return PLUGIN_HANDLED 
                
if(is_user_alive(id))
                {
                    
set_user_maxspeed(id,0.0)
                    
strip_user_weaponsid )
                    
set_user_godmode(id,1)
                    
UTIL_FadeToBlack(id,30.0,false,true
                    
//message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"),{0,0,0},0) 
                    //write_byte(id) 
                    //write_byte(4) 
                    //message_end() 

                
}
                    
            }
        }
    }



Arkshine 10-25-2009 08:26

Re: ED_Alloc: no free edicts
 
Your plugin compiles fine.

Don't use ResetHud, use Ham_Spaw, btw.

One 10-25-2009 09:58

Re: ED_Alloc: no free edicts
 
1 Attachment(s)
Quote:

Originally Posted by Arkshine (Post 971663)
Your plugin compiles fine.

Don't use ResetHud, use Ham_Spaw, btw.

:(

Arkshine 10-25-2009 10:32

Re: ED_Alloc: no free edicts
 
Did you do the change I said above ?


All times are GMT -4. The time now is 17:34.

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