Raised This Month: $ Target: $400
 0% 

Setting w_ Grenade Models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mlk27
Veteran Member
Join Date: May 2008
Old 02-20-2009 , 22:11   Setting w_ Grenade Models
Reply With Quote #1

How do we set custom models for w_ models?

If v_ and p_ i could just use pev_viewmodel2 and pev_weaponmodel2
Mlk27 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-20-2009 , 23:20   Re: Setting w_ Grenade Models
Reply With Quote #2

The w_ model is the weapon entity's model, so just use this:
Code:
engfunc(EngFunc_SetModel, entity, "models/w_yourmodel.mdl");
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 02-21-2009 , 01:01   Re: Setting w_ Grenade Models
Reply With Quote #3

when do we set it? and in which forward?
Mlk27 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-21-2009 , 02:09   Re: Setting w_ Grenade Models
Reply With Quote #4

This will turn your hegrenades into awps when thrown.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "hegrenade to awp"
#define VERSION "1.0"
#define AUTHOR "bugsy"

new g_MaxClients;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_forward(FM_SetModel"fw_SetModel");

    
g_MaxClients get_maxplayers();
}

public 
fw_SetModel(ent, const model[])
{
    if ( !
pev_valid(ent))
        return 
FMRES_IGNORED;
    
    new 
id pev(entpev_owner);

    if ( !(
<= id <= g_MaxClients) )
        return 
FMRES_IGNORED;

    if( 
equal(model"models/w_hegrenade.mdl" ) )
    {
        
engfunc(EngFunc_SetModelent"models/w_awp.mdl");
        return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;

__________________

Last edited by Bugsy; 02-21-2009 at 02:17.
Bugsy is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 02-21-2009 , 10:08   Re: Setting w_ Grenade Models
Reply With Quote #5

lol. thanks Bugsy!

btw what does this mean?

if ( !(1 <= id <= g_MaxClients) )
Mlk27 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-21-2009 , 14:32   Re: Setting w_ Grenade Models
Reply With Quote #6

That checks if "id" is given a valid player index, because player indexes range from 1 -> (max players allowed in server).
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-21-2009 , 14:49   Re: Setting w_ Grenade Models
Reply With Quote #7

I would do somethinkg like this :
Won't work with thrown nades (can be done in Ham_Spawn forward) and won't work for planted c4.
PHP Code:
/*    Copyright © 2009, ConnorMcLeod

    World Models is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with World Models; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "World Models"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define    m_iId            43

new const m_rgpPlayerItems_wpnbx[] = {343536373839}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_forward(FM_SetModel"SetModel")
}

public 
SetModel(iEnt, const szModel[])
{
    if( 
pev_valid(iEnt) != )
    {
        return 
FMRES_IGNORED
    
}

    if( 
szModel[0] == '*' )
    {
        return 
FMRES_IGNORED
    
}

    new 
szClassName[11]
    
pev(iEntpev_classnameszClassNamecharsmax(szClassName))
    if( !
equal(szClassName"weaponbox") )
    {
        return 
FMRES_IGNORED
    
}

    new 
iWeaponiId
    
for(new ii<=sizeof(m_rgpPlayerItems_wpnbx); i++)
    {
        
iWeapon get_pdata_cbase(iEntm_rgpPlayerItems_wpnbx[i], 4)
        if( 
iWeapon && pev_valid(iWeapon) == )
        {
            
iId get_pdata_int(iWeaponm_iId4)
            if( 
Set_Custom_World_Model(iEntiId) )
            {
                return 
FMRES_SUPERCEDE
            
}
            else
            {
                return 
FMRES_IGNORED
            
}
        }
    }
    return 
FMRES_IGNORED
}

Set_Custom_World_Model(iEntiId)
{
    new 
szModel[64]
    switch( 
iId )
    {
        case 
CSW_M4A1:formatex(szModelcharsmax(szModel), "models/custom/w_m4a1.mdl")
        case 
CSW_AK47:formatex(szModelcharsmax(szModel), "models/custom/w_ak47.mdl")
        case 
CSW_MP5NAVY:formatex(szModelcharsmax(szModel), "models/custom/w_mp5.mdl")
        case 
CSW_DEAGLE:formatex(szModelcharsmax(szModel), "models/custom/w_deagle.mdl")
        default:return 
0
    
}

    
engfunc(EngFunc_SetModeliEntszModel)
    return 
1

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-21-2009 at 15:04.
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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