AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Crashes from plugin using TraceAttack (https://forums.alliedmods.net/showthread.php?t=163596)

DeLiriuM 08-01-2011 03:57

Crashes from plugin using TraceAttack
 
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 }

bibu 08-01-2011 05:39

Re: Crashes from plugin using TraceAttack
 
Check also if attacker is a valid player.

DeLiriuM 08-01-2011 05:51

Re: Crashes from plugin using TraceAttack
 
Well. Isn't is_user_connected() used for that?

Arkshine 08-01-2011 06:00

Re: Crashes from plugin using TraceAttack
 
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.

bibu 08-01-2011 06:15

Re: Crashes from plugin using TraceAttack
 
Quote:

Originally Posted by Arkshine (Post 1523218)
Ignore what says bibu, he doesn't know what he's talking about.

http://forums.alliedmods.net/showthread.php?p=946089

Idiot.

Arkshine 08-01-2011 06:28

Re: Crashes from plugin using TraceAttack
 
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.


bibu 08-01-2011 06:55

Re: Crashes from plugin using TraceAttack
 
Say that to the approver, idiot.

Trethy 08-01-2011 07:02

Re: Crashes from plugin using TraceAttack
 
Quote:

Originally Posted by bibu (Post 1523261)
Say that to the approver, idiot.

Shut up:cry:

Arkshine 08-01-2011 07:16

Re: Crashes from plugin using TraceAttack
 
Quote:

Originally Posted by bibu (Post 1523261)
Say that to the approver, idiot.

Approver ? What are you talking about. You are the one who says random things without knowing. Now, don't help if you don't know what you are talking about.

bibu 08-01-2011 07:57

Re: Crashes from plugin using TraceAttack
 
Quote:

Originally Posted by Arkshine (Post 1523281)
Approver ? What are you talking about. You are the one who says random things without knowing. Now, don't help if you don't know what you are talking about.

Did you have a look in the plugin which I linked at all? No, it's not random shit, it's in an approved plugin. If I see something in an approved plugin then I use it myself too and I advice it. And in this cases as you show it's not needed nor is it in the approved plugin then. You're acting everytime like a creepy girl.


All times are GMT -4. The time now is 03:22.

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