AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Reliable channel overflowe (https://forums.alliedmods.net/showthread.php?t=155665)

One 04-25-2011 06:18

Reliable channel overflowe
 
hi,

idk why my user will not be respawned and will be kicked because of channel overflowe.

PHP Code:

RegisterHam(Ham_TakeDamage"player""hook_TakeDamage");

public 
hook_TakeDamage(thisidinflictoridattackerFloat:damagedamagebits)
{

if(
idattacker == || is_user_connected(idattacker))
        {
            return 
HAM_SUPERCEDE;
        }
        else
        {
            if(
checkAutoRespawn(thisdamage))
            {
                return 
HAM_SUPERCEDE;
            }
        }
}

stock checkAutoRespawn(thisFloat:damage)
{
    
    if(
get_pcvar_num(sv_autorespawn))
    {
        
health[this] -= damage;
        if(
health[this] < 1.0)
        {
            
set_pev(thispev_health0.0);
            
set_pev(thispev_deadflagDEAD_RESPAWNABLE);
            
            
dllfunc(DLLFunc_Spawnthis);
            return 
1;
        }
    }
    return 
0;



Arkshine 04-25-2011 07:16

Re: Reliable channel overflowe
 
Why hooking TakeDamage and not Killed ?

One 04-25-2011 07:26

Re: Reliable channel overflowe
 
because i dont want that user dies.
i want to respawn user before he dies.
and point 2 is because the user can be stucked :-(

oh and user can fall. in this case he will be respawned again. something like surf

SonicSonedit 04-25-2011 07:37

Re: Reliable channel overflowe
 
One
Quote:

because i dont want that user dies.
Use return HAM_IGNORED instead return HAM_SUPERCEDE when you don't need to block function, use ExecuteHamB(Ham_CS_RoundRespawn, id) instead of dllfunc(DLLFunc_Spawn, this) and don't use set_pev(this, pev_health, 0.0) and set_pev(this, pev_deadflag, DEAD_RESPAWNABLE) since player didn't die. Setting health to 0 will do nothing (except causing client-side bugs and errors in poor-coded plugins that check health to know if user alive) and setting respawnable flag to alive entity is a bad idea.

xPaw 04-25-2011 07:41

Re: Reliable channel overflowe
 
Code:
RegisterHam( Ham_Killed, "player", "FwdHamPlayerKilled", 1 ); public FwdHamPlayerKilled( const id ) {     entity_set_int( id, EV_INT_deadflag, DEAD_RESPAWNABLE ); }

works fine

One 04-25-2011 07:47

Re: Reliable channel overflowe
 
ok thanks but what about when user falls & got for example only 10 dmg?
i dont think this can be catched by Ham_Killed.
so i have to use takedamge anyways.
but i will test to clean the code for first. i hope this works.

SonicSonedit 04-25-2011 07:52

Re: Reliable channel overflowe
 
One
Ham_Killed registers any death.
Quote:

because i dont want that user dies.
i want to respawn user before he dies.
Decide what you need: respawn player AFTER he died or make it look like player respawned right BEFORE he died.

One 04-29-2011 08:16

Re: Reliable channel overflowe
 
1 Attachment(s)
Quote:

Originally Posted by SonicSonedit (Post 1457343)
One
Ham_Killed registers any death.

Decide what you need: respawn player AFTER he died or make it look like player respawned right BEFORE he died.

nope its not the same.

i tried it and its not what i want.

for sure i can block death msg & fix the scores but its not the same.
before player be respawned he willbe killed!

i tried to return it that my user willnot be killed but its not working :-(


All times are GMT -4. The time now is 20:07.

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