AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Changing p_ model if no weapon is holding (https://forums.alliedmods.net/showthread.php?t=121019)

Backstabnoob 03-10-2010 16:59

Changing p_ model if no weapon is holding
 
Hello there. I need a help with changing p_ model of a player, if there is no weapon in his hands.

Backstabnoob 03-23-2010 17:21

Re: Changing p_ model if no weapon is holding
 
Bump

Drak 03-23-2010 18:53

Re: Changing p_ model if no weapon is holding
 
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); }

Excalibur.007 03-23-2010 19:15

Re: Changing p_ model if no weapon is holding
 
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

ConnorMcLeod 03-24-2010 01:56

Re: Changing p_ model if no weapon is holding
 
"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")


All times are GMT -4. The time now is 08:48.

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