AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Server crashes in Dodgeball Day (https://forums.alliedmods.net/showthread.php?t=253657)

Fuck For Fun 12-26-2014 05:42

Server crashes in Dodgeball Day
 
I give here everything related to Dodgeball
There is no Error logs

The problem is when I turn Day
After 5 seconds that I hold the ball or throw the server falls (crashed)


It's all about Dodgeball.
PHP Code:

/* Plugin generated by AMXX-Studio */

#include < amxmodx >

new const g_szDodgeballViewModel[] = "models/Days/v_dodgeball.mdl";
new const 
g_szDodgeballWeaponModel[] = "models/Days/p_dodgeball.mdl";
new const 
g_szDodgeballWorldModel[] = "models/Days/w_dodgeball.mdl";
new const 
g_szDodgeballSound[] = "Days/dodgeball_bounce.wav";

public 
plugin_init()
{
    
register_messageget_user_msgid"TextMsg" ), "Message_TextMsg" );
    
    
register_event"CurWeapon""Event_CurWeapon""be""1=1" );
    
    
register_think"grenade""GrenadeThink" );
    
register_touch"*"," player""PlayerInteract" );
    
register_touch"grenade""*""BallInteract" );
    
    
register_forwardFM_SetModel"FwdSetModel_Pre");
    
register_forwardFM_EmitSound"FwEmitSound_Pre");
    
register_forwardFM_CmdStart"FwCmdStart_Pre");
    
    
RegisterHamHam_Item_Deploy"weapon_hegrenade""FwdDodgeballDeploy_Post");
}

public 
plugin_precache()
{
    static 
precache128 ];
    
    
PrecacheSongs();
    
precache_soundg_szDodgeballSound );
    
precache_modelg_szDodgeballViewModel );
    
precache_modelg_szDodgeballWeaponModel );
    
precache_modelg_szDodgeballWorldModel );
}

public 
FwdSetModel_PreiEntszModel[] )
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY )
        return 
1;
        
    if ( 
equaliszModel"models/w_hegrenade.mdl" ) )
    {
        
entity_set_modeliEntg_szDodgeballWorldModel );
        
        
set_task10.0"RemoveEnt"iEnt );
        
        return 
4;
    }
    
    return 
1;
}

public 
RemoveEntiEnt )
{
    if ( 
pev_validiEnt ) ) remove_entityiEnt );
    
    
remove_taskiEnt );
}

public 
FwEmitSound_PreiEntityiChannelszSample[], Float:fVolumeFloat:fAtteniFlagsiPitch )
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY )
        return 
FMRES_IGNORED;
        
    if( 
containiszSample"he_bounce" ) != -
    {
        if( 
entity_get_floatiEntityEV_FL_fuser1 ) + 0.3 get_gametime() ) 
        {
            
entity_set_float(iEntityEV_FL_fuser1get_gametime() );
            
            
emit_soundiEntityCHAN_ITEMg_szDodgeballSoundVOL_NORMATTN_NORM0PITCH_NORM );
        }
        
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}

public 
FwdDodgeballDeploy_PostiEnt )
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY )
        return 
1;
        
    static 
client;
    
    
client get_pdata_cbaseiEnt41);
    
    if ( !
is_user_aliveclient ) )
        return 
1;
        
    
set_pevclientpev_viewmodel2g_szDodgeballViewModel );
    
set_pevclientpev_weaponmodel2g_szDodgeballWeaponModel );
    
    return 
4;
    return 
0;
}

public 
Event_CurWeaponclient )
{
    if ( !
is_user_aliveclient ) )
        return 
1;
        
    static 
CsTeams:iTeamiWeapon;
    
    
iTeam cs_get_user_teamclient )
    
    
iWeapon get_user_weaponclient );
    
    if ( 
iTeam != CS_TEAM_T && IsTerrorDayg_iCurrentDay ) )
    {
        
fm_strip_user_weaponsclient );
        
        return 
1;
    }
        
        case 
DODGEBALL_DAY:
        {
            if ( 
iTeam == CS_TEAM_T && iWeapon != CSW_HEGRENADE )
            {
                
fm_strip_user_weaponsclient );
                
fm_give_itemclient"weapon_hegrenade" );
                
cs_set_user_bpammoclientCSW_HEGRENADE999 );
            }
        }
    }
    
    return 
1;
}

public 
GrenadeThinkiEnt )
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY )
        return 
0;
        
    return 
1;
    return 
0;
}

public 
PlayerInteractiEntclient )
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY || cs_get_user_teamclient ) != CS_TEAM_T )
        return 
0;
        
    static 
szClass32 ];
    
    
entity_get_stringiEntEV_SZ_classnameszClasscharsmaxszClass ) );
    
    if ( 
equaliszClass"grenade" ) )
        
PlayerHitByBallclientiEnt );
        
    return 
0;
}

public 
BallInteractiBalliEnt )
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY )
        return 
0;
    
    if( 
iEnt == 0
    {
        
entity_set_intiBallEV_INT_iuser11);
        
fm_set_renderingiBall );
    }
    
    else
    {
        static 
szClass32 ];
        
        
entity_get_stringiEntEV_SZ_classnameszClasscharsmaxszClass ) );
        
        if( 
equaliszClass"func_") ) 
        {
            
entity_set_intiBallEV_INT_iuser1);
            
set_renderingiBall );
            
            new 
Float:fStart], Float:fEnd], Float:fGround];
            
entity_get_vectoriBallEV_VEC_originfStart );
            
            
fEnd fStart;
            
fEnd] -= 1024.0;
            
            
trace_lineiEntfStartfEndfGround );
            
