AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   A few problems.. (https://forums.alliedmods.net/showthread.php?t=189012)

MokeN 07-02-2012 17:20

A few problems..
 
Hello, sorry if i need help often, but i am new to hamsandwich..

So here's the problem..

As an Counter-Terrorist:
In round start i got godmode, which i shouldn't have..
Here's the Ham_TakeDamage

PHP Code:

public Ham_TakeDamage_PrevictiminflictorattackerFloat:damagedmgbits )
{
    if(
g_iCurrentGame == GAME_HIDE || g_iCurrentGame == GAME_MUSIC) return HAM_IGNORED
    
    
return (cs_get_user_team(victim) == CS_TEAM_CT) ? HAM_SUPERCEDE HAM_IGNORED


And another problem..

As an terrorist:
I got this Ham_Touch_Grenade function,
the problem is when i throw the grenade and it hits the ground, objects, players it's not exploding..
but when i throw it right into the air and it's not touching the ground or any objects, players it's exploding like a HE

PHP Code:

public Ham_Touch_Grenade_PreiEntityid )
{
        if(
g_iCurrentGame != GAME_DGBALL && g_iCurrentGame != GAME_SNOWBALL && g_iCurrentGame != GAME_ANGRYBIRDS && g_iCurrentGame != GAME_ZMBOMBS) return HAM_IGNORED 
       
        
if(is_user_alive(id))
        {
        
set_user_godmode(id)
        
ExecuteHamB(Ham_TakeDamageid,pev(iEntity,pev_owner), 0);
        } 
       
        
remove_entity(iEntity)
       
        return 
HAM_IGNORED


I've tried this about the exploding error, but then the T's gets godmode which they shouldn't:
PHP Code:

public fwdSetModel(ent,const model[])
{    
       if(!
pev_valid(ent) || !equal(model,"models/w_hegrenade.mdl")) return FMRES_IGNORED
       
       set_pev
(ent,pev_dmgtime,get_gametime() + 60.0//<-- THIS ONE I ADDED
       
switch(g_iCurrentGame)
       {
        case 
GAME_DGBALLengfunc(EngFunc_SetModelentg_szDodgeball_World)
        case 
GAME_ZMBOMBSengfunc(EngFunc_SetModelentg_szZombiebomb_World)
        case 
GAME_SNOWBALLengfunc(EngFunc_SetModelentg_szSnowball_World)
        case 
GAME_ANGRYBIRDSengfunc(EngFunc_SetModelentg_szAngryBirds_World)
        default: return 
HAM_IGNORED
       
}
       
       return 
FMRES_SUPERCEDE
       


Thanks in advance

Backstabnoob 07-02-2012 20:46

Re: A few problems..
 
PHP Code:

return (cs_get_user_team(victim) == CS_TEAM_CT) ? HAM_SUPERCEDE HAM_IGNORED 

You're superceding the damage if victim is CT. That's why you've got godmode.

For the second question, show how you register Ham_Touch.

StickP0le 07-02-2012 22:08

Re: A few problems..
 
you need to know that ham_supercede block the damage that's why counter terrorists doesn't receive any damage

MokeN 07-03-2012 04:44

Re: A few problems..
 
Quote:

Originally Posted by Backstabnoob (Post 1741618)
PHP Code:

return (cs_get_user_team(victim) == CS_TEAM_CT) ? HAM_SUPERCEDE HAM_IGNORED 

You're superceding the damage if victim is CT. That's why you've got godmode.

For the second question, show how you register Ham_Touch.

ah, thanks.

Here's the register:

PHP Code:

RegisterHamHam_Touch"grenade""Ham_Touch_Grenade_Pre"); 


Backstabnoob 07-03-2012 05:27

Re: A few problems..
 
You remove the grenade whenever it touches anything.

MokeN 07-03-2012 06:34

Re: A few problems..
 
And how to do that? (a)


All times are GMT -4. The time now is 15:01.

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