View Single Post
r0ma
Senior Member
Join Date: Apr 2012
Location: Great Tomb of Nazarick
Old 10-24-2020 , 12:37   Re: [REQ] BASEBUILDER Admin Skins
Reply With Quote #2

PHP Code:
/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "r0ma'"


#define mark_bit(%1,%2)    (%1 |= (1 << (%2 & 31)))
#define clear_bit(%1,%2)    (%1 &= ~ (1 << (%2 & 31)))
#define is_bit(%1,%2)    (%1 & ( 1 << (%2 & 31)))

enum AdminModel {
    
MODEL_NAME[33],
    
MODEL_FLAG
}

new const 
g_AdminModel[][AdminModel] = {
    { 
"admin1"ADMIN_LEVEL_H },
    { 
"admin2"ADMIN_LEVEL_A }
}

new 
g_UserChangeModel;

public 
plugin_precache() {
    new 
szBuffer[64];
    
    for(new 
isizeof g_AdminModeli++) {
        
formatex(szBuffercharsmax(szBuffer), "models/player/%s/%s.mdl"g_AdminModel[i][MODEL_NAME], g_AdminModel[i][MODEL_NAME]);
        
        
precache_model(szBuffer);
    }
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"true);
}

public 
client_putinserver(id) {
    
clear_bit(g_UserChangeModelid);
}

public 
fw_PlayerSpawn_Post(id) {
    if(!
is_user_alive(id))
        return;
    
    if(
is_bit(g_UserChangeModelid) && cs_get_user_team(id) != CS_TEAM_CT) {
        
cs_reset_user_model(id);
        
clear_bit(g_UserChangeModelid);
        
        return;
    }
    
    new 
iFlags get_user_flags(id);
    
    for(new 
isizeof g_AdminModeli++) {
        if(
iFlags g_AdminModel[i][MODEL_FLAG]) {
            
cs_set_user_model(idg_AdminModel[i][MODEL_NAME]);
            
mark_bit(g_UserChangeModelid);
            
            break;
        }
    }
    
    

__________________
Discord:FluffyDeveloper#4753
Github: https://github.com/francoromaniello
AMX-ES: https://amxmodx-es.com/r0ma'

Last edited by r0ma; 10-24-2020 at 12:38.
r0ma is offline
Send a message via MSN to r0ma