AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My game crash it when i hit a player (https://forums.alliedmods.net/showthread.php?t=282220)

Nax0ne 05-01-2016 17:40

My game crash it when i hit a player
 
My problem is when i hit a player, my game crash it and I discovered that the problem comes from these two forwards:

PHP Code:

public ham_TakeDamage_PreiVictimiInflictoriAttackerFloat:flDamageiBits )
{
    if ( !
is_user_aliveiAttacker ) )
        return 
HAM_IGNORED;
        
    static 
Float:flPlayerDmgPower;
    
flPlayerDmgPower flDamage g_flDamagePoweriAttacker ];
    
    if ( 
get_user_weaponiAttacker ) == CSW_KNIFE )
        
SetHamParamFloat4g_bPlayerIsZombieiAttacker ] ? random_float4.08.0 ) : 2.0 flPlayerDmgPower ); 
        
    if ( !
g_bPlayerIsZombieiAttacker ] && iBits & ( << 24 ) )    
    {
        if( 
iAttacker == iVictim ) return HAM_IGNORED;
        
        
SetHamParamFloat43.0 flPlayerDmgPower );
        return 
HAM_HANDLED;
    }
    
    if ( !
g_bPlayerIsZombieiAttacker ] )    
        
SetHamParamFloat4flPlayerDmgPower );    
    
    return 
HAM_IGNORED;


PHP Code:

public ham_TakeDamage_PostiVictimiInflictoriAttackerFloat:flDamageiBits )
{
    if ( !
is_user_aliveiAttacker ) )
        return 
HAM_IGNORED;    
    
    if ( 
g_bPlayerIsZombieiVictim ] )    
        
set_pdata_floatiVictim1080.9 );
    else
        
set_pdata_floatiVictim1081.0 );
    
    return 
HAM_IGNORED;


Something I doing wrong in those codes? I don't get it.

Bugsy 05-01-2016 20:08

Re: My game crash it when i hit a player
 
What is this supposed to do..what is the 108 offset?
Code:
public ham_TakeDamage_Post( iVictim, iInflictor, iAttacker, Float:flDamage, iBits ) {     if ( !is_user_alive( iAttacker ) )         return HAM_IGNORED;             if ( g_bPlayerIsZombie[ iVictim ] )             set_pdata_float( iVictim, 108, 0.9 );     else         set_pdata_float( iVictim, 108, 1.0 );         return HAM_IGNORED; }

Do some debugging. Put some logs\server_prints() in line by line. See how far it gets before throwing an error and you will find the culprit.

Nax0ne 05-01-2016 21:08

Re: My game crash it when i hit a player
 
@Bugsy

the 108 offset modify the player velocity. :)

Anyway, I solved the problem. :) Thanks for reply. :wink:

Close the thread please.

Bugsy 05-01-2016 21:22

Re: My game crash it when i hit a player
 
Glad you were able to solve your problem on your own. Please post your solution to help others who may have the same issue.

Nax0ne 05-01-2016 21:40

Re: My game crash it when i hit a player
 
Quote:

Originally Posted by Bugsy (Post 2415817)
Glad you were able to solve your problem on your own. Please post your solution to help others who may have the same issue.

It sounds strange, but I thought that the problem came from those two forwards ... but then I realized that the problem came from one of my zombie classes.

Hehehehe :oops:

Sorry for wasting your time. I swear I didn't know.:cry: :cry:

klippy 05-02-2016 04:03

Re: My game crash it when i hit a player
 
Bugsy, by the way, 108 should be m_flPainShock if you haven't found it out yet. Just so other people reading this topic don't get confused.

HamletEagle 05-02-2016 08:06

Re: My game crash it when i hit a player
 
Quote:

Originally Posted by KliPPy (Post 2415850)
Bugsy, by the way, 108 should be m_flPainShock if you haven't found it out yet. Just so other people reading this topic don't get confused.

Real name seems to be m_flVelocityModifier.


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

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