Descarcare:
Code: Select all
ators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com
Forum rules
3 posts • Page 1 of 1
User avatar
mario .x
Membru, skill 0
Membru, skill 0
28 May 2025, 22:13
Descriere: Permite detinatorilor sa schimbe modele(skin-uri) jucatorilor in functie de SteamID sau numele jucatorului. Acesta incarca modelele dintr-un fiser text (skins.ini) si aplica automat skin-urile in functie de echipa.
Descarcare:
Code: Select all
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new const PLUGIN[] = "Skin Manager", VERSION[] = "1.0", AUTHOR[] = "mario1x"
new const CONFIG_FILE[] = "addons/amxmodx/configs/skins.ini"
new Array:g_steamIds, Array:g_names, Array:g_tModels, Array:g_ctModels
new g_modelCount
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_steamIds = ArrayCreate(32)
g_names = ArrayCreate(32)
g_tModels = ArrayCreate(64)
g_ctModels = ArrayCreate(64)
g_modelCount = 0
if (!file_exists(CONFIG_FILE))
{
create_default_config()
}
loadConfig()
register_event("TeamInfo", "on_team_change", "a")
register_event("ResetHUD", "on_team_change", "b")
}
create_default_config()
{
new configDir[128]
get_configsdir(configDir, charsmax(configDir))
server_print("[Skin Manager] Creating default config file: %s/%s", configDir, CONFIG_FILE)
new file = fopen(CONFIG_FILE, "wt")
if (!file)
{
server_print("[Skin Manager] Could not create config file: %s", CONFIG_FILE)
return
}
fputs(file, "; Player Models Configuration File^n")
fputs(file, "; Syntax:^n^n")
fputs(file, "; STEAM_ID model_t.mdl model_ct.mdl^n^n")
fputs(file, "; PlayerName model_t.mdl model_ct.mdl^n^n")
fputs(file, "; [steamid]^n")
fputs(file, "; STEAM_0:0:1234567 models/player/model_t/model_t.mdl models/player/model_ct/model_ct.mdl^n^n")
fputs(file, "; [name]^n")
fputs(file, "; nume models/player/model_t/model_t.mdl models/player/model_ct/model_ct.mdl^n")
fclose(file)
}
public plugin_precache()
{
new tModel[64], ctModel[64]
for (new i = 0; i < g_modelCount; i++)
{
ArrayGetString(g_tModels, i, tModel, charsmax(tModel))
if (tModel[0] && !file_exists(tModel))
{
server_print("[Skin Manager] Model file not found: %s", tModel)
}
else if (tModel[0])
{
precache_model(tModel)
}
ArrayGetString(g_ctModels, i, ctModel, charsmax(ctModel))
if (ctModel[0] && !file_exists(ctModel))
{
server_print("[Skin Manager] Model file not found: %s", ctModel)
}
else if (ctModel[0])
{
precache_model(ctModel)
}
}
}
loadConfig()
{
if (!file_exists(CONFIG_FILE))
{
new configDir[128]
get_configsdir(configDir, charsmax(configDir))
server_print("[Skin Manager] Config file not found: %s/%s", configDir, CONFIG_FILE)
return
}
new file = fopen(CONFIG_FILE, "rt")
if (!file)
{
server_print("[Skin Manager] Could not open config file: %s", CONFIG_FILE)
return
}
new line[256], steamId[32], name[32], tModel[64], ctModel[64]
new section[16], currentSection = 0
while (!feof(file))
{
fgets(file, line, charsmax(line))
trim(line)
if (!line[0] || line[0] == ';' || line[0] == '#')
continue
if (line[0] == '[')
{
copy(section, charsmax(section), line[1])
section[strlen(section)-1] = 0
strtolower(section)
if (equal(section, "steamid"))
{
currentSection = 1
}
else if (equal(section, "name"))
{
currentSection = 2
}
else
{
currentSection = 0
}
continue
}
switch (currentSection)
{
case 1:
{
if (parse(line, steamId, charsmax(steamId), tModel, charsmax(tModel), ctModel, charsmax(ctModel)) >= 3)
{
replace_all(steamId, charsmax(steamId), "^"", "")
ArrayPushString(g_steamIds, steamId)
ArrayPushString(g_names, "")
ArrayPushString(g_tModels, tModel)
ArrayPushString(g_ctModels, ctModel)
g_modelCount++
}
}
case 2:
{
if (parse(line, name, charsmax(name), tModel, charsmax(tModel), ctModel, charsmax(ctModel)) >= 3)
{
replace_all(name, charsmax(name), "^"", "")
ArrayPushString(g_steamIds, "")
ArrayPushString(g_names, name)
ArrayPushString(g_tModels, tModel)
ArrayPushString(g_ctModels, ctModel)
g_modelCount++
}
}
}
}
fclose(file)
server_print("[Skin Manager] Loaded %d player models from config", g_modelCount)
}
public on_team_change()
{
new id = read_data(1)
if (!is_user_connected(id))
return
set_task(0.1, "apply_player_model", id)
}
public apply_player_model(id)
{
if (!is_user_connected(id))
return;
new steamId[32], name[32], currentModel[64], modelName[64]
get_user_authid(id, steamId, charsmax(steamId))
get_user_name(id, name, charsmax(name))
for (new i = 0; i < g_modelCount; i++)
{
new configSteamId[32], configName[32]
ArrayGetString(g_steamIds, i, configSteamId, charsmax(configSteamId))
ArrayGetString(g_names, i, configName, charsmax(configName))
if ((configSteamId[0] && equal(steamId, configSteamId)) || (configName[0] && equal(name, configName)))
{
new CsTeams:team = cs_get_user_team(id)
if (team == CS_TEAM_T)
{
ArrayGetString(g_tModels, i, currentModel, charsmax(currentModel))
format(modelName, charsmax(modelName), "Terrorist Skin Manager Model (%s)", currentModel)
}
else if (team == CS_TEAM_CT)
{
ArrayGetString(g_ctModels, i, currentModel, charsmax(currentModel))
format(modelName, charsmax(modelName), "Counter-Terorrists Skin Manager Model (%s)", currentModel)
}
else
{
return
}
if (currentModel[0])
{
cs_set_user_model(id, currentModel)
//client_print(id, print_chat, "[Skin Manager] Your skin has been changed to: %s", modelName)
//server_print("[Skin Manager] Changed model for %s (SteamID: %s) to %s", name, steamId, currentModel)
return
}
}
}
}
Versiune: 1.0
Link oficial: acesta
Autor: mario1x
Instalare:
1. Fisierul skin_manager.sma il puneti in addons/amxmodx/scripting .
2. Fisierul skin_manager.amxx il puneti in addons/amxmodx/plugins .
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma : skin_manager.amxx .
4. In fisierul addons/amxmodx/configs/skins.ini gasiti sintaxa de utilizare, acest fisier se creeaza automat.
5. Alti pasi necesari: -
Comenzi publice (se tasteaza in joc prin apasarea tastei Y):-