AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Vip Model player (https://forums.alliedmods.net/showthread.php?t=316477)

jievylook 05-25-2019 01:20

Vip Model player
 
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))



DON KHAN 1 05-25-2019 02:57

Re: Vip Model player
 
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
}


OciXCrom 05-25-2019 04:04

Re: Vip Model player
 
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)



edon1337 05-25-2019 06:38

Re: Vip Model player
 
Quote:

Originally Posted by OciXCrom (Post 2653020)
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.

<VeCo> 05-25-2019 07:14

Re: Vip Model player
 
It's fine, his server won't have 20 VIPs playing at the same time. (?)

jievylook 05-25-2019 11:46

Re: Vip Model player
 
Quote:

Originally Posted by OciXCrom (Post 2653020)
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?

edon1337 05-25-2019 11:47

Re: Vip Model player
 
Quote:

Originally Posted by <VeCo> (Post 2653038)
It's fine, his server won't have 20 VIPs playing at the same time. (?)

How would you know? Free VIP time?

jievylook 05-26-2019 12:28

Re: Vip Model player
 
Quote:

Originally Posted by OciXCrom (Post 2653020)
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?

redivcram 05-26-2019 13:09

Re: Vip Model player
 
Quote:

Originally Posted by jievylook (Post 2653159)
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" 


<VeCo> 05-26-2019 14:12

Re: Vip Model player
 
Quote:

Originally Posted by jievylook (Post 2653159)
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.


All times are GMT -4. The time now is 02:27.

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