Modyfikacja klasy
afrin.afrin
05.12.2013
Witam zrobiłem sobie klase generatorem ,jest jeden problem nie ma tam kamizelki np na 200 ani bezliku ammo prosba jest taka zeby pokazac co trza napisac i gdzie włozyć.
I jak zrobie druga klase gdzie mam włozyc niekonczace sie magazynki tak zeby nie bylo bezliku bo to bedzie klasa z krowa.
Prośba o wytłumacznie żebym wiecej o to pytac nie musiał.
Dziękuje.
#include <amxmodx> #include <amxmisc> #include <codmod> #include <fakemeta> #include <hamsandwich> #include <cstrike> #include <fun> new const nazwa[] = "Morderca (Premium)"; new const opis[] = "Klasa Premium"; new const bronie = (1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_M4A1)|(1<<CSW_FLASHBANG)|(1<<CSW_DEAGLE)|(1<<CSW_AK47); new const zdrowie = 300; new const kondycja = 100; new const inteligencja = 100; new const wytrzymalosc = 200; new skoki[33]; new 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"); RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage_JedenCios"); } public cod_class_enabled(id) { if(!(get_user_flags(id) & ADMIN_LEVEL_H)) { client_print(id, print_chat, "[Morderca (Premium)] Nie masz uprawnien, aby uzywac tej klasy.") return COD_STOP; } give_item(id, "weapon_hegrenade"); give_item(id, "weapon_flashbang"); give_item(id, "weapon_flashbang"); give_item(id, "weapon_smokegrenade"); cs_set_user_nvg(id, 1); cs_set_user_defuse(id, 1); ma_klase[id] = true; return COD_CONTINUE; } public cod_class_disabled(id) { ma_klase[id] = false; } 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] = 3; return FMRES_IGNORED; } public fwTakeDamage_JedenCios(id, ent, attacker) { if(is_user_alive(attacker) && ma_klase[attacker] && get_user_weapon(attacker) == CSW_KNIFE) { cs_set_user_armor(id, 0, CS_ARMOR_NONE); SetHamParamFloat(4, float(get_user_health(id) + 1)); return HAM_HANDLED; } return HAM_IGNORED; }
Edited by afrin.afrin, 05.12.2013 11:41.
RasiaQ
05.12.2013
O ile dobrze zrozumiałem chodzi Ci o Zwinne Palce w klasie ?
To tak:
1.Wszystkie #include niezbędne posiadasz, więc tu nic nie trzeba zmieniać.
2.Pod:
new ma_klase[33];
dodaj to:
new const max_clip[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 };
3.W plugin_init() dodaj to:
register_forward(FM_CmdStart, "CmdStart");
i na samym końcu klasy dodaj to:
public CmdStart(id, uc_handle) { if(!is_user_alive(id) || !ma_klase[id]) return FMRES_IGNORED; new buttons = get_uc(uc_handle, UC_Buttons); new oldbuttons = pev(id, pev_oldbuttons); new clip, ammo, weapon = get_user_weapon(id, clip, ammo); if(max_clip[weapon] == -1 || !ammo) return FMRES_IGNORED; if((buttons & IN_RELOAD && !(oldbuttons & IN_RELOAD) && !(buttons & IN_ATTACK)) || !clip) { cs_set_user_bpammo(id, weapon, ammo-(max_clip[weapon]-clip)); new new_ammo = (max_clip[weapon] > ammo)? clip+ammo: max_clip[weapon] set_user_clip(id, new_ammo); } return FMRES_IGNORED; } 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; }
Czyli ostatecznie Twoja klasa powinna wyglądać tak:
Niestety nie znalazłem rozwiązania na tę kamizelkę.
PS. 1/1 z noża polecam dodać ręcznie. Opisane w tym poradniku:
http://amxx.pl/topic...broni-w-klasie/