Dodałem i są errory.
tu cały kod klasy.
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#define DMG_BULLET (1<<1)
#define SZYBKOSC_GRACZA(%1) (250.0+cod_get_user_trim(%1, 1, 1, 1)*1.3)
new pSpeeds
new const nazwa[] = "Soldat";
new const opis[] = "Dostaje Golden M4A1, Golden Deagle + wieksze obrazenia oraz Golden Knife i 1/1 z niego, po wybraniu noza jest szybszy !";
new const bronie = (1<<CSW_M4A1)|(1<<CSW_DEAGLE);
new const zdrowie = 25;
new const kondycja = 5;
new const inteligencja = 0;
new const wytrzymalosc = 10;
new bool:ma_klase[33];
public plugin_init()
{
register_plugin(nazwa, "1.0", "amxx.pl");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
pSpeeds = register_cvar("wieksza_szybkosc","150.0")
register_event("CurWeapon", "CurWeapon", "be", "1=1")
register_forward(FM_SetModel, "fw_SetModel");
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
}
public cod_class_enabled(id)
{
ma_klase[id] = true;
if(!(get_user_flags(id) & ADMIN_LEVEL_D))
{
client_print(id, print_chat, "[Soldat] Nie masz uprawnien, aby uzywac tej klasy.")
return COD_STOP;
}
return COD_CONTINUE;
}
public cod_class_disabled(id)
{
ma_klase[id] = false;
engfunc(EngFunc_SetClientMaxspeed, id, SZYBKOSC_GRACZA(id));
}
public plugin_precache()
{
precache_model("models/soldat/p_m4a1.mdl");
precache_model("models/soldat/v_m4a1.mdl");
precache_model("models/soldat/p_deagle.mdl");
precache_model("models/soldat/v_deagle.mdl");
precache_model("models/soldat/p_knife.mdl");
precache_model("models/soldat/v_knife.mdl");
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(get_user_weapon(idattacker) == CSW_M4A1 || get_user_weapon(idattacker) == CSW_DEAGLE && damagebits & DMG_BULLET)
cod_inflict_damage(idattacker, this, 15.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public eventKnife_Speed(id)
{
if(!ma_klase[id])
return;
if( read_data(2) == CSW_KNIFE )
{
engfunc(EngFunc_SetClientMaxspeed, id, SZYBKOSC_GRACZA(id)+get_pcvar_float(pSpeeds));
}
else
{
engfunc(EngFunc_SetClientMaxspeed, id, SZYBKOSC_GRACZA(id));
}
}
public CurWeapon(id)
{
new weapon = read_data(2);
if(ma_klase[id])
{
if(weapon == CSW_M4A1)
{
set_pev(id, pev_viewmodel2, "models/soldat/v_m4a1.mdl")
set_pev(id, pev_weaponmodel2, "models/soldat/p_m4a1.mdl")
}
else if(weapon == CSW_DEAGLE)
{
set_pev(id, pev_viewmodel2, "models/soldat/v_deagle.mdl")
set_pev(id, pev_weaponmodel2, "models/cod/p_m3.mdl")
}
else if(weapon == CSW_KNIFE)
{
set_pev(id, pev_viewmodel2, "models/soldat/v_knife.mdl")
set_pev(id, pev_weaponmodel2, "models/soldat/p_knife.mdl")
}
}
}
public fw_SetModel(entity, model[])
{
if(!pev_valid(entity))
return FMRES_IGNORED
new entityowner = pev(entity, pev_owner);
if(!ma_klase[entityowner])
return FMRES_IGNORED;
else if(equali(model, "models/w_m4a1.mdl"))
{
engfunc(EngFunc_SetModel, entity, "models/soldat/v_m4a1.mdl")
engfunc(EngFunc_SetModel, entity, "models/soldat/p_m4a1.mdl")
else if(equali(model, "models/w_deagle.mdl"))
{
engfunc(EngFunc_SetModel, entity, "models/soldat/v_deagle.mdl")
engfunc(EngFunc_SetModel, entity, "models/soldat/p_deagle.mdl")
else if(equali(model, "models/w_knife.mdl"))
{
engfunc(EngFunc_SetModel, entity, "models/soldat/v_knife.mdl")
engfunc(EngFunc_SetModel, entity, "models/soldat/p_knife.mdl")
}