Raised This Month: $ Target: $400
 0% 

Crashes from plugin using TraceAttack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 08-01-2011 , 03:57   Crashes from plugin using TraceAttack
Reply With Quote #1

I'm getting wieard crashes, supposedly caused by hamsandwitch module (and JB plugin).

Debug log:

Code:
Core was generated by `./hlds_i686 -game cstrike +ip xxxx+port 27015 +maxplayers 31 +map de'.
Program terminated with signal 11, Segmentation fault.
#0  0xb4f4e342 in CBasePlayer::TraceAttack(entvars_s *, float, Vector, TraceResult *, int) () from /xxxx/cstrike/dlls/cs_i386.so
#0  0xb4f4e342 in CBasePlayer::TraceAttack(entvars_s *, float, Vector, TraceResult *, int) () from /xxxx/cstrike/dlls/cs_i386.so
#1  0xb47a8551 in ?? () from cstrike/addons/amxmodx/modules/hamsandwich_amxx_i386.so
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
No symbol table info available.



Code:
    RegisterHam(Ham_TraceAttack, "player", "player_attack")     RegisterHam(Ham_TraceAttack, "func_button", "button_attack") .... public player_damage(victim, ent, attacker, Float:damage, bits) {     if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)         return HAM_IGNORED     switch(g_Duel)     {         case(0):         {             if(attacker == ent && get_user_weapon(attacker) == CSW_KNIFE && get_bit(g_PlayerCrowbar, attacker) && cs_get_user_team(victim) != CS_TEAM_T)             {                 SetHamParamFloat(4, damage * gc_CrowbarMul)                 return HAM_OVERRIDE             }         }         case(2):         {             if(attacker != g_PlayerLast)                 return HAM_SUPERCEDE         }         default:         {             if((victim == g_DuelA && attacker == g_DuelB) || (victim == g_DuelB && attacker == g_DuelA))                 return HAM_IGNORED                 return HAM_SUPERCEDE         }     }     return HAM_IGNORED } public player_attack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damagebits) {     static CsTeams:vteam, CsTeams:ateam     if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)         return HAM_IGNORED     vteam = cs_get_user_team(victim)     ateam = cs_get_user_team(attacker)     if(ateam == CS_TEAM_CT && vteam == CS_TEAM_CT)         return HAM_SUPERCEDE     switch(g_Duel)     {         case(0):         {             if(ateam == CS_TEAM_CT && vteam == CS_TEAM_T)             {                 if(get_bit(g_PlayerRevolt, victim))                 {                     clear_bit(g_PlayerRevolt, victim)                     hud_status(0)                 }                 return HAM_IGNORED             }         }         case(2):         {             if(attacker != g_PlayerLast)                 return HAM_SUPERCEDE         }         default:         {             if((victim == g_DuelA && attacker == g_DuelB) || (victim == g_DuelB && attacker == g_DuelA))                 return HAM_IGNORED             return HAM_SUPERCEDE         }     }     if(ateam == CS_TEAM_T && vteam == CS_TEAM_T && !g_BoxStarted)         return HAM_SUPERCEDE     if(ateam == CS_TEAM_T && vteam == CS_TEAM_CT)     {         if(!g_PlayerRevolt)             revolt_start()         set_bit(g_PlayerRevolt, attacker)     }     return HAM_IGNORED }
__________________
DeLiriuM is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 08-01-2011 , 05:39   Re: Crashes from plugin using TraceAttack
Reply With Quote #2

Check also if attacker is a valid player.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 08-01-2011 , 05:51   Re: Crashes from plugin using TraceAttack
Reply With Quote #3

Well. Isn't is_user_connected() used for that?
__________________
DeLiriuM is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2011 , 06:00   Re: Crashes from plugin using TraceAttack
Reply With Quote #4

Ignore what says bibu, he doesn't know what he's talking about.

That said, I don't know really why it would crash, I can suggest you to debug the code, putting some debug text at some places and seeing from where it crashes.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 08-01-2011 , 06:15   Re: Crashes from plugin using TraceAttack
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
Ignore what says bibu, he doesn't know what he's talking about.
http://forums.alliedmods.net/showthread.php?p=946089

Idiot.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 08-02-2011 , 01:07   Re: Crashes from plugin using TraceAttack
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
That said, I don't know really why it would crash, I can suggest you to debug the code, putting some debug text at some places and seeing from where it crashes.
Uhm. How ?

Searched the forum, but didn't find anything...
__________________
DeLiriuM is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-02-2011 , 01:14   Re: Crashes from plugin using TraceAttack
Reply With Quote #7

You could do client_prints or server_prints or log_amx to log which parts of the code gets executed. Do this every time you do something in the code (major things), and see which text does not print. Means something inbetween the last text shown and the text not shown is not working correctly and is causing the server to crash.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 08-02-2011 , 01:34   Re: Crashes from plugin using TraceAttack
Reply With Quote #8

if its a server that you can see the console server_prints work great. but its trace attack lol so you would have to go into the game to do that lol...

client_print(0, print_chat, "MESSAGE");

In places where you think it might be crashing. Change MESSAGE to a description of what is going on there or to check variables to what they should be.

I have had issues with TraceAttack from ham also. http://forums.alliedmods.net/showthread.php?p=1075600

That plugin uses Ham_TraceAttack so might be useful?
Doc-Holiday is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-02-2011 , 02:01   Re: Crashes from plugin using TraceAttack
Reply With Quote #9

Quote:
Originally Posted by Doc-Holiday View Post
if its a server that you can see the console server_prints work great. but its trace attack lol so you would have to go into the game to do that lol...
Not if you use HLSW
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2011 , 06:28   Re: Crashes from plugin using TraceAttack
Reply With Quote #10

PHP Code:
static cell AMX_NATIVE_CALL is_user_connected(AMX *amxcell *params/* 1 param */
{
    
int index params[1];
    
->    
if (index || index gpGlobals->maxClients)
        return 
0;
    
    
CPlayerpPlayer GET_PLAYER_POINTER_I(index);
    
    return (
pPlayer->ingame 0);

Code:
[...] is_user_connected(attacker) [...]

Now, let me fix :

Quote:
Originally Posted by bibu
I'm an Idiot.
__________________
Arkshine is offline
Reply


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 03:22.


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