Raised This Month: $ Target: $400
 0% 

cs_set_user_model — place for call


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-07-2013 , 10:02   Re: cs_set_user_model — place for call
Reply With Quote #10

I have strange problem with models set and userinfo O_O. My code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Admin Models"
#define VERSION "1.0"
#define AUTHOR "Phantomas"

public plugin_precache()
{
    
precache_model("models/player/leet_sp/leet_sp.mdl")
    
precache_model("models/player/gsg9_sp/gsg9_sp.mdl")
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_SetClientKeyValue"SetClientKeyValue")
}

public 
set_model(const id, const szSetModel[])
{
    new 
szModel[16]
    
get_user_info(id"model"szModelcharsmax(szModel))
    if(!
equal(szModelszSetModel))
    {
        
set_user_info(id"model"szSetModel)
    }
    return 
FMRES_SUPERCEDE
}

public 
SetClientKeyValue(const id, const szInfoBuffer[], const szKey[], const szValue[])
{
    if(
equal(szKey"model"))
    {    
        if(
equal(szValue"arctic") || equal(szValue"guerilla") || equal(szValue"leet") || equal(szValue"terror"))
        {
            new 
ns[2]
            
get_user_info(id"sp_model"ns1)
            if(!
equali(ns"0"))
            {
                new 
flags get_user_flags(id)
                if(
flags ADMIN_KICK)
                {
                    return 
set_model(id"leet_sp")
                }            
            }
        }
        
        if(
equal(szValue"gign") || equal(szValue"gsg9") || equal(szValue"sas") || equal(szValue"urban"))
        {
            new 
ns[2]
            
get_user_info(id"sp_model"ns1)
            if(!
equali(ns"0"))
            {
                new 
flags get_user_flags(id)
                if(
flags ADMIN_KICK)
                {
                    return 
set_model(id"gsg9_sp")
                }
            }
        }
    }
    return 
FMRES_IGNORED

It's set gsg9_sp or leet_sp model for admins.
But, I want add disable feature. If ADMIN does not want to use custom (_sp) model, then he write:
Code:
setinfo "sp_model" "0"
It's works at first sight, but:
If admin connect to server without "sp_model" setinfo, join in team, got your custom _sp model (it's okay). And if he alive and he write "sp_model" "0" setinfo right now, then model of admin be changed to default selected (realtime)! Why? How to fix it?
Phant is offline
Send a message via ICQ to Phant
 



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 23:20.


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