AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [Help] Remove Models viewer (https://forums.alliedmods.net/showthread.php?t=310658)

iceeedr 09-13-2018 21:12

[Help] Remove Models viewer
 
Hello .. Good evening. How can I remove the skins only from the "view" of those who disabled them, eg:
An admin entered the server and received his custom skin, but a player does not like this type of customization, and uses a command, which is for example "/ models", at this time the adm that previously had a custom skin has again the default CS skin (but only for this player that disabled them) for everyone else the model should continue ...

This is the plugin I'm currently using.

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

enum _:ModelsInfo
{
    
Flag,
    
CTModel[32],
    
TModel[32]
}

new 
bool:bMatch[33]

new const 
g_eModels[][ModelsInfo] =
{
       { 
ADMIN_IMMUNITY"owner_ct""owner_t" }
       { 
ADMIN_LEVEL_B"admin_ct""admin_t" }
}

new 
bool:g_bHasCustomSkin[33]

public 
plugin_init()
{
    
register_plugin("Multiple Player Models""1.0""OciXCrom")
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)
    
register_clcmd("say /models""ResetModels")
}

public 
plugin_precache()
{
    for(new 
isizeof(g_eModels); i++)
    {
        
precache_player_model(g_eModels[i][CTModel])
        
precache_player_model(g_eModels[i][TModel])
    }
}

public 
client_putinserver(id)
    
g_bHasCustomSkin[id] = false

public OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {    
        for(new 
iFlags get_user_flags(id), isizeof(g_eModels); i++)
        {
            if(
iFlags g_eModels[i][Flag])
            {
                switch(
cs_get_user_team(id))
                {
                    case 
CS_TEAM_CTset_model(idg_eModels[i][CTModel])
                    case 
CS_TEAM_Tset_model(idg_eModels[i][TModel])
                }
                
                
bMatch[id] = true
                
break
            }
        }
        
        if(!
bMatch[id] && 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



E1_531G 09-14-2018 05:50

Re: [Help] Remove Models viewer
 
Idk if it is possible, but i know that the client can use "cl_minmodels 1" to see only default models.

CrazY. 09-14-2018 07:44

Re: [Help] Remove Models viewer
 
FM_AddToFullPack

iceeedr 09-14-2018 08:46

Re: [Help] Remove Models viewer
 
Quote:

Originally Posted by CrazY. (Post 2615168)
FM_AddToFullPack

I thought about this possibility, but I'm afraid the unnecessary CPU usage just for that ...

Natsheh 09-14-2018 09:41

Re: [Help] Remove Models viewer
 
Quote:

Originally Posted by iceeedr (Post 2615182)
I thought about this possibility, but I'm afraid the unnecessary CPU usage just for that ...

It wont be harmful if the code was optimized.

HamletEagle 09-14-2018 12:59

Re: [Help] Remove Models viewer
 
Quote:

Originally Posted by iceeedr (Post 2615182)
I thought about this possibility, but I'm afraid the unnecessary CPU usage just for that ...

Nothing will explode, chill.

CrazY. 09-14-2018 16:26

Re: [Help] Remove Models viewer
 
First test, then make your observations about cpu usage. There is no other way to do this.

iceeedr 09-14-2018 16:38

Re: [Help] Remove Models viewer
 
Quote:

Originally Posted by CrazY. (Post 2615250)
First test, then make your observations about cpu usage. There is no other way to do this.

Thanks for the weights, I think I'm going through the "cl_minmodels" path, so I would not use any more resources, later if need be, I'll test them with fm_addtofullpack, thanks to everyone who helped.


All times are GMT -4. The time now is 04:36.

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