Raised This Month: $ Target: $400
 0% 

[HELP]Change weapon model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
byetovice
Senior Member
Join Date: Nov 2009
Location: Turkey
Old 11-09-2009 , 11:24   [HELP]Change weapon model
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <fun>
#include <cstrike>
#include <Vexd_Utilities>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_clcmd("say /ultranade","nade_event")
 
}
public 
plugin_precache()
{
precache_model("models/v_ultranade.mdl")
precache_model("models/p_ultranade.mdl")
precache_model("models/w_ultranade.mdl")
}
public 
nade_event(id)
{
 
set_task(0.1,"nadening",id,"",0,"b")
 
}

public 
nadening(id)
{

new 
Weapon=get_user_weapon(id)
if(
Weapon==CSW_HEGRENADE)
{
Entvars_Set_String(idEV_SZ_viewmodel,"models/v_ultranade.mdl")
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/ 
i can change the hegrenades model with this code...[when i use /ultranade]
but the model changes to default model when i throw the bomb..

what should i do?
byetovice is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 11-09-2009 , 17:34   Re: [HELP]Change weapon model
Reply With Quote #2

post the full code please
lazarev is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-09-2009 , 21:34   Re: [HELP]Change weapon model
Reply With Quote #3

Doesn't this plugin already exist? Ven made it?
Styles is offline
Send a message via AIM to Styles
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-09-2009 , 22:37   Re: [HELP]Change weapon model
Reply With Quote #4

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

#define VERSION "0.0.1"

#define EXTRAOFFSET_WEAPON 4
#define m_pPlayer 41

public plugin_init()
{
    
register_plugin("Ultra Nade"VERSION"Author")

    
RegisterHam(Ham_Item_Deploy"weapon_hegrenade""HeGrenade_Deploy"1)
    
register_forward(FM_SetModel"SetModel")
}

public 
plugin_precache()
{
    
precache_model("models/v_ultranade.mdl")
    
precache_model("models/p_ultranade.mdl")
    
precache_model("models/w_ultranade.mdl")
}

public 
HeGrenade_Deploy(const iEntity)
{
    new 
iOwner get_pdata_cbase(iEntitym_pPlayerEXTRAOFFSET_WEAPON)
    if( 
iOwner )
    {
        
set_pev(iOwnerpev_viewmodel2"models/v_ultranade.mdl")
        
set_pev(iOwnerpev_weaponmodel2"models/p_ultranade.mdl")
    }
}

public 
SetModel(const iEntity, const szModel[])
{
    if( 
pev_valid(iEntity) && equal(szModel"models/w_hegrenade.mdl") )
    {
        
engfunc(EngFunc_SetModeliEntity"models/w_ultranade.mdl")
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-10-2009 at 05:37.
ConnorMcLeod is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-09-2009 , 22:46   Re: [HELP]Change weapon model
Reply With Quote #5

Connor, FAIL!

set_pev(id, pev_viewmodel2, models/v_ultranade.mdl")

really? I smell a COPY PASTE fail! iOwner maybe? .
Styles is offline
Send a message via AIM to Styles
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-10-2009 , 05:38   Re: [HELP]Change weapon model
Reply With Quote #6

Quote:
Originally Posted by styles View Post
I smell
Fixed.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
byetovice
Senior Member
Join Date: Nov 2009
Location: Turkey
Old 11-10-2009 , 00:55   Re: [HELP]Change weapon model
Reply With Quote #7

set_pev(id, pev_weaponmodel2, "models/p_ultranade.mdl")
i will try it .. thanks

byetovice is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-10-2009 , 03:49   Re: [HELP]Change weapon model
Reply With Quote #8

It should be set_pev(iOwner,
__________________
Arkshine 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:41.


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