Raised This Month: $ Target: $400
 0% 

[Solved] Knife view model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 10-10-2015 , 11:07   [Solved] Knife view model
Reply With Quote #1

Solved...

Solution below post(s)

PHP Code:
#pragma semicolon 1

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("testblah""1.0""redivcram");
    
    
register_event("CurWeapon""CurrentWeapon""be""1=1");
}

public 
plugin_precache()
{
    
precache_model("models/xgcdr/v_ctblade.mdl");
    
precache_model("models/xgcdr/v_tblade.mdl");
    
precache_model("models/xgcdr/v_vipblade.mdl");
    
precache_model("models/xgcdr/v_svipblade.mdl");
    
precache_model("models/xgcdr/v_adminblade.mdl");
    
precache_model("models/xgcdr/v_headblade.mdl");
}

public 
CurrentWeapon(id)
{
    if(
get_user_flags(id) & ADMIN_IMMUNITY && get_user_flags(id) && ADMIN_CVAR && get_user_weapon(id) == CSW_KNIFE)
    {
        
set_pev(idpev_viewmodel"models/xgcdr/v_headblade.mdl");
    }
    else if(
get_user_flags(id) & ADMIN_CHAT && get_user_weapon(id) == CSW_KNIFE)
    {
        
set_pev(idpev_viewmodel"models/xgcdr/v_adminblade.mdl");
    }
    else if(
get_user_flags(id) & ADMIN_LEVEL_F && get_user_weapon(id) == CSW_KNIFE)
    {
        
set_pev(idpev_viewmodel"models/xgcdr/v_svipblade.mdl");
    }
    else if(
get_user_flags(id) & ADMIN_LEVEL_H && get_user_weapon(id) == CSW_KNIFE)
    {
        
set_pev(idpev_viewmodel"models/xgcdr/v_vipblade.mdl");
    }
    else
    {
        if(
get_user_team(id) == && get_user_weapon(id)== CSW_KNIFE)
        {
            
set_pev(idpev_viewmodel"models/xgcdr/v_ctblade.mdl");
        }
        else if(
get_user_team(id) == && get_user_weapon(id) == CSW_KNIFE)
        {
            
set_pev(idpev_viewmodel"models/xgcdr/v_tblade.mdl");
        }
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;


Last edited by redivcram; 10-10-2015 at 13:50. Reason: Solved
redivcram is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-10-2015 , 13:10   Re: [Help] Knife view model
Reply With Quote #2

You should be using Deploy, not CurWeapon. Deploy is the right place to put your code, you will set exactly after the game.

Now, I think that the problem is that you are using pev_viewmodel. When using pev_viewmodel you have to allocate the string. If you don't want to allocate(EngFunc_AllocString) manually, you can use pev_viewmodel2. If you choose to allocate be sure to do only one time in a place like init and save the value.
__________________
HamletEagle is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 10-10-2015 , 13:47   Re: [Help] Knife view model
Reply With Quote #3

Alright, thanks, that should do it... took a while to search for the other pevs

Spoiler
redivcram 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 22:05.


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