AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Set model when pick up a weapon (https://forums.alliedmods.net/showthread.php?t=183891)

Arenmake 04-28-2012 07:06

Set model when pick up a weapon
 
I have a menu in which I press an option and gives me a gun m4a1, modified model

But if a user selects the option, and then he drops the gun, I do not have to pick the model

I tried Fw_Item_Deploy_Post but I have two types of M4A1, I need to recognize which is which to set a model

As could be solved?

Bilal Pro 04-28-2012 12:06

Re: Set model when pick up a weapon
 
Use Curweapon

Exolent[jNr] 04-28-2012 15:52

Re: Set model when pick up a weapon
 
Quote:

Originally Posted by Bilal Pro (Post 1698125)
Use Curweapon

No, Ham_Item_Deploy post hook, like how he has it, is the best method.

JoKeR LauGh 04-30-2012 07:43

Re: Set model when pick up a weapon
 
Quote:

Originally Posted by Exolent[jNr] (Post 1698290)
No, Ham_Item_Deploy post hook, like how he has it, is the best method.

Teach me the forward please.

rak 04-30-2012 07:52

Re: Set model when pick up a weapon
 
Quote:

Originally Posted by JoKeR LauGh (Post 1699194)
Teach me the forward please.

PHP Code:

RegisterHam(Ham_Item_Deploy"weapon_m4a1" "fw_ItemDeployPost"1)

/********************************************/

public fw_ItemDeployPost(Weapon) {     
    if( 
pev_valid(Weapon) != 
        return
        
    static 
id
    
id get_pdata_cbase(Weapon41);
    
    
set_pev(idpev_viewmodel2"models/v_NEWM4A1.mdl")
    
set_pev(idpev_weaponmodel2"models/p_NEWM4A1.mdl")




JoKeR LauGh 04-30-2012 07:57

Re: Set model when pick up a weapon
 
^_^
Thanks~

But, Can I know what is the different between CurWeapon and Ham_Item_Deploy ?

*EDIT

@rak
for the first parameter in the set_pev why don't you just use loop? Sorry my scripting skill is low..

Exolent[jNr] 04-30-2012 09:28

Re: Set model when pick up a weapon
 
Quote:

Originally Posted by JoKeR LauGh (Post 1699206)
But, Can I know what is the different between CurWeapon and Ham_Item_Deploy ?

Ham_Item_Deploy is called only when the weapon is deployed for use.
CurWeapon is called many times that isn't just for weapon deployment, such as ammo updating.

Quote:

Originally Posted by JoKeR LauGh (Post 1699206)
for the first parameter in the set_pev why don't you just use loop? Sorry my scripting skill is low..

Because you already know the player who is holding the weapon, so you don't need to set it for all players.


All times are GMT -4. The time now is 07:49.

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