AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP]Change weapon model (https://forums.alliedmods.net/showthread.php?t=108780)

byetovice 11-09-2009 11:24

[HELP]Change weapon model
 
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?

lazarev 11-09-2009 17:34

Re: [HELP]Change weapon model
 
post the full code please

Styles 11-09-2009 21:34

Re: [HELP]Change weapon model
 
Doesn't this plugin already exist? Ven made it?

ConnorMcLeod 11-09-2009 22:37

Re: [HELP]Change weapon model
 
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



Styles 11-09-2009 22:46

Re: [HELP]Change weapon model
 
Connor, FAIL!

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

really? I smell a COPY PASTE fail! iOwner maybe? :).

byetovice 11-10-2009 00:55

Re: [HELP]Change weapon model
 
set_pev(id, pev_weaponmodel2, "models/p_ultranade.mdl")
i will try it .. thanks


Arkshine 11-10-2009 03:49

Re: [HELP]Change weapon model
 
It should be set_pev(iOwner,

ConnorMcLeod 11-10-2009 05:38

Re: [HELP]Change weapon model
 
Quote:

Originally Posted by styles (Post 985486)
I smell

Fixed.


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

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