AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] With Admin model Code :) (https://forums.alliedmods.net/showthread.php?t=237247)

Flick3rR 03-20-2014 18:49

[Help] With Admin model Code :)
 
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 :D 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!

Baws 03-21-2014 17:24

Re: [Help] With Admin model Code :)
 
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.

NikKOo31 03-21-2014 17:48

Re: [Help] With Admin model Code :)
 
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



OnePL 03-22-2014 00:25

Re: [Help] With Admin model Code :)
 
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");




All times are GMT -4. The time now is 05:57.

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