AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_Killed and knife (https://forums.alliedmods.net/showthread.php?t=76137)

Sam Tsuki 08-19-2008 01:04

Ham_Killed and knife
 
I'm having a problem with Ham_Killed when the weapon used is a knife
Here's what I do:
PHP Code:

public plugin_init() 
{
    
RegisterHam(Ham_Killed"func_wall""monster_killed")


PHP Code:

public monster_killed(thisidattackershouldgib)
{
    if(!
get_pcvar_num(rehl_switch) || g_zombie[idattacker])
        return 
HAM_IGNORED
    
    
//make sure player is connected
    
if (is_user_connected(idattacker))
    {
        if(!
pev_valid(this))
            return 
HAM_IGNORED
        
        
new monmodel[31]
        new 
monster[21], points
        entity_get_string
(thisEV_SZ_modelmonmodel30)
        if(
equal(monmodel"models/headcrab.mdl")) {
            
monster "Head Crab"
            
points get_pcvar_num(hea_points)
        }
        else if(
equal(monmodel"models/zombie.mdl")) {
            
monster "Zombie"
            
points get_pcvar_num(zom_points)
        }
        else return 
HAM_IGNORED
        
        rehl_points
[idattacker] += points
        
new frags get_user_frags(idattacker) + 1
        set_user_frags
(idattackerfrags)
        new 
msg[250]
        
format(msg249"^x04[RE:HL Mod] ^x01You got '^x03%d^x01' points for killing a '^x04%s^x01'!"pointsmonster)
        
colored_msg(idattackermsgMSG_ONEsaytext)
        
cs_set_user_deaths(idattackercs_get_user_deaths(idattacker))
        
remove_entity(this)
    }
    return 
HAM_HANDLED


When a monster is killed with a knife the server crashs
Can anyone help plz


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

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