Chciałbym abyście sprawdzili kod i jego poprawność, który jako tako skleiłem. Dawno temu nie bawiłem się z robieniem klas więc zapomniałem to i owo.
Spoiler
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <codmod> #include <fakemeta> #include <hamsandwich> #include <fun> #include <engine> #define TASK_WYSZKOLENIE_SANITARNE 736 #define DMG_HE (1<<24) new const nazwa[] = "[Master] Admiral+"; new const opis[] = "Ma Famasa, Deagle i wszystkie granaty, 20 hp oraz za kazde zabojstwo pelen magazynek i dodatkowe 10 expa. 1/2 z HE i podwojny skok. Dodatkowe obrazenia z Famasa. Leczy sie o 10HP co 10 sekund."; new const bronie = 1<<CSW_FAMAS | 1<<CSW_DEAGLE | 1<<CSW_HEGRENADE | 1<<CSW_FLASHBANG | 1<<CSW_FLASHBANG | 1<<CSW_SMOKEGRENADE; new const zdrowie = 20; new const kondycja = 10; new const inteligencja = 0; new const wytrzymalosc = 0; new bool:ma_klase[33]; new bool:moze_skoczyc[33]; new const maxClip[31] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }; public plugin_init() { register_plugin(nazwa, "1.0", "QTM_Peyote"); cod_register_advance(cod_get_classid("[Elite] Admiral+"), 120, nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc,"Premium"); register_forward(FM_CmdStart, "CmdStart"); register_event("DeathMsg", "DeathMsg", "ade"); RegisterHam(Ham_TakeDamage, "player", "TakeDamage"); } public cod_class_enabled(id) { if(!(get_user_flags(id) & ADMIN_LEVEL_F)) { client_print(id, print_chat, "[Admiral+] Nie masz uprawnien, aby uzywac tej klasy.") return COD_STOP; } ma_klase[id] = true; set_task(10.0, "WyszkolenieSanitarne", id+TASK_WYSZKOLENIE_SANITARNE); return COD_CONTINUE; } public cod_class_disabled(id) ma_klase[id] = false; public CmdStart(id, uc_handle) { if(!ma_klase[id]) return FMRES_IGNORED; new button = get_uc(uc_handle, UC_Buttons); new oldbutton = pev(id, pev_oldbuttons); new flags = pev(id, pev_flags); if((button & IN_JUMP) && !(flags & FL_ONGROUND) && !(oldbutton & IN_JUMP) && moze_skoczyc[id]) { moze_skoczyc[id] = false; 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) moze_skoczyc[id] = true; return FMRES_IGNORED; } public DeathMsg() { new killer = read_data(1); new victim = read_data(2); if(!is_user_connected(killer) || !is_user_connected(victim)) return PLUGIN_CONTINUE; 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); new weapon = get_user_weapon(killer); if(maxClip[weapon] != -1) set_user_clip(killer, maxClip[weapon]); if(get_user_team(victim) != get_user_team(killer)) cod_set_user_xp(killer, cod_get_user_xp(killer)+10); } return PLUGIN_CONTINUE; } 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_HE && !random(2)) cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits); return HAM_IGNORED; if(!(damagebits & (1<<1))) return HAM_IGNORED; if(get_user_weapon(idattacker) != CSW_FAMAS) return HAM_IGNORED; cod_inflict_damage(idattacker, this, damage*0.2, 0.0, idinflictor, damagebits); return HAM_IGNORED; } public WyszkolenieSanitarne(id) { id -= TASK_WYSZKOLENIE_SANITARNE; if(!is_user_connected(id)) return PLUGIN_CONTINUE; if(ma_klase[id]) { set_task(10.0, "WyszkolenieSanitarne", id+TASK_WYSZKOLENIE_SANITARNE); if(is_user_alive(id)) { new cur_health = get_user_health(id); new max_health = 100+cod_get_user_health(id); new new_health = cur_health+10<max_health? cur_health+10: max_health; set_user_health(id, new_health); } } return PLUGIN_CONTINUE; } stock set_user_clip(id, ammo) { new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _); get_weaponname(weapon, weaponname, 31); while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0) if (pev(weaponid, pev_owner) == id) { set_pdata_int(weaponid, 51, ammo, 4); return weaponid; } return 0; }
Z góry dziękuję za pomoc. Dodam że w linii
if(!(damagebits & (1<<1)))mam warning przy kompilacji.