Raised This Month: $319 Target: $400
 79%   Almost there!

Vip Model player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jievylook
Senior Member
Join Date: Sep 2018
Old 05-25-2019 , 01:20   Vip Model player
Reply With Quote #1

Hello everyone
I have this script but for some reason all the CT players get with the vip model and the TT players with the terrorist model

and I also need to know how to create the players vips


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

#define PLUGIN "VIP CT/TR Models"
#define VERSION "1.0"
#define AUTHOR "Unkolix"

new const VIP_CT[] = "vip_ct";
new const 
VIP_CT_MODEL[] = "models/player/vip_ct/vip_ct.mdl";
new const 
VIP_TR[] = "vip_tr";
new const 
VIP_TR_MODEL[] = "models/player/vip_tt/vip_tt.mdl";
new 
player_model[33][32];
new 
bool:g_model[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_SetClientKeyValue"fw_SetClientKeyValue")
    
register_forward(FM_ClientUserInfoChanged"fw_ClientUserInfoChanged")
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
}

public 
plugin_precache() {
    
precache_model(VIP_TR_MODEL
    
precache_model(VIP_CT_MODEL)
}

public 
fwHamPlayerSpawnPost(id) {
    if(
cs_get_user_team(id) & CS_TEAM_T)
    {
        
copy(player_model[id], 31VIP_TR)
        
        new 
currentmodel[32];
        
fm_get_user_model(idcurrentmodelsizeof currentmodel 1);
            
        if(!
equal(currentmodelplayer_model[id]))
        {
            
fm_set_user_model(idplayer_model[id])
        }
    }
    else if(
cs_get_user_team(id) & CS_TEAM_CT)
    {
        
copy(player_model[id], 31VIP_CT)

        new 
currentmodel[32];
        
fm_get_user_model(idcurrentmodelsizeof currentmodel 1);
        
        if(!
equal(currentmodelplayer_model[id]))
        {
            
fm_set_user_model(idplayer_model[id])
        }
    }
}

public 
fw_SetClientKeyValue(idinfobufferkey[], value[])
{   
    if (
g_model[id] && equal(key"model"))
        return 
FMRES_SUPERCEDE
    
    
return FMRES_IGNORED
}

public 
fw_ClientUserInfoChanged(idinfobuffer)
{   
    if (!
g_model[id])
        return 
FMRES_IGNORED
    
    
new currentmodel[32]; 
    
fm_get_user_model(idcurrentmodelsizeof currentmodel 1);
    
    if(!
equal(currentmodelplayer_model[id]))
        
fm_set_user_model(idplayer_model[id]) 
    
    return 
FMRES_IGNORED
}

stock fm_set_user_model(playermodelname[])
{   
    
engfunc(EngFunc_SetClientKeyValueplayerengfunc(EngFunc_GetInfoKeyBufferplayer), "model"modelname)
    
    
g_model[player] = true
}

stock fm_get_user_model(playermodel[], len)
{   
    
engfunc(EngFunc_InfoKeyValueengfunc(EngFunc_GetInfoKeyBufferplayer), "model"modellen)
}

stock fm_reset_user_model(player)
{         
    
g_model[player] = false
    
    dllfunc
(DLLFunc_ClientUserInfoChangedplayerengfunc(EngFunc_GetInfoKeyBufferplayer))

jievylook is offline
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 05-25-2019 , 02:57   Re: Vip Model player
Reply With Quote #2

Use This Code:

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

public plugin_init() {
        register_plugin("AMX Admin Model", "1.1.1", "whitemike")
        register_event("ResetHUD", "resetModel", "b")
        return PLUGIN_CONTINUE
}

public plugin_precache() {
        precache_model("models/player/vip_ct/vip_ct.mdl")
        precache_model("models/player/vip_te/vip_te.mdl")

        return PLUGIN_CONTINUE
}

public resetModel(id, level, cid) {
        if (get_user_flags(id) & ADMIN_LEVEL_H) {
                new CsTeams:userTeam = cs_get_user_team(id)
                if (userTeam == CS_TEAM_T) {
                        cs_set_user_model(id, "vip_te")
                }
                else if(userTeam == CS_TEAM_CT) {
                        cs_set_user_model(id, "vip_ct")
                }
                else {
                        cs_reset_user_model(id)
                }
        }

        return PLUGIN_CONTINUE
}
__________________
Facebook
My YouTube
Ro{Y}aL WarLanD CommuniTy
Selling Zombie CSO 4.3 Money System Mod
DON KHAN 1 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-25-2019 , 04:04   Re: Vip Model player
Reply With Quote #3

No, use this:

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

new const SKIN_FLAG ADMIN_RESERVATION
new const SKIN_CT[] = "CustomAdmCT"
new const SKIN_T[] = "CustomAdmT"

new bool:g_bHasCustomSkin[33]

public 
plugin_init()
{
    
register_plugin("Simple VIP Model""1.0""OciXCrom")
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
}

public 
plugin_precache()
{    
    
precache_player_model(SKIN_CT)
    
precache_player_model(SKIN_T)
}

public 
client_putinserver(id)
    
g_bHasCustomSkin[id] = false

public OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        if(
get_user_flags(id) & SKIN_FLAG)
        {
            switch(
cs_get_user_team(id))
            {
                case 
CS_TEAM_CTset_model(idSKIN_CT)
                case 
CS_TEAM_Tset_model(idSKIN_T)
            }
        }
        else if(
g_bHasCustomSkin[id])
        {
            
g_bHasCustomSkin[id] = false
            cs_reset_user_model
(id)
        }
    }
}