fGround] += 7.0;
            
            
entity_set_vectoriBallEV_VEC_originfGround );
        }
    }
    
    return 
0;
}

public 
PlayerHitByBallclientiBall 
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY )
        return 
0;
    
    if ( 
entity_get_intiBallEV_INT_iuser1 ) == 1)
    {
        
remove_entityiBall );
        
        return 
0;
    }
    
    static 
iOwner;
    
iOwner entity_get_edictiBallEV_ENT_euser1 );
    
    if ( 
iOwner == client )  
    {
        
entity_set_intiBallEV_INT_iuser1);
        
fm_set_renderingiBall );
        
        return 
0;
    }
    
    if ( 
cs_get_user_teamclient ) == CS_TEAM_T )
    {
        static 
Float:fOrigin], Float:fVec];
        
        
entity_get_vectoriBallEV_VEC_originfOrigin );
        
get_velocity_from_originclientfOrigin5120.0fVec );
        
        
fVec] = 512.0;
        
entity_set_vectorclientEV_VEC_velocityfVec );
        
        static 
Float:fMaxs], Float:f_pOrigin], iHeadshot 0;
        
entity_get_vectorclientEV_VEC_maxsfMaxs );
        
entity_get_vectorclientEV_VEC_originf_pOrigin );
        
f_pOrigin] += fMaxs];
        
        if( 
vector_distancefOriginf_pOrigin ) <= 26.3 )
            
iHeadshot 1
        
        make_deathmsg
iOwnerclientiHeadshot"dodgeball" );
        
user_silentkillclient );
        
remove_entityiBall );
        
        static 
iEnt 0szModel120 ];
        
        while( ( 
iEnt find_ent_by_classiEnt"armoury_entity" ) ) != )
        {
            
entity_get_stringiEntEV_SZ_modelszModelcharsmaxszModel ) );
            
            if ( 
equaliszModelg_szDodgeballViewModel )
                || 
equaliszModelg_szDodgeballWeaponModel )
                || 
equaliszModelg_szDodgeballWorldModel ) )
                    
remove_entityiEnt );
        }
    }
    return 
0;
}

public 
Message_TextMsg()
{
    if ( 
g_iCurrentDay != DODGEBALL_DAY )
        return 
0;
        
    new 
szMsg32 ];
    
    
get_msg_arg_string2szMsgcharsmaxszMsg ) );
    
    if( 
equaliszMsg"#Weapon_Cannot_Be_Dropped" ) )
        return 
1;
    
    if( 
str_to_numszMsg ) > 
    {
        
get_msg_arg_string3szMsgcharsmaxszMsg ) );
        
        if( 
equaliszMsg"#Game_radio" ) ) 
        {
            
get_msg_arg_string5szMsgcharsmaxszMsg ) );
            
            if( 
equaliszMsg"#Fire_in_the_hole" ) )
                return 
1;
        }
    }
    return 
0;



ironskillz1 12-26-2014 09:06

Re: Server crashes in Dodgeball Day
 
Im to lazy to find whats crashing your server. But i think i had the same problem as you when i made the dodgeball in my jailbreak daysmenu. But i fixed the problem by debuging the plugin.
If you dont want to debug your plugin here is my dodgeball functions. (remove the snowball, laserdome functions.)

Code:

public grenade_throw(index,greindex,wId) {
        if( wId != CSW_HEGRENADE ) {
                return PLUGIN_CONTINUE;
        }
        if( g_iCurrentDay == DAY_DODGEBALL )
        {
               
                entity_set_edict(greindex,EV_ENT_euser1,index);
                entity_set_int(greindex,EV_INT_iuser1,0);
                entity_set_size(greindex,Float:{-6.0,-6.0,-6.0},Float:{6.0,6.0,6.0});
                entity_set_float(greindex,EV_FL_friction,0.6);
               
                static r, b;
                r = random(256)
                b = random(256)
               
                message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
                write_byte(22);
                write_short(greindex);
                write_short(beamspr);
                write_byte(10);
                write_byte(5);
                write_byte(r);
                write_byte(0);
                write_byte(b);
                write_byte(192);
                message_end();
               
                set_rendering(greindex,kRenderFxGlowShell,r,0,b);
               
                set_task(3.0,"stop_roll",greindex);
        }
        if( g_iCurrentDay == DAY_SNOWBALL )
        {
                message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
                write_byte(TE_BEAMFOLLOW);
                write_short(greindex);
                write_short(Snowballsprite);
                write_byte(10);
                write_byte(5);
                write_byte(0);
                write_byte(25);
                write_byte(25);
                write_byte(200);
                message_end();
        }
        return PLUGIN_CONTINUE;
}

public stop_roll(ent) {
        if(is_valid_ent(ent)) {
               
                if(get_entity_flags(ent) & FL_ONGROUND) {
                        remove_entity( ent );
                }
                else {
                        set_task(3.0,"stop_roll",ent);
                }
               
        }
}

public SetModel( ent,const model[ ] )
{       
        if( !pev_valid( ent ) || !equal( model,"models/w_hegrenade.mdl" ) )
                return FMRES_IGNORED
       
        if( g_iCurrentDay == DAY_DODGEBALL )
        {
                engfunc( EngFunc_SetModel, ent, g_szDodgeball_World )
                return FMRES_IGNORED
        }
        if( g_iCurrentDay == DAY_SNOWBALL )
        {
                engfunc( EngFunc_SetModel, ent, g_szSnowball_World )
               
                static Float:velocity[3];
                set_pev(ent, pev_dmgtime, get_gametime() + 9999.0);
                set_pev(ent, pev_gravity, 0.3);
                pev(ent, pev_velocity, velocity);
               
                velocity[0] *= 1.5;
                velocity[1] *= 1.5;
                velocity[2] *= 1.5;
               
                set_pev(ent, pev_velocity,velocity);
                return FMRES_IGNORED
        }
       
        return FMRES_SUPERCEDE
}

