Cześć wszystkim. Wraz z pomocą poradników postanowiłem napisać klasę. Miała ona mieć:
-odnowienie 20 hp po zabiciu wroga
-10 obrażeń więcej z m4
-podwójny skok
-1/2 HE i tu właśnie jest problem reszta opcji które dodałem działa bez problemu. Lecz 1/2 he nie. Dodałem cały kod dotyczący 1/x zabicia z he. Skompilowałem plik wszystko pięknie 0 błędów. Ale na testach okazało się że 1/2 z kosy nie działa. Próbowałem wiele razy zabić gracza w przeciwnym teamie ani razu nie weszło. Więc jeżeli ktoś ma jakiś pomysł jak to naprawić/przerobić to proszę o odpowiedź.
#include <amxmodx> #include <amxmisc> #include <codmod> #include <fakemeta> #include <hamsandwich> #define DMG_BULLET (1<<1) #define DMG_HEGRENADE (1<<24) new const nazwa[] = "Agent"; new const opis[] = ""; new const bronie = (1<<CSW_HEGRENADE) | (1<<CSW_M4A1) | (1<<CSW_USP); new const zdrowie = 0; new const kondycja = 0; new const inteligencja = 0; new const wytrzymalosc = 0; new skoki[33]; 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); register_forward(FM_CmdStart, "fwCmdStart_MultiJump"); register_event("DeathMsg", "DeathMsg", "ade"); RegisterHam(Ham_TakeDamage, "player", "TakeDamage"); } public cod_class_enabled(id) { if(!(get_user_flags(id) & ADMIN_LEVEL_G)) { client_print(id, print_chat, "[Agent] Nie masz uprawnien, aby uzywac tej klasy.") return COD_STOP; } ma_klase[id] = true; return COD_CONTINUE; } public cod_class_disabled(id) { ma_klase[id] = false; } public DeathMsg() { new killer = read_data(1); new victim = read_data(2); if(!is_user_connected(killer)) return PLUGIN_CONTINUE; if(ma_klase[victim] && !ma_klase[killer]) cod_set_user_xp(killer, cod_get_user_xp(killer)+10); if(ma_klase[killer]) { new cur_health = pev(killer, pev_health); new Float:max_health = 100.0+cod_get_user_health(killer); new Float:new_health = cur_health+20.0<max_health? cur_health+20.0: max_health; set_pev(killer, pev_health, new_health); } return PLUGIN_CONTINUE; } public fwCmdStart_MultiJump(id, uc_handle) { if(!is_user_alive(id) || !ma_klase[id]) return FMRES_IGNORED; new flags = pev(id, pev_flags); if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id]) { skoki[id]--; new Float:velocity[3]; pev(id, pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id, pev_velocity,velocity); } else if(flags & FL_ONGROUND) skoki[id] = 1; return FMRES_IGNORED; } public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits) { if(!is_user_connected(idattacker)) return HAM_IGNORED; if(!ma_klase[idattacker]) return HAM_IGNORED; if(damagebits & DMG_BULLET) { new weapon = get_user_weapon(idattacker); if(weapon == CSW_HEGRENADE && damage > 20.0 && random_num(1,2) == 1) cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits); } if(get_user_team(this) != get_user_team(idattacker) && get_user_weapon(idattacker) == CSW_M4A1 && damagebits & DMG_BULLET) cod_inflict_damage(idattacker, this, 10.0, 0.0, idinflictor, damagebits); return HAM_IGNORED; }