+я писал с плагина changel models for amx-x.ru
Он тоже не работает
пароль ввожу, все норм, все модели закачаны. Никаких ошибок, просто модель не меняется
- Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#pragma semicolon 1
#define PLUGIN "ChangeHat"
#define VERSION "1.0"
#define AUTHOR "bodyajoy"
#define CS_TEAM_T 1
#define CS_TEAM_CT 2
new const g_Library[][] = {"", "/addons/amxmodx/configs/hats.ini", "_mdl", "Неверный пароль"};
new g_bwEnt[33];
new g_CachedStringInfoTarget;
new szInfoPlayerModelCt[33], szInfoPlayerModelTt[33],
szAccessUser[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_Spawn, "id", "fwHamPlayerSpawnPost", 1);
g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}
public plugin_precache()
{
new szInfo[256], szInfoPrecache[128],
szInfoUser[32], szInfoUserPassword[32],
szInfoModelCt[64], szInfoModelTt[64],
iNum;
for(new iLine = 0; read_file(g_Library[1], iLine, szInfo, charsmax(szInfo), iNum); iLine++)
{
if(iNum && szInfo[0] != ';')
{
parse(szInfo, szInfoUser, charsmax( szInfoUser ),
szInfoUserPassword, charsmax(szInfoUserPassword),
szInfoModelCt, charsmax(szInfoModelCt),
szInfoModelTt, charsmax(szInfoModelTt)
);
formatex(szInfoPrecache, charsmax(szInfoPrecache), "models/caps/%s.mdl", szInfoModelCt, szInfoModelCt);
precache_model(szInfoPrecache);
formatex(szInfoPrecache, charsmax(szInfoPrecache), "models/caps/%s.mdl", szInfoModelTt, szInfoModelTt);
precache_model(szInfoPrecache);
}
}
}
public client_connect(id)
{
set_task(0.5, "CheckPlayerInfo", id);
szAccessUser[id] = false;
szInfoPlayerModelCt[id] = false;
szInfoPlayerModelTt[id] = false;
}
public client_infochanged(id)
{
set_task(0.5, "CheckPlayerInfo", id);
szAccessUser[id] = false;
szInfoPlayerModelCt[id] = false;
szInfoPlayerModelTt[id] = false;
}
public CheckPlayerInfo(id)
{
new szInfo[256], szName[32],
szSteam[32], szIP[32],
szPassword[32], szInfoUser[32],
szInfoUserPassword[32], szInfoModelCt[64],
szInfoModelTt[64], iNum;
if (!is_user_connected(id))
return 0;
get_user_name(id, szName, charsmax(szName));
get_user_authid(id, szSteam, charsmax(szSteam));
get_user_ip(id, szIP, charsmax(szIP), 1);
for(new iLine = 0; read_file(g_Library[1], iLine, szInfo, charsmax(szInfo), iNum); iLine++)
{
if(iNum && szInfo[0] != ';')
{
parse(szInfo, szInfoUser, charsmax( szInfoUser ),
szInfoUserPassword, charsmax(szInfoUserPassword),
szInfoModelCt, charsmax(szInfoModelCt),
szInfoModelTt, charsmax(szInfoModelTt)
);
if (equal(szName, szInfoUser))
{
get_user_info(id, g_Library[2], szPassword, charsmax(szPassword));
if(!equal(szInfoUserPassword, szPassword))
return server_cmd("kick %s ^"%s^"", szName, g_Library[3]);
copy(szInfoPlayerModelCt[id], charsmax(szInfoPlayerModelCt), szInfoModelCt);
copy(szInfoPlayerModelTt[id], charsmax(szInfoPlayerModelTt), szInfoModelTt);
szAccessUser[id] = true;
break;
}
else if (equal(szSteam, szInfoUser))
{
copy(szInfoPlayerModelCt[id], charsmax(szInfoPlayerModelCt), szInfoModelCt);
copy(szInfoPlayerModelTt[id], charsmax(szInfoPlayerModelTt), szInfoModelTt);
szAccessUser[id] = true;
break;
}
else if (equal(szIP, szInfoUser))
{
copy(szInfoPlayerModelCt[id], charsmax(szInfoPlayerModelCt), szInfoModelCt);
copy(szInfoPlayerModelTt[id], charsmax(szInfoPlayerModelTt), szInfoModelTt);
szAccessUser[id] = true;
break;
}
}
}
return 1;
}
public fwHamPlayerSpawnPost( const id ) {
if (szAccessUser[id]) {
new iTeam = get_user_team(id);
new iEnt = g_bwEnt[ id ];
if (!pev_valid(iEnt)) {
switch(iTeam)
{
case CS_TEAM_T: {
g_bwEnt[ id ] = iEnt = engfunc ( EngFunc_CreateNamedEntity, g_CachedStringInfoTarget );
set_pev( iEnt, pev_movetype, MOVETYPE_FOLLOW );
set_pev( iEnt, pev_aiment, id );
engfunc( EngFunc_SetModel, iEnt, szInfoPlayerModelTt[id] );
}
case CS_TEAM_CT: {
g_bwEnt[ id ] = iEnt = engfunc ( EngFunc_CreateNamedEntity, g_CachedStringInfoTarget );
set_pev( iEnt, pev_movetype, MOVETYPE_FOLLOW );
set_pev( iEnt, pev_aiment, id );
engfunc( EngFunc_SetModel, iEnt, szInfoPlayerModelCt[id] );
}
}
}
}
return PLUGIN_CONTINUE;
}