Raised This Month: $ Target: $400
 0% 

[Help] With Admin model Code :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 03-20-2014 , 18:49   [Help] With Admin model Code :)
Reply With Quote #1

Hi there, helping the noobs people! I really want to ask you, where am I wrong in this code:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <engine>
#include <fakemeta>

// Define the Plugin Version
new const VERSION[] = { "1.0" };

#define vip ADMIN_LEVEL_G

public plugin_init()
{
    
register_plugin("AdminModels"VERSION"Flicker");
    
RegisterHam(Ham_Spawn,"player","FnHamSpawn",1);
}
public 
plugin_precache()
{
    
precache_model("models/player/AdminT/AdminT.mdl");
    
precache_model("models/player/AdminCT/AdminCT.mdl");
    
precache_model("models/noj12.mdl")
}
public 
FnHamSpawn(id)
{
    if(
is_user_alive(id))
    {
        if(
get_user_flags(id) & vip)
        {
            if(
cs_get_user_team(id) == CS_TEAM_CT)
            {
                
cs_set_user_model(id,"AdminCT");
            }
            else
            {
                
cs_set_user_model(id,"AdminT");
            }
        }
        if(
get_user_weapon(id) == CSW_KNIFE)
        {
            
set_pev(idpev_viewmodel2"models/noj12.mdl");
        }
    }

The purpose is a special model for the admin player (that's working) and a knife model for everyone in the server. And here comes the problem: when i connect to the server and start playing, I'm shooting with my knife Maybe the check for the weapon is worng, or I don't know, but the weapon in my hands is the glock18, but the model is the knife. Idk, if you help me, it will be great!!! Thanks a lot!
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Baws
Veteran Member
Join Date: Oct 2012
Old 03-21-2014 , 17:24   Re: [Help] With Admin model Code :)
Reply With Quote #2

If you want to replace the default knife of the server to a customized one, you just need to name the custom knife model file to the default model file then just replace it.
__________________
Like my clean plugins and work?
Baws is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 03-21-2014 , 17:48   Re: [Help] With Admin model Code :)
Reply With Quote #3

I don't think you can set a weapon model on player spawn ._.

Try this

PHP Code:
register_event("CurWeapon","CurWeapon","be","1=1"
PHP Code:
public CurWeapon(id)
{
    new 
Weapon read_data(2)
    
    if( 
Weapon != CSW_KNIFE )
        return 
PLUGIN_CONTINUE

    
new vModel[20]
    
format(vModel,19,"models/noj12.mdl")
    
entity_set_string(idEV_SZ_viewmodelvModel)
    return 
PLUGIN_HANDLED

NikKOo31 is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 03-22-2014 , 00:25   Re: [Help] With Admin model Code :)
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

stock isVip(id) return (get_user_flags(id) & read_flags("s"));

public 
plugin_init() {
    
register_plugin("AdminModels""0.0.1""OnePL");

    
RegisterHam(Ham_Spawn"player""PlayerSpawn"1);
    
RegisterHam(Ham_Item_Deploy"weapon_knife""WeaponKnife"1);
}

public 
plugin_precache() {
    
engfunc(0"models/player/AdminT/AdminT.mdl");
    
engfunc(0"models/player/AdminCT/AdminCT.mdl");
    
engfunc(0"models/noj12.mdl");
}

public 
PlayerSpawn(id) {
    if(!
is_user_alive(id) || !isVip(id)) return;

    
engfunc(75idengfunc(77id), "model"get_pdata_int(id114) == "AdminT" "AdminCT");
}

public 
WeaponKnife(ent) {
    new 
id get_pdata_cbase(ent414);

    if(!
is_user_alive(id) || !isVip(id)) return;

    
set_pev(id144"models/noj12.mdl");


Last edited by OnePL; 03-22-2014 at 00:28.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
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 05:57.


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