Raised This Month: $ Target: $400
 0% 

Admin Models


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
shayan123
BANNED
Join Date: Oct 2020
Location: GB
Old 01-13-2023 , 12:03   Re: Admin Models
Reply With Quote #7

There are a few different ways you could go about creating a plugin to set admin models in CS 1.6. Here's one simple method you could use:

1: Create a new .cfg file in your amxmodx/configs directory, named "admin_models.cfg"
2: In this file, you will list the steam IDs or names of your admins, along with the model names you want to use for each team. For example:

HTML Code:
"STEAM_0:1:12345678" "models/player/admin_ct/admin_ct.mdl" "models/player/admin_tr/admin_tr.mdl"
"Player1" "models/player/admin_ct/admin_ct.mdl" "models/player/admin_tr/admin_tr.mdl"
3: Create a new .sma file in your amxmodx/scripting directory, and name it something like "admin_models.sma"
4: In this file, you will create a new plugin that reads the "admin_models.cfg" file and sets the appropriate models for each admin when they spawn. Here's an example of what the code could look like:
PHP Code:
#include <amxmodx>

new g_admin_models[32][2];

public 
plugin_init() {
    
register_plugin("Admin Models""1.0""YourName");

    
register_event("Spawn""Event_Spawn""a""1=0""2=0");

    new 
i0;
    new 
szLine[256];
    new 
szAdmin[32];
    new 
szCTModel[64], szTRModel[64];
    new 
file fopen("configs/admin_models.cfg""rt");

    if(
file) {
        while(!
feof(file)) {
            
fgets(fileszLinesizeof(szLine));
            if(
sscanf(szLine"\"%s\" \"%s\" \"%s\""szAdminszCTModelszTRModel) == 3) {
                
get_user_index(szAdmin);
                if(
&& <= 32) {
                    
copy(g_admin_models[i][0], sizeof(g_admin_models[i][0]), szCTModel);
                    
copy(g_admin_models[i][1], sizeof(g_admin_models[i][1]), szTRModel);
                }
            }
        }
        
fclose(file);
    }
}

public 
Event_Spawn(id) {
    if(
g_admin_models[id][0]) {
        if(
get_user_team(id) == 1) {
            
set_pev(idpev_viewmodel2g_admin_models[id][0]);
        } else {
            
set_pev(idpev_viewmodel2g_admin_models[id][1]);
        }
    }

5: Compile your plugin using amxxpc or amxxcompiler, and add it to your plugins.ini file.
6: Restart your server and test it out. Any admins listed in your "admin_models.cfg" file should now have the specified models when they spawn.
shayan123 is offline
Send a message via ICQ to shayan123 Send a message via AIM to shayan123 Send a message via Yahoo to shayan123 Send a message via Skype™ to shayan123
 



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


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