public Think_Grenade(wId)
{       
        if( wId != CSW_HEGRENADE )
        {
                if( g_iCurrentDay == DAY_DODGEBALL || g_iCurrentDay == DAY_SNOWBALL )
                        return PLUGIN_HANDLED
        }
        return PLUGIN_CONTINUE
}

public player_interact(ent,id) {
        if(!is_valid_ent(ent)) {
                return PLUGIN_CONTINUE;       
        }
       
        new classname[32], model[32];
        entity_get_string(ent,EV_SZ_classname,classname,31);
        entity_get_string(ent,EV_SZ_model,model,31);
       
        if(equali(classname,"grenade"))
        {
                if( g_iCurrentDay == DAY_DODGEBALL )
                hit_by_ball(id,ent);
        }
        return PLUGIN_CONTINUE;
}

public ball_interact(ball,ent) {
        if( g_iCurrentDay == DAY_DODGEBALL )
        {
                if(ent == 0) {
                        entity_set_int(ball,EV_INT_iuser1,1);
                        set_rendering(ball);
                }
                else {
                        new classname[32];
                        entity_get_string(ent,EV_SZ_classname,classname,31);
               
                        if(equali(classname,"func_",5)) {
                                entity_set_int(ball,EV_INT_iuser1,1);
                                set_rendering(ball);
                       
                        }
                }
        }
       
        return PLUGIN_CONTINUE;
}

public hit_by_ball(id,ball) {       
        if(entity_get_int(ball,EV_INT_iuser1) == 1) {
                return;
        }
       
        new owner = entity_get_edict(ball,EV_ENT_euser1);
       
        if(owner == id) {
                entity_set_int(ball,EV_INT_iuser1,1);
                set_rendering(ball);
                return;
        }
       
        if(get_user_godmode(id)) {
                entity_set_int(ball,EV_INT_iuser1,1);
                set_rendering(ball);
                return;
        }
       
        new Float:origin[3]
       
        set_task(0.1,"kill",id);
       
        new Float:maxs[3], Float:pOrigin[3], headshot;
        entity_get_vector(id,EV_VEC_maxs,maxs);
        entity_get_vector(id,EV_VEC_origin,pOrigin);
        pOrigin[2] += maxs[2];
       
        if(vector_distance(origin,pOrigin) <= HS_DIST) {
                headshot = 1;
        }

        set_user_frags(owner, get_user_frags(owner)+1);
        message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
        write_byte(owner);
        write_short(get_user_frags(owner));
        write_short(cs_get_user_deaths(owner));
        write_short(0);
        write_short(get_user_team(owner));
        message_end();
       
        make_deathmsg(owner,id,headshot,"dodgeball");
        entity_set_int(ball,EV_INT_iuser1,1);
        set_rendering(ball);
}

public kill(id) {
        strip_user_weapons(id);
        user_silentkill(id);
        message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
        write_byte(id);
        write_short(get_user_frags(id));
        write_short(cs_get_user_deaths(id));
        write_short(0);
        write_short(1);
        message_end();
}

public msg_textmsg() {
        new szMsg[ 32 ]
        get_msg_arg_string( 2, szMsg, charsmax( szMsg ) )
       
        if( equal( szMsg ,"#Game_teammate_attack" ) || equal( szMsg, "#Killed_Teammate" ) )
        {
                return PLUGIN_HANDLED
        }
        if( g_iCurrentDay == DAY_DODGEBALL || g_iCurrentDay == DAY_SNOWBALL)
        {       
                if(get_msg_args() != 5 || get_msg_argtype(2) != ARG_STRING || get_msg_argtype(5) != ARG_STRING) {
                        return PLUGIN_CONTINUE
                }
                new string[32];
               
                get_msg_arg_string(2,string,31);
                if(equali(string,"#Weapon_Cannot_Be_Dropped")) {
                        return PLUGIN_HANDLED;
                }
               
                new arg5[20]
                get_msg_arg_string(5, arg5, 19)
                if(equal(arg5, "#Fire_in_the_hole")) {
                        return PLUGIN_HANDLED
                }
        }
        return PLUGIN_CONTINUE;
}

public msg_sendaudio() {
        if( g_iCurrentDay == DAY_DODGEBALL || g_iCurrentDay == DAY_SNOWBALL)
        {
                if(get_msg_args() != 3 || get_msg_argtype(2) != ARG_STRING) {
                        return PLUGIN_CONTINUE
                }
               
                new arg2[20]
                get_msg_arg_string(2, arg2, 19)
                if(equal(arg2[1], "!MRAD_FIREINHOLE"))
                {
                        return PLUGIN_HANDLED
                }
        }
        return PLUGIN_CONTINUE
}

