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 i, j = 0;
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(file, szLine, sizeof(szLine));
if(sscanf(szLine, "\"%s\" \"%s\" \"%s\"", szAdmin, szCTModel, szTRModel) == 3) {
i = get_user_index(szAdmin);
if(i > 0 && i <= 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(id, pev_viewmodel2, g_admin_models[id][0]);
} else {
set_pev(id, pev_viewmodel2, g_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.