Raised This Month: $ Target: $400
 0% 

Solved Ham_TakeDamage Weird Bug | get_user_surfing | Semiclip | Read File | find_ent_by (-1)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-16-2017 , 08:45   Ham_TakeDamage Weird Bug | get_user_surfing | Semiclip | Read File | find_ent_by (-1)
Reply With Quote #1

Hey.

1. In my code Ham_TakeDamage is being weird. No I'm not hooking it in Post, yes it is in Pre. The weapon damages aren't working nor the "It Works !!" print , but the fall & grenade damage block is working. I tried setting a colored HUD when player makes damage but it wasn't working so I switched to Event_Damage

PHP Code:
RegisterHam(Ham_TakeDamage"player""fw_HamTakeDamage")


public 
fw_HamTakeDamage(victiminflictorattackerFloat:damagedamagebit) {
    
    if(
get_user_weapon(attacker) == CSW_DEAGLE && deagle_used[attacker]) {
        
        
SetHamParamFloat(4damage 999.0)
        
client_print(attackerprint_chat"It Works !!")
    }
    
    if(
get_user_weapon(attacker) == CSW_AK47 && ak47_used[attacker]) {
        
        
SetHamParamFloat(4damage 999.0)
        
client_print(attackerprint_chat"It Works !!")
    }    
    
    if(
damagebit DMG_FALL) {
        
        return 
HAM_SUPERCEDE // don't take damage
    
}
    
    if(
attacker == victim && damagebit DMG_GRENADE) {
        
        return 
HAM_SUPERCEDE // no damage to owner of HE
    
}
    
    return 
HAM_IGNORED;

The damage that the attacker makes shows in HUD this way
PHP Code:
    register_event"Damage""Event_Damage""b""2!0""3=0""4!0" )


public 
Event_Damage(victim) {
    
    new 
attackerweaponbodydamage;
    
attacker get_user_attacker(victimweaponbody)
    
damage read_data(2)
    
    
set_dhudmessage(random_num(50,255), random_num(50,255), random_num(50,255), random_float(0.200.60), random_float(0.200.60), 06.00.5)
    
show_dhudmessage(attacker"%d"damage)
    

but the weapon damage isn't working in both ways. I need to fix the weapon damage and the HUD to work both in Ham_TakeDamage.

I've also tried :
1. Setting the damage in Post, still didn't work.
2. Setting damage in the Event_Damge, still didn't work.


2. Any stock to check if user is surfing?

solution :
PHP Code:
public IsUserSurfing(id)
{
    if( 
is_user_alive(id) )
    {
        new 
flags entity_get_int(idEV_INT_flags);
        if( 
flags FL_ONGROUND )
        {
            return 
0;
        }
        
        new 
Float:origin[3], Float:dest[3];
        
entity_get_vector(idEV_VEC_originorigin);
        
        
dest[0] = origin[0];
        
dest[1] = origin[1];
        
dest[2] = origin[2] - 1.0;
        
        new 
ptr create_tr2();
        
engfunc(EngFunc_TraceHullorigindest0flags FL_DUCKING HULL_HEAD HULL_HUMANidptr);
        new 
Float:flFraction;
        
get_tr2(ptrTR_flFractionflFraction);
        if( 
flFraction >= 1.0 )
        {
            
free_tr2(ptr);
            return 
0;
        }
        
        
get_tr2(ptrTR_vecPlaneNormaldest);
        
free_tr2(ptr);
        return 
dest[2] <= 0.7;
        
    }
    return 
0

3. I've added these codes from Connor's semiclip but it still doesn't work
Link : --> Here <--

PHP Code:
register_forward(FM_AddToFullPack"AddToFullPack"1)


public 
AddToFullPack(eseiEntidhostflagsplayerpSet)
{
    if(
get_pcvar_num(g_on) && get_pcvar_num(g_semi) && player && id != iEnt && IsAlive(id) && g_iTeamSemiclip g_iTeam[id] && IsAlive(iEnt) && g_iTeam[id] == g_iTeam[iEnt] && get_orig_retval())
    { 
        
set_es(esES_SolidSOLID_NOT)
    }


public 
PreThink(id)
{
    if(!
get_pcvar_num(g_on) || !get_pcvar_num(g_semi) || IsAlive(id) == || !(g_iTeamSemiclip g_iTeam[id]))
    { 
        return
    }
    
    new 
iPlayers[MAX_PLAYERS], iNumiPlayer;
    
get_players(iPlayersiNum"ae"g_szTeams[g_iTeam[id]])
    
    for(new 
ii<iNumi++)
    {
        
iPlayer iPlayers[i]
        if(
id != iPlayer)
        {
            
entity_set_int(iPlayerEV_INT_solidSOLID_NOT)
        }
    }
}

public 
client_PostThink(id)
{
    if(!
get_pcvar_num(g_on) || !get_pcvar_num(g_semi) || IsAlive(id) == || !(g_iTeamSemiclip g_iTeam[id]))
    {
        return
    }
    
    new 
iPlayers[MAX_PLAYERS], iNumiPlayer;
    
get_players(iPlayersiNum"ae"g_szTeams[g_iTeam[id]])
    
    for(new 
ii<iNumi++)
    {
        
iPlayer iPlayers[i]
        if(
id != iPlayer)
        {
            
entity_set_int(iPlayerEV_INT_solidSOLID_SLIDEBOX)
        }
    }



4. How Can I read a file ? Like if I want to make a new VIP system and want to read infos from file.


5. Why in find_ent_by_x , "-1" is always as the index?

6. Which classname is surf's jail button ? I've tried this but it doesn't open the jail
PHP Code:
RegisterHam(Ham_TraceAttack"func_button""fw_ButtonFunc"

public 
fw_ButtonFunc(iEntiAttackerFloat:fDamageFloat:vDirection[3], TraceHandleiDamageBits ) {
    
    
dllfunc(DLLFunc_UseiEntiAttacker

__________________

Last edited by edon1337; 02-19-2017 at 10:54.
edon1337 is offline
 



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 20:59.


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