AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   force weapon (https://forums.alliedmods.net/showthread.php?t=114185)

wyrda 01-02-2010 14:44

force weapon
 
How do I force a player to change weapon to knife?

tuty 01-02-2010 17:36

Re: force weapon
 
engclient_cmd( index, "weapon_knife" );

wyrda 01-02-2010 18:39

Re: force weapon
 
Thank but this doesn't work for what I want.If I select the knife and type /knife I want my model to be changed.If a switch to another weapon and back to knife it works.

crazyeffect 01-02-2010 18:40

Re: force weapon
 
You want to change the skin of your knife?

wyrda 01-02-2010 18:56

Re: force weapon
 
Yes.I did it but if the current weapon is the knife I need a "refresh".

wyrda 01-03-2010 07:17

Re: force weapon
 
I solve it.
Now another problem :).
How can I determine what weapon has player now?(don't need with CurWeapon)
Solve it :).

Arkshine 01-03-2010 07:31

Re: force weapon
 
get_user_weapon()

wyrda 01-03-2010 08:14

Re: force weapon
 
I thought i solve it with get-user_wepon but it doesn't work

PHP Code:

if(PW[id])
    {
        
PW[id]=0;
        new 
ammo,clip;
        if( 
get_user_weapon(id,clip,ammo) == CSW_KNIFE )
            
console_cmd(id,"lastinv;lastinv");
    }
    else
    {
        
PW[id]=1;
        new 
ammo,clip;
        if( 
get_user_weapon(id,clip,ammo) == CSW_KNIFE )        
            
set_pevidpev_viewmodel2g_NewModel );
    } 


If I have a pistol it still change the model.Why?

Arkshine 01-03-2010 08:30

Re: force weapon
 
To change the knife model, you should hook FM_PrecacheModel and FM_ModelIndex ; this way the precache count will not increase.

wyrda 01-03-2010 08:37

Re: force weapon
 
Actually when I type /knife I want the knife to change to normal or the new model.


All times are GMT -4. The time now is 04:16.

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