set_model(const id, const szModel[])
{
    
cs_set_user_model(idszModel)
    
g_bHasCustomSkin[id] = true
}

stock precache_player_model(const name[], &id 0)
{
    new 
model[128]
    
formatex(modelcharsmax(model), "models/player/%s/%sT.mdl"namename)

    if(
file_exists(model))
        
id precache_generic(model)

    static const 
extension[] = "T.mdl"
    
#pragma unused extension

    
copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")
    return 
precache_model(model)

__________________


Dear admins. If somehow you managed to read this, plz fix.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 05-25-2019 , 06:38   Re: Vip Model player
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
No, use this:

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

new const SKIN_FLAG ADMIN_RESERVATION
new const SKIN_CT[] = "CustomAdmCT"
new const SKIN_T[] = "CustomAdmT"

new bool:g_bHasCustomSkin[33]

public 
plugin_init()
{
    
register_plugin("Simple VIP Model""1.0""OciXCrom")
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
}

public 
plugin_precache()
{    
    
precache_player_model(SKIN_CT)
    
precache_player_model(SKIN_T)
}

public 
client_putinserver(id)
    
g_bHasCustomSkin[id] = false

public OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        if(
get_user_flags(id) & SKIN_FLAG)
        {
            switch(
cs_get_user_team(id))
            {
                case 
CS_TEAM_CTset_model(idSKIN_CT)
                case 
CS_TEAM_Tset_model(idSKIN_T)
            }
        }
        else if(
g_bHasCustomSkin[id])
        {
            
g_bHasCustomSkin[id] = false
            cs_reset_user_model
(id)
        }
    }
}

set_model(const id, const szModel[])
{
    
cs_set_user_model(idszModel)
    
g_bHasCustomSkin[id] = true
}

stock precache_player_model(const name[], &id 0)
{
    new 
model[128]
    
formatex(modelcharsmax(model), "models/player/%s/%sT.mdl"namename)

    if(
file_exists(model))
        
id precache_generic(model)

    static const 
extension[] = "T.mdl"
    
#pragma unused extension

    
copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")
    return 
precache_model(model)

Apart from setting models on spawn you have to hook FM_SetClientKeyValue and do some checks there too (not sure if it's necessary in public mods).
Also use set_user_info, cs_set_user_model will overflow players.
__________________

Last edited by edon1337; 05-25-2019 at 06:39.
edon1337 is offline
Send a message via Skype™ to edon1337
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-25-2019 , 07:14   Re: Vip Model player
Reply With Quote #5

It's fine, his server won't have 20 VIPs playing at the same time. (?)
__________________
<VeCo> is offline
jievylook
Senior Member
Join Date: Sep 2018
Old 05-25-2019 , 11:46   Re: Vip Model player
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
No, use this:

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

new const SKIN_FLAG ADMIN_RESERVATION
new const SKIN_CT[] = "CustomAdmCT"
new const SKIN_T[] = "CustomAdmT"

new bool:g_bHasCustomSkin[33]

public 
plugin_init()
{
    
register_plugin("Simple VIP Model""1.0""OciXCrom")
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
}

public 
plugin_precache()
{    
    
precache_player_model(SKIN_CT)
    
precache_player_model(SKIN_T)
}

public 
client_putinserver(id)
    
g_bHasCustomSkin[id] = false

public OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        if(
get_user_flags(id) & SKIN_FLAG)
        {
            switch(
cs_get_user_team(id))
            {
                case 
CS_TEAM_CTset_model(idSKIN_CT)
                case 
CS_TEAM_Tset_model(idSKIN_T)
            }
        }
        else if(
g_bHasCustomSkin[id])
        {
            
g_bHasCustomSkin[id] = false
            cs_reset_user_model
(id)
        }
    }
}

