Raised This Month: $ Target: $400
 0% 

Changing p_ model if no weapon is holding


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-10-2010 , 16:59   Changing p_ model if no weapon is holding
Reply With Quote #1

Hello there. I need a help with changing p_ model of a player, if there is no weapon in his hands.
Backstabnoob is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-23-2010 , 17:21   Re: Changing p_ model if no weapon is holding
Reply With Quote #2

Bump
Backstabnoob is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 03-23-2010 , 18:53   Re: Changing p_ model if no weapon is holding
Reply With Quote #3

Depending on the MOD, you can hook "CurWeapon" and check if they have no weapon. (Faster)

Code:
#include <amxmodx> #include <fakemeta> new const g_ChangeModel[] = "models/p_somemodel.mdl" public plugin_init()     register_forward(FM_PlayerPreThink,"Forward_PreThink"); public Forward_PreThink(id) {     if(!is_user_alive(id))         return         static WeaponMDL[6]     pev(id,pev_weaponmodel2,WeaponMDL,5);         if(!WeaponMDL[0])         set_pev(id,pev_weaponmodel2,g_ChangeModel); }
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 03-23-2010 , 19:15   Re: Changing p_ model if no weapon is holding
Reply With Quote #4

I don't know if this works. If it works then do I need to precache a default model/sound?

PHP Code:
#include < amxmodx >
#include < engine >

new g_iCurrentWeapon33 ]

new const 
p_model[ ] = "models/p_knife.mdl"

public plugin_init( )
{
    
register_event"CurWeapon""event_CurWeapon""be""1=0""2=0""3=0" )
}

public 
plugin_precache( )
{
    
precache_modelp_model )
}

public 
event_CurWeaponid )
{
    if( !
is_user_aliveid ) )
        return
        
    
g_iCurrentWeaponid ] = read_data)
    
    if( 
g_iCurrentWeaponid ] )
        return
        
    
entity_set_stringidEV_SZ_weaponmodelp_model )

EDIT: Do I need to put "1=0" right after the "be"? I'm not so good in register_event...
EDIT2: Fixed code

Last edited by Excalibur.007; 03-25-2010 at 07:08.
Excalibur.007 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-24-2010 , 01:56   Re: Changing p_ model if no weapon is holding
Reply With Quote #5

"1=0" is sometime sent after a "1=1" is sent, so you could switch to ak47 and have "1=1" + "2=28", but then get a "1=0" with another weapon id, so your idea is bad.

You should try

register_event("CurWeapon", "Even_CurWeapon_Strip", "be", "1=0", "2=0", "3=0")
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-24-2010 at 01:59.
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 08:48.


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