AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change nade model (https://forums.alliedmods.net/showthread.php?t=240172)

ezio_auditore 05-10-2014 06:57

Change nade model
 
How can we change the grenade's model when it is thrown.
i tried hooking FM_SetModel and read the frostnade plugin too..
but didn't get anything..
can someone help?

Backstabnoob 05-10-2014 08:24

Re: Change nade model
 
csx - grenade_throw forward

PHP Code:

public grenade_throwidgreindexwId )
{
   if( 
wId == CSW_HEGRENADE )
   {
       
set_pevgreindexpev_model"models/w_grenade2.mdl" )
   }



ezio_auditore 05-10-2014 10:07

Re: Change nade model
 
not working..

Backstabnoob 05-10-2014 10:27

Re: Change nade model
 
Weird, maybe grenade_throw is called before SetModel so it gets overwritten but I doubt it.

Show your code.

EDUTz 05-10-2014 14:56

Re: Change nade model
 
it has to be in fw_SetModel !

example from another plugin :

Code:

public fw_SetModel(entity, const model[])
{
        // We don't care
        if (strlen(model) < 8)
                return FMRES_IGNORED 
       
        // Get entity's classname
        static classname[10]
        pev(entity, pev_classname, classname, charsmax(classname))
       
        // Narrow down our matches a bit
        if (model[7] != 'w' || model[8] != '_')
                return FMRES_IGNORED 
       
        // Get damage time of grenade
        static Float:dmgtime
        pev(entity, pev_dmgtime, dmgtime)
       
        // Grenade not yet thrown
        if (dmgtime == 0.0)
                return FMRES_IGNORED 
        if (model[9] == 'h' && model[10] == 'e')
        {
                        engfunc(EngFunc_SetModel, entity, "w_ model for the hebomb . mdl")   
                        return FMRES_SUPERCEDE 
          }
        else if (model[9] == 'f' && model[10] == 'l')
        {
                        engfunc(EngFunc_SetModel, entity, "w_ model for the flashbang . mdl")   
                        return FMRES_SUPERCEDE 
          }
        else if (model[9] == 's' && model[10] == 'm')
        {
                        engfunc(EngFunc_SetModel, entity, "w_ model for the smoke . mdl")   
                        return FMRES_SUPERCEDE 
        }

return FMRES_IGNORED 
}



All times are GMT -4. The time now is 09:44.

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