set_model(const id, const szModel[])
{
    
cs_set_user_model(idszModel)
    
g_bHasCustomSkin[id] = true
}

stock precache_player_model(const name[], &id 0)
{
    new 
model[128]
    
formatex(modelcharsmax(model), "models/player/%s/%sT.mdl"namename)

    if(
file_exists(model))
        
id precache_generic(model)

    static const 
extension[] = "T.mdl"
    
#pragma unused extension

    
copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")
    return 
precache_model(model)


Sorry but this serves for the following?
If the vip is a terrorist, use a certain model and if vip is ct use another model other than the vip tt model?
jievylook is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 05-25-2019 , 11:47   Re: Vip Model player
Reply With Quote #7

Quote:
Originally Posted by <VeCo> View Post
It's fine, his server won't have 20 VIPs playing at the same time. (?)
How would you know? Free VIP time?
__________________
edon1337 is offline
Send a message via Skype™ to edon1337
jievylook
Senior Member
Join Date: Sep 2018
Old 05-26-2019 , 12:28   Re: Vip Model player
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
No, use this:

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

new const SKIN_FLAG ADMIN_RESERVATION
new const SKIN_CT[] = "CustomAdmCT"
new const SKIN_T[] = "CustomAdmT"

new bool:g_bHasCustomSkin[33]

public 
plugin_init()
{
    
register_plugin("Simple VIP Model""1.0""OciXCrom")
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
}

public 
plugin_precache()
{    
    
precache_player_model(SKIN_CT)
    
precache_player_model(SKIN_T)
}

public 
client_putinserver(id)
    
g_bHasCustomSkin[id] = false

public OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        if(
get_user_flags(id) & SKIN_FLAG)
        {
            switch(
cs_get_user_team(id))
            {
                case 
CS_TEAM_CTset_model(idSKIN_CT)
                case 
CS_TEAM_Tset_model(idSKIN_T)
            }
        }
        else if(
g_bHasCustomSkin[id])
        {
            
g_bHasCustomSkin[id] = false
            cs_reset_user_model
(id)
        }
    }
}

set_model(const id, const szModel[])
{
    
cs_set_user_model(idszModel)
    
g_bHasCustomSkin[id] = true
}

stock precache_player_model(const name[], &id 0)
{
    new 
model[128]
    
formatex(modelcharsmax(model), "models/player/%s/%sT.mdl"namename)

    if(
file_exists(model))
        
id precache_generic(model)

    static const 
extension[] = "T.mdl"
    
#pragma unused extension

    
copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")
    return 
precache_model(model)


You can help me? Where do I place the models of the vip ct and the vip tr?
jievylook is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 05-26-2019 , 13:09   Re: Vip Model player
Reply With Quote #9

Quote:
Originally Posted by jievylook View Post
You can help me? Where do I place the models of the vip ct and the vip tr?
Anywhere in your models folder. Make sure to add their paths to your code.

eg.
PHP Code:
new const SKIN_CT[] = "models/player/customvip/vip_ct.mdl" 
new const SKIN_T[] = "models/player/customvip/vip_t.mdl" 
__________________
Too broke to change username to "Uberwire".
Discord: Uberwire#6773
Gamebanana: Uberwire
ModDB: uberwire
redivcram is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-26-2019 , 14:12   Re: Vip Model player
Reply With Quote #10

Quote:
Originally Posted by jievylook View Post
You can help me? Where do I place the models of the vip ct and the vip tr?
PHP Code:
new const SKIN_CT[] = "CustomAdmCT" 
new const SKIN_T[] = "CustomAdmT" 
CT skin is "models/player/CustomAdmCT/CustomAdmCT.mdl"
T skin is "models/player/CustomAdmT/CustomAdmT.mdl"

Folder name and model name should be the same.
__________________
<VeCo> is offline
Reply


Thread Tools
Display Modes

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 02:47.


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