public EmitSound (id,channel,sample[],Float:volume,Float:atten,flags,pitch) {
        if( g_iCurrentDay == DAY_DODGEBALL )
        {       
                if(containi(sample,"he_bounce") != -1) {
                        if(entity_get_float(id,EV_FL_fuser1) + 0.3 < get_gametime()) {
                                entity_set_float(id,EV_FL_fuser1,get_gametime());
                                emit_sound(id,CHAN_ITEM,"weapons/g_bounce1.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);
                        }
                        return FMRES_SUPERCEDE;
                }
        }
        if( g_iCurrentDay == DAY_SNOWBALL )
        {       
                if(containi(sample,"he_bounce") != -1)
                {
                        return FMRES_SUPERCEDE;
                }
        }
       
        if(!is_user_alive(id))
                return FMRES_IGNORED
       
        if ( cs_get_user_team ( id ) == CS_TEAM_T )
        {       
                new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
                if( g_iCurrentDay == DAY_BOXING )
                {       
                        if(weapon == CSW_KNIFE)
                        {
                                if(equal(sample,"weapons/knife_hit1.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound1, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                                else if(equal(sample,"weapons/knife_hit2.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound2, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                                else if(equal(sample,"weapons/knife_hit3.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound3, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                                else if(equal(sample,"weapons/knife_hit4.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound4, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                                else if(equal(sample,"weapons/knife_stab.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound5, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                                else if(equal(sample,"weapons/knife_hitwall1.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound6, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                                else if(equal(sample,"weapons/knife_slash1.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound7, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                                else if(equal(sample,"weapons/knife_slash2.wav"))
                                {
                                        emit_sound(id, CHAN_WEAPON, g_szBoxingSound8, 1.0, ATTN_NORM, 0, PITCH_NORM)
                                        return FMRES_SUPERCEDE
                                }
                        }
                }
                if( g_iCurrentDay == DAY_LASERDOME )
                {       
                        if(weapon == CSW_DEAGLE)
                        {
                                if(equal(sample,"weapons/dryfire_pistol.wav"))
                                {
                                        return FMRES_SUPERCEDE
                                }
                        }
                }
        }
        return FMRES_IGNORED;
}


Fuck For Fun 12-26-2014 16:27

Re: Server crashes in Dodgeball Day
 
Quote:

Originally Posted by ironskillz1 (Post 2240206)
Im to lazy to find whats crashing your server. But i think i had the same problem as you when i made the dodgeball in my jailbreak daysmenu. But i fixed the problem by debuging the plugin.
If you dont want to debug your plugin here is my dodgeball functions. (remove the snowball, laserdome functions.)

Code:

public grenade_throw(index,greindex,wId) {
    if( wId != CSW_HEGRENADE ) {
        return PLUGIN_CONTINUE;
    }
    if( g_iCurrentDay == DAY_DODGEBALL )
    {
       
        entity_set_edict(greindex,EV_ENT_euser1,index);
        entity_set_int(greindex,EV_INT_iuser1,0);
        entity_set_size(greindex,Float:{-6.0,-6.0,-6.0},Float:{6.0,6.0,6.0});
        entity_set_float(greindex,EV_FL_friction,0.6);
       
        static r, b;
        r = random(256)
        b = random(256)
       
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        write_byte(22);
        write_short(greindex);
        write_short(beamspr);
        write_byte(10);
        write_byte(5);
        write_byte(r);
        write_byte(0);
        write_byte(b);
        write_byte(192);
        message_end();
       
        set_rendering(greindex,kRenderFxGlowShell,r,0,b);
       
        set_task(3.0,"stop_roll",greindex);
    }
    if( g_iCurrentDay == DAY_SNOWBALL )
    {
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
        write_byte(TE_BEAMFOLLOW);
        write_short(greindex);
        write_short(Snowballsprite);
        write_byte(10);
        write_byte(5);
        write_byte(0);
        write_byte(25);
        write_byte(25);
        write_byte(200);
        message_end();
    }
    return PLUGIN_CONTINUE;
}

public stop_roll(ent) {
    if(is_valid_ent(ent)) {
       
        if(get_entity_flags(ent) & FL_ONGROUND) {
            remove_entity( ent );
        }
        else {
            set_task(3.0,"stop_roll",ent);
        }
       
    }
}

public SetModel( ent,const model[ ] )
{   
    if( !pev_valid( ent ) || !equal( model,"models/w_hegrenade.mdl" ) )
        return FMRES_IGNORED
   
    if( g_iCurrentDay == DAY_DODGEBALL )
    {
        engfunc( EngFunc_SetModel, ent, g_szDodgeball_World )
        return FMRES_IGNORED
    }
    if( g_iCurrentDay == DAY_SNOWBALL )
    {
        engfunc( EngFunc_SetModel, ent, g_szSnowball_World )
       
        static Float:velocity[3];
        set_pev(ent, pev_dmgtime, get_gametime() + 9999.0);
        set_pev(ent, pev_gravity, 0.3);
        pev(ent, pev_velocity, velocity);
       
        velocity[0] *= 1.5;
        velocity[1] *= 1.5;
        velocity[2] *= 1.5;
       
        set_pev(ent, pev_velocity,velocity);
        return FMRES_IGNORED
    }
   
    return FMRES_SUPERCEDE
}

public Think_Grenade(wId)
{   
    if( wId != CSW_HEGRENADE )
    {
        if( g_iCurrentDay == DAY_DODGEBALL || g_iCurrentDay == DAY_SNOWBALL )
            return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

public player_interact(ent,id) {
    if(!is_valid_ent(ent)) {
        return PLUGIN_CONTINUE;   
    }
   
    new classname[32], model[32];
    entity_get_string(ent,EV_SZ_classname,classname,31);
    entity_get_string(ent,EV_SZ_model,model,31);
   
    if(equali(classname,"grenade"))
    {
        if( g_iCurrentDay == DAY_DODGEBALL )
        hit_by_ball(id,ent);
    }
    return PLUGIN_CONTINUE;
}

public ball_interact(ball,ent) {
    if( g_iCurrentDay == DAY_DODGEBALL )
    {
        if(ent == 0) {
            entity_set_int(ball,EV_INT_iuser1,1);
            set_rendering(ball);
        }
        else {
            new classname[32];
            entity_get_string(ent,EV_SZ_classname,classname,31);
       
            if(equali(classname,"func_",5)) {
                entity_set_int(ball,EV_INT_iuser1,1);
                set_rendering(ball);
           
            }
        }
    }
   
    return PLUGIN_CONTINUE;
}

public hit_by_ball(id,ball) {   
    if(entity_get_int(ball,EV_INT_iuser1) == 1) {
        return;
    }
   
    new owner = entity_get_edict(ball,EV_ENT_euser1);
   
    if(owner == id) {
        entity_set_int(ball,EV_INT_iuser1,1);
        set_rendering(ball);
        return;
    }
   
    if(get_user_godmode(id)) {
        entity_set_int(ball,EV_INT_iuser1,1);
        set_rendering(ball);
        return;
    }
   
    new Float:origin[3]
   
    set_task(0.1,"kill",id);
   
    new Float:maxs[3], Float:pOrigin[3], headshot;
    entity_get_vector(id,EV_VEC_maxs,maxs);
    entity_get_vector(id,EV_VEC_origin,pOrigin);
    pOrigin[2] += maxs[2];
   
    if(vector_distance(origin,pOrigin) <= HS_DIST) {
        headshot = 1;
    }

    set_user_frags(owner, get_user_frags(owner)+1);
    message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
    write_byte(owner);
    write_short(get_user_frags(owner));
    write_short(cs_get_user_deaths(owner));
    write_short(0);
    write_short(get_user_team(owner));
    message_end();
   
    make_deathmsg(owner,id,headshot,"dodgeball");
    entity_set_int(ball,EV_INT_iuser1,1);
    set_rendering(ball);
}

public kill(id) {
    strip_user_weapons(id);
    user_silentkill(id);
    message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(cs_get_user_deaths(id));
    write_short(0);
    write_short(1);
    message_end();
}

public msg_textmsg() {
    new szMsg[ 32 ]
    get_msg_arg_string( 2, szMsg, charsmax( szMsg ) )
   
    if( equal( szMsg ,"#Game_teammate_attack" ) || equal( szMsg, "#Killed_Teammate" ) )
    {
        return PLUGIN_HANDLED
    }
    if( g_iCurrentDay == DAY_DODGEBALL || g_iCurrentDay == DAY_SNOWBALL)
    {   
        if(get_msg_args() != 5 || get_msg_argtype(2) != ARG_STRING || get_msg_argtype(5) != ARG_STRING) {
            return PLUGIN_CONTINUE
        }
        new string[32];
       
        get_msg_arg_string(2,string,31);
        if(equali(string,"#Weapon_Cannot_Be_Dropped")) {
            return PLUGIN_HANDLED;
        }
       
        new arg5[20]
        get_msg_arg_string(5, arg5, 19)
        if(equal(arg5, "#Fire_in_the_hole")) {
            return PLUGIN_HANDLED
        }
    }
    return PLUGIN_CONTINUE;
}

public msg_sendaudio() {
    if( g_iCurrentDay == DAY_DODGEBALL || g_iCurrentDay == DAY_SNOWBALL)
    {
        if(get_msg_args() != 3 || get_msg_argtype(2) != ARG_STRING) {
            return PLUGIN_CONTINUE
        }
       
        new arg2[20]
        get_msg_arg_string(2, arg2, 19)
        if(equal(arg2[1], "!MRAD_FIREINHOLE"))
        {
            return PLUGIN_HANDLED
        }
    }
    return PLUGIN_CONTINUE
}

public EmitSound (id,channel,sample[],Float:volume,Float:atten,flags,pitch) {
    if( g_iCurrentDay == DAY_DODGEBALL )
    {   
        if(containi(sample,"he_bounce") != -1) {
            if(entity_get_float(id,EV_FL_fuser1) + 0.3 < get_gametime()) {
                entity_set_float(id,EV_FL_fuser1,get_gametime());
                emit_sound(id,CHAN_ITEM,"weapons/g_bounce1.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);
            }
            return FMRES_SUPERCEDE;
        }
    }
    if( g_iCurrentDay == DAY_SNOWBALL )
    {   
        if(containi(sample,"he_bounce") != -1)
        {
            return FMRES_SUPERCEDE;
        }
    }
   
    if(!is_user_alive(id))
        return FMRES_IGNORED
   
    if ( cs_get_user_team ( id ) == CS_TEAM_T )
    {   
        new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
        if( g_iCurrentDay == DAY_BOXING )
        {   
            if(weapon == CSW_KNIFE)
            {
                if(equal(sample,"weapons/knife_hit1.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound1, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
                else if(equal(sample,"weapons/knife_hit2.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound2, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
                else if(equal(sample,"weapons/knife_hit3.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound3, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
                else if(equal(sample,"weapons/knife_hit4.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound4, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
                else if(equal(sample,"weapons/knife_stab.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound5, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
                else if(equal(sample,"weapons/knife_hitwall1.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound6, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
                else if(equal(sample,"weapons/knife_slash1.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound7, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
                else if(equal(sample,"weapons/knife_slash2.wav"))
                {
                    emit_sound(id, CHAN_WEAPON, g_szBoxingSound8, 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return FMRES_SUPERCEDE
                }
            }
        }
        if( g_iCurrentDay == DAY_LASERDOME )
        {   
            if(weapon == CSW_DEAGLE)
            {
                if(equal(sample,"weapons/dryfire_pistol.wav"))
                {
                    return FMRES_SUPERCEDE
                }
            }
        }
    }
    return FMRES_IGNORED;
}


Wow that's a lot of change, and your code is different and complicated

Quote:

Public EmitSound
DAY_LASERDOME
for what that?

If you give me yours, into mine.

EDIT:
I was able to replace two public from your code to mine.

ironskillz1 12-26-2014 20:18

Re: Server crashes in Dodgeball Day
 
I dont really understand what your are trying to tell me. Did it work?

Fuck For Fun 12-27-2014 10:41

Re: Server crashes in Dodgeball Day
 
Quote:

Originally Posted by ironskillz1 (Post 2240462)
I dont really understand what your are trying to tell me. Did it work?

no, I tried to change our Codes, and still crash server when I throw the ball

Maybe I missed something? I think it's catching a ball or throwing a ball

ironskillz1 12-27-2014 11:43

Re: Server crashes in Dodgeball Day
 
I dont want to give out the whole daysmenu plugin because its private.
But you can put
Code:

server_print("Debug: 1"), server_print("Debug: 2")
and so on to see where the server crash and fix it.

Fuck For Fun 12-27-2014 19:11

Re: Server crashes in Dodgeball Day
 
I think I found the problem

EDIT: but now i have more bug when i throw ball to terrorist hes no die (cant kill him)
Code:

public FwdSetModel_Pre( iEnt, szModel[] )
{
    server_print("Debug: 1")
    if ( g_iCurrentDay != DODGEBALL_DAY )
        return 1;
       
    if ( equali( szModel, "models/w_hegrenade.mdl" ) )
    {
        entity_set_model( iEnt, g_szDodgeballWorldModel );
       
        set_task( 10.0, "RemoveEnt", iEnt );
        server_print("Debug: 2")
       
        return 4;
    }
   
    return 1;
}

public RemoveEnt( iEnt )
{
    server_print("Debug: 3")
    if ( pev_valid( iEnt ) ) remove_entity( iEnt );
   
    remove_task( iEnt );
    server_print("Debug: 4")
}


Errors Logs say:
Code:

L 12/28/2014 - 02:07:43: -------- Mapchange to jail_xmf --------
Server logging data to file logs/L1228004.log
 L 12/28/2014 - 02:07:43: Server cvar "mp_logdetail" = "1"
Debug: 1


ironskillz1 12-27-2014 21:15

Re: Server crashes in Dodgeball Day
 
Try this:

Code:

public FwdSetModel_Pre( iEnt, szModel[] )
{
        if ( g_iCurrentDay == DODGEBALL_DAY && pev_valid( iEnt ) && equal( szModel,"models/w_hegrenade.mdl" ))
        {
                entity_set_model( iEnt, g_szDodgeballWorldModel );       
                set_task( 10.0, "RemoveEnt", iEnt );
        }
}


Fuck For Fun 12-30-2014 07:23

Re: Server crashes in Dodgeball Day
 
Quote:

Originally Posted by ironskillz1 (Post 2240830)
Try this:

Code:

public FwdSetModel_Pre( iEnt, szModel[] )
{
    if ( g_iCurrentDay == DODGEBALL_DAY && pev_valid( iEnt ) && equal( szModel,"models/w_hegrenade.mdl" ))
    {
        entity_set_model( iEnt, g_szDodgeballWorldModel );   
        set_task( 10.0, "RemoveEnt", iEnt );
    }
}


still crashed.
HTML Code:

L 12/30/2014 - 14:20:03: -------- Mapchange to jail_xmf --------
Server logging data to file logs/L1230004.log
[AMXX] Loaded 1 admins from file
Debug: 1

Code:

public FwdSetModel_Pre( iEnt, szModel[] )
{
    server_print("Debug: 1")
    if ( g_iCurrentDay == DODGEBALL_DAY && pev_valid( iEnt ) && equal( szModel,"models/w_hegrenade.mdl" ))
    {
        entity_set_model( iEnt, g_szDodgeballWorldModel );   
        set_task( 5.0, "RemoveEnt", iEnt );
        server_print("Debug: 2")
    }
}

and why i see hegrenade throw, and no ball of dodge?
http://up413.siz.co.il/up1/ndyzyzgqjtz0.png

EDIT: More number of debug

Debug: 5
Code:

public FwEmitSound_Pre( iEntity, iChannel, szSample[], Float:fVolume, Float:fAtten, iFlags, iPitch )
{
    server_print("Debug: 5")
    if ( g_iCurrentDay != DODGEBALL_DAY )
        return FMRES_IGNORED;
       
    if( containi( szSample, "he_bounce" ) != -1 )
    {
        if( entity_get_float( iEntity, EV_FL_fuser1 ) + 0.3 < get_gametime() )
        {
            entity_set_float(iEntity, EV_FL_fuser1, get_gametime() );
           
            emit_sound( iEntity, CHAN_ITEM, g_szDodgeballSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            server_print("Debug: 6")
        }
       
        return FMRES_SUPERCEDE;
    }
   
    return FMRES_IGNORED;
}

Debug: 13
Code:

public PlayerHitByBall( client, iBall )
{
    server_print("Debug: 13")
    if ( g_iCurrentDay != DODGEBALL_DAY )
        return 0;
   
    if ( entity_get_int( iBall, EV_INT_iuser1 ) == 1)
    {
        remove_entity( iBall );
       
        return 0;
    }
   
    static iOwner;
    iOwner = entity_get_edict( iBall, EV_ENT_euser1 );
   
    if ( iOwner == client ) 
    {
        entity_set_int( iBall, EV_INT_iuser1, 1 );
        fm_set_rendering( iBall );
       
        return 0;
    }
   
    if ( cs_get_user_team( client ) == CS_TEAM_T )
    {
        static Float:fOrigin[ 3 ], Float:fVec[ 3 ];
       
        entity_get_vector( iBall, EV_VEC_origin, fOrigin );
        get_velocity_from_origin( client, fOrigin, 5120.0, fVec );
       
        fVec[ 2 ] = 512.0;
        entity_set_vector( client, EV_VEC_velocity, fVec );
       
        static Float:fMaxs[ 3 ], Float:f_pOrigin[ 3 ], iHeadshot = 0;
        entity_get_vector( client, EV_VEC_maxs, fMaxs );
        entity_get_vector( client, EV_VEC_origin, f_pOrigin );
        f_pOrigin[ 2 ] += fMaxs[ 2 ];
       
        if( vector_distance( fOrigin, f_pOrigin ) <= 26.3 )
            iHeadshot = 1
       
        make_deathmsg( iOwner, client, iHeadshot, "dodgeball" );
        user_silentkill( client );
        remove_entity( iBall );
       
        static iEnt = 0, szModel[ 120 ];
       
        while( ( iEnt = find_ent_by_class( iEnt, "armoury_entity" ) ) != 0 )
        {
            entity_get_string( iEnt, EV_SZ_model, szModel, charsmax( szModel ) );
           
            if ( equali( szModel, g_szDodgeballViewModel )
                || equali( szModel, g_szDodgeballWeaponModel )
                || equali( szModel, g_szDodgeballWorldModel ) )
                    remove_entity( iEnt );
            server_print("Debug: 14")
        }
    }
    return 0;
}


ironskillz1 01-28-2015 12:03

Re: Server crashes in Dodgeball Day
 
Use this and edit it yourself.


Code:

public plugin_init()
{
        register_plugin("Daysmenu", VERSION, "Larcyn")
       
        register_message(get_user_msgid("SendAudio"), "msg_sendaudio")
        register_message(get_user_msgid("TextMsg"), "msg_textmsg")
       
        register_event("CurWeapon", "EventCurWeapon", "be","1=1")
        register_event("DeathMsg", "eventDeathMsg", "a", "1>0");
       
        register_event("HLTV", "EventRoundRefresh", "a", "1=0", "2=0")
        register_logevent("EventRoundRefresh", 2, "1=Round_End")
       
        register_clcmd("say /dm", "CmdDayMenu")
        register_clcmd("say /daymenu", "CmdDayMenu")
       
        register_clcmd("say /stop", "CmdStopDay")
        register_clcmd("say /open", "CmdOpenCells")
       
        RegisterHam(Ham_Touch, "armoury_entity", "FwdHamPlayerPickup")
        RegisterHam(Ham_Touch, "weaponbox", "FwdHamPlayerPickup")
        RegisterHam(Ham_TraceAttack, "player", "FwdTraceAttack")
       
        register_forward(FM_EmitSound,"FwdEmitSound")
        register_forward(FM_SetModel, "FwdSetModel")
       
        register_touch("*","player","player_interact")
        register_touch("grenade","*","ball_interact")
       
        register_think("grenade", "GrenadeThink")
       
        cStun = register_cvar("box_stun", "1")
       
        g_iMaxPlayers = get_maxplayers()
        g_msgCurWeapon = get_user_msgid("CurWeapon")
       
        Setup_Buttons()
}

Code:

//    ___________
//___/ DODGEBALL \_________
//~~~~~~~~~~~~~~~~~~~~~~~~~
public StartDodgeball()
{       
        iDay = 3
        for(new i = 1; i < g_iMaxPlayers; i++)
        {
                if(is_user_connected(i) && !is_user_bot(i) && is_user_alive(i))
                {
                        set_task(1.0, "CheckGame", 321, _, _, "b")
                       
                        client_cmd(i, "spk sound/PlayGroundv2dodge/dodgeball.wav")

                        strip_user_weapons(i)
                        set_user_health(i, 100)
                       
                        switch(cs_get_user_team(i))
                        {
                                case CS_TEAM_T:
                                {
                                        set_task(1.7, "GiveHE", i, _, _, "b")
                                        give_item(i, "weapon_hegrenade")
                                }
                                case CS_TEAM_CT:
                                {
                                        give_item(i, "weapon_knife")
                                        set_user_godmode(i, 1)
                                        give_item(i, "weapon_deagle")
                                        cs_set_user_bpammo(i, CSW_DEAGLE, 35)
                                        give_item(i, "weapon_m4a1")
                                        cs_set_user_bpammo(i, CSW_M4A1, 90)
                                        cs_set_user_armor(i, 100, CS_ARMOR_VESTHELM)
                                }
                        }
                       
                        ColorChat(i, GREY, "%s Objective: Dodge your teammates!", prefix)
                        CantPickGun[i] = true
                }
        }
        return PLUGIN_HANDLED
}

public GiveHE(iPlayer)
{
        if(is_user_alive(iPlayer))
        {
                give_item(iPlayer, "weapon_hegrenade")
                reset_user_nade(iPlayer)
        }
        return PLUGIN_CONTINUE
}

public GrenadeThink(iEnt)
{
        if(iDay == 3 || iDay == 4)
                return PLUGIN_HANDLED
               
        return PLUGIN_CONTINUE
}

public grenade_throw(index, greindex, wId)
{
        if(wId != CSW_HEGRENADE)
        {
                return PLUGIN_CONTINUE;
        }
       
        if(iDay == 3 || iDay == 4)
        {
                entity_set_edict(greindex,EV_ENT_euser1,index)
                set_task(0.3, "clearowner", greindex)
                entity_set_int(greindex, EV_INT_iuser1, 0)
                entity_set_size(greindex, Float:{-6.0,-6.0,-6.0}, Float:{6.0,6.0,6.0})
                entity_set_float(greindex, EV_FL_friction,0.6)
               
                new r = random_num(1, 255)
                new g = random_num(1, 255)
                new b = random_num(1, 255)
               
                message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
                write_byte(22)
                write_short(greindex)
                write_short(iBeamspr)
                write_byte(10)
                write_byte(10)
                write_byte(r)
                write_byte(g)
                write_byte(b)
                write_byte(100)
                message_end()
               
                set_rendering(greindex,kRenderFxGlowShell, r, g, b)
                set_task(1.5, "EventStopRoll", greindex)

                return PLUGIN_CONTINUE;
        }
        return PLUGIN_CONTINUE
}

public EventStopRoll(iEnt)
{
        if(is_valid_ent(iEnt))
        {
                if(get_entity_flags(iEnt) & FL_ONGROUND)
                {
                        entity_set_vector(iEnt, EV_VEC_velocity, Float:{0.0,0.0,0.0})
                        entity_set_float(iEnt, EV_FL_gravity, 1.0)
                       
                        set_rendering(iEnt)
                        clearowner(iEnt)
                       
                        remove_entity(iEnt)
                }
                else
                {
                        set_task(1.0, "EventStopRoll", iEnt)
                }
               
        }
}

public clearowner(iEnt)
        if(is_valid_ent(iEnt))
                entity_set_edict(iEnt, EV_ENT_owner, 0)

public player_interact(iEnt, iPlayer)
{
        if(iDay == 3 || iDay == 4)
        {
                if(is_valid_ent(iEnt))
                {
                        new iClassname[32], iModel[32]
                        entity_get_string(iEnt, EV_SZ_classname, iClassname, charsmax(iClassname))
                        entity_get_string(iEnt, EV_SZ_model, iModel, charsmax(iModel))
               
                        if(equali(iClassname, "grenade") && !equali(iModel,"models/w_c4.mdl"))
                        {
                                hit_by_ball(iPlayer, iEnt)
                        }
                }
                return PLUGIN_CONTINUE
        }
        return PLUGIN_CONTINUE
}

public ball_interact(iBall, iEnt)
{
        if(iEnt == 0)
        {
                entity_set_int(iBall, EV_INT_iuser1, 1)
                set_rendering(iBall);
        }
        else
        {
                new iClassname[32]
                entity_get_string(iEnt,EV_SZ_classname, iClassname, charsmax(iClassname))
               
                if(equali(iClassname,"func_", 5))
                {
                        entity_set_int(iBall, EV_INT_iuser1, 1)
                        set_rendering(iBall)

                        new Float:start[3], Float:end[3], Float:ground[3]
                        entity_get_vector(iBall, EV_VEC_origin, start)
                        end = start
                        end[2] -= 1024.0
                        trace_line(iEnt,start,end,ground)
                        ground[2] += 7.0
                        entity_set_vector(iBall, EV_VEC_origin, ground)
                }
        }
        return PLUGIN_CONTINUE
}

public hit_by_ball(iPlayer, iBall)
{
        if(entity_get_int(iBall, EV_INT_iuser1) == 1) // Dead ball
                return PLUGIN_HANDLED

        new owner = entity_get_edict(iBall, EV_ENT_euser1)

        if(owner == iPlayer)
        {
                entity_set_int(iBall,EV_INT_iuser1, 1);
                set_rendering(iBall);
                return PLUGIN_HANDLED
        }

        if(get_user_team(iPlayer) != get_user_team(owner))
        {
                entity_set_int(iBall, EV_INT_iuser1,1);
                set_rendering(iBall);
                return PLUGIN_HANDLED
        }
       
        set_task(0.1, "kill", iPlayer)

        if(is_user_connected(owner))
        {
                set_user_frags(owner,  get_user_frags(owner)+1)
                message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
                write_byte(owner)
                write_short(get_user_frags(owner))
                write_short(cs_get_user_deaths(owner))
                write_short(0)
                write_short(get_user_team(owner))
                message_end()
        }

        make_deathmsg(owner, iPlayer, 1, "dodgeball")

        entity_set_int(iBall, EV_INT_iuser1, 1)
        set_rendering(iBall)
       
        return PLUGIN_HANDLED
 }

public kill(iPlayer)
{
        strip_user_weapons(iPlayer)
        set_user_godmode(iPlayer, 0)
        user_silentkill(iPlayer)
        message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"))
        write_byte(iPlayer)
        write_short(get_user_frags(iPlayer))
        write_short(cs_get_user_deaths(iPlayer))
        write_short(0)
        write_short(1)
        message_end()
}

public msg_sendaudio()
{
        if(iDay == 3 || iDay == 4)
        {
                new string[32];
                get_msg_arg_string(2,string,31);

                if(equali(string,"%!MRAD_FIREINHOLE"))
                        return PLUGIN_HANDLED
        }
        return PLUGIN_CONTINUE
}

public msg_textmsg()
{
        if(iDay == 3 || iDay == 4)
        {
                new string[32]
               
                get_msg_arg_string(2,string,31);
                if(equali(string,"#Weapon_Cannot_Be_Dropped"))
                        return PLUGIN_HANDLED;

                if(str_to_num(string) > 0)
                {
                        get_msg_arg_string(3,string,31)
                        if(equali(string,"#Game_radio"))
                        {
                                get_msg_arg_string(5,string,31)
                                if(equali(string,"#Fire_in_the_hole"))
                                        return PLUGIN_HANDLED
                        }
                }
        }
        return PLUGIN_CONTINUE
}



All times are GMT -4. The time now is 15:24.

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