Raised This Month: $ Target: $400
 0% 

register_touch crashes server


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 05-17-2014 , 18:40   register_touch crashes server
Reply With Quote #1

I have server running with some plugins, 2 of them have register_touch in them. Once a while I get crash. No idea why, in crash log it say something about sv_touchlinks.

Plugin 1:
PHP Code:
register_touch("weaponbox""player""Touch_WeaponBox");

public 
Touch_WeaponBox(entid)
{
    if(
get_game_mode() != GAME_STARTED)
        return 
PLUGIN_HANDLED;
    if(!(
entity_get_int(entEV_INT_flags) & FL_ONGROUND))
        return 
PLUGIN_CONTINUE;

    if(
is_user_alive(id))
    {
        if(
get_user_pd(idPD_CANTPICK))
            return 
PLUGIN_HANDLED;
        
        if(
get_user_class(id) == CLASS_BYSTANDER)
            
set_user_class(idCLASS_ARMED);
        else if(
get_user_class(id) == CLASS_MURDERER)
            return 
PLUGIN_HANDLED;

        
pickup_weapon(idCSW_DEAGLE);
        
cs_set_user_bpammo(idCSW_DEAGLE6);
    }

    return 
PLUGIN_CONTINUE;

What this code is supposed to do is block deagle pickup (only weapon in game) if the conditions are met, else allow to pick it, play hud sprite, give some ammo.

Plugin 2:
PHP Code:
register_touch("mm_knife_throw""*""Touch_Knife"); 

public 
Touch_Knife(knifeid)
{
    if(!
is_valid_ent(knife))
        return;

    if(
is_user_alive(id))
    {
        if(
entity_get_int(knifeEV_INT_movetype) == MOVETYPE_NONE)
        {
            if(
mm_get_playerdata(idPD_CLASS) == CLASS_MURDERER)
                
give_murder_knife(idknife);
        }
        else
        {
            new 
owner entity_get_edict(knifeEV_ENT_owner);
            if(
owner == id || !owner)
                return;

            
remove_entity(knife);
            
ExecuteHamB(Ham_Killedidowner0);
            
emit_sound(idCHAN_ITEM"weapons/knife_hit4.wav"1.0ATTN_NORM0PITCH_NORM);

            
create_knife(id101);
        }
    }
    else
    {
        
entity_set_int(knifeEV_INT_movetypeMOVETYPE_NONE);
        new 
dropped drop_to_floor(knife);
        if(!
dropped)
        {
            new 
numFloat:origin[3];
            
entity_get_vector(knifeEV_VEC_originorigin);
            
dropped make_vacant(knifeoriginnum15.0);
        }

        if(!
dropped)
            
give_murder_knife(entity_get_edict(knifeEV_ENT_owner), knife);
        else
        {
            
entity_set_size(knifeg_szDroppedSize[0], g_szDroppedSize[1]);
            
drop_to_floor(knife);
            
entity_set_edict(knifeEV_ENT_owner0);
            
            
emit_sound(knifeCHAN_ITEM"weapons/knife_hitwall1.wav"1.0ATTN_NORM0PITCH_NORM);
        }
        static 
Float:angles[3];
        
entity_get_vector(knifeEV_VEC_anglesangles);
        
angles[0] = 270.0;
        
entity_set_vector(knifeEV_VEC_anglesangles);
    }

This code is for throwing a knife. First check if target is alive, if yes, check movetype, if none can pickup, else remove entity, create new and kill target. If target is not alive it tries to drop to floor the knife, if can drop, nice, change size etc. Else, find a vacant place and then drop it(if stuck is sky box, too high from ground etc.)

So what I have noticed is that crash happens when knife (so plugin 2, but cant be sure) hits player, BUT rarely. So I don't know whats wrong.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 05-17-2014 at 18:40.
GuskiS is offline
 


Thread Tools
Display Modes

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 09:44.


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