AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] CS1.6: Get nade type in Ham_Spawn forward. (https://forums.alliedmods.net/showthread.php?t=226513)

yokomo 09-19-2013 04:11

[Help] CS1.6: Get nade type in Ham_Spawn forward.
 
Hi, i tried to get grenade type in Ham_Spawn forward but the it seem my method is not correct:
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <engine>

public plugin_init()
{
    
register_plugin("HamGrenadeTrail""0.0.1""wbyokomo")
    
    
RegisterHam(Ham_Spawn"grenade""OnSpawnGrenade"1)
}

public 
OnSpawnGrenade(ent)
{
    new 
szModel[32]
    
entity_get_string(entEV_SZ_modelszModel31)
    
client_print(0print_chat"[NADE] Model: %s"szModel)


I use:
PHP Code:

    entity_get_string(entEV_SZ_modelszModel31)
    
client_print(0print_chat"[NADE] Model: %s"szModel

to get grenade model, but the result is always: weapons/grenade.mdl. Why not it print "weapons/w_hegrenade.mdl" or "weapons/w_flashbang.mdl" ?

simanovich 09-19-2013 04:22

Re: [Help] CS1.6: Get nade type in Ham_Spawn forward.
 
Quote:

Originally Posted by yokomo (Post 2037295)
Hi, i tried to get grenade type in Ham_Spawn forward but the it seem my method is not correct:
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <engine>

public plugin_init()
{
    
register_plugin("HamGrenadeTrail""0.0.1""wbyokomo")
    
    
RegisterHam(Ham_Spawn"grenade""OnSpawnGrenade"1)
}

public 
OnSpawnGrenade(ent)
{
    new 
szModel[32]
    
entity_get_string(entEV_SZ_modelszModel31)
    
client_print(0print_chat"[NADE] Model: %s"szModel)


I use:
PHP Code:

    entity_get_string(entEV_SZ_modelszModel31)
    
client_print(0print_chat"[NADE] Model: %s"szModel

to get grenade model, but the result is always: weapons/grenade.mdl. Why not it print "weapons/w_hegrenade.mdl" or "weapons/w_flashbang.mdl" ?

1. Use FM_SetModel
2. Because it's grenade, just a grenade.

NiHiLaNTh 09-19-2013 06:42

Re: [Help] CS1.6: Get nade type in Ham_Spawn forward.
 
If you need to determine grenade type use this stocks. Search for misc stocks.

yokomo 09-19-2013 08:21

Re: [Help] CS1.6: Get nade type in Ham_Spawn forward.
 
Quote:

Originally Posted by NiHiLaNTh (Post 2037316)
If you need to determine grenade type use this stocks. Search for misc stocks.

Cool found it:
PHP Code:

GetGrenadeTypeentbool:bCheckClass true 

    if( 
bCheckClass 
    { 
        new class[
9
        
pev(entpev_classname, class, charsmax(class)) 
        if( !
equal(class, "grenade") ) 
        { 
            return 

        

    } 

    if( 
get_pdata_bool(entm_bIsC4) ) 
    { 
        return 
CSW_C4 
    


    new 
usEvent get_pdata_short(entm_usEvent_Grenade
    if( !
usEvent 
    { 
        return 
CSW_FLASHBANG 
    


    static 
m_usHgrenExplo // , m_usSmokeExplo 
    
if( !m_usHgrenExplo 
    { 
        
m_usHgrenExplo engfunc(EngFunc_PrecacheEvent1"events/createexplo.sc"
        
// m_usSmokeExplo = engfunc(EngFunc_PrecacheEvent, 1, "events/createsmoke.sc") 
    


    return 
usEvent == m_usHgrenExplo CSW_HEGRENADE CSW_SMOKEGRENADE 


Sorry i don't want FM_SetModel, it called too much.

yokomo 06-18-2014 08:41

Re: [Help] CS1.6: Get nade type in Ham_Spawn forward.
 
Bring back my old post.

Ok now i want to know is there any forward instead of "FM_SetModel" so we can get the grenade owner id? "FM_SetModel" call to often. It would be better if it can be done with Orpheu since i'm using Orpheu on server.

Thanks.

NiHiLaNTh 06-18-2014 09:44

Re: [Help] CS1.6: Get nade type in Ham_Spawn forward.
 
grenade_throw from csx :?


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

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