Problem tkwi w tym ze kiedy oba smigaja (daja modele te co chce) to i worki (oryginalny plugin) i deski (przerobka moja) daja sie rozwalic, a ja chce zorbic tak, ze oryginalu nie przerabiam on sobie tam czerpie te swoje cvary i moge ustawic ile worki maja HP, a w mojej przerobce nie ma byc w ogóle cvarów! Deski maja byc nie śmiertelne i chu*! I proszę poprawić jeśli coś źle zmieniłem, tak aby oba pluginy sie nie "gryzły". Z góry dziękuję i pozdrawiam.
Ps. Oto sma Worków oryginalne:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <xs> #tryinclude <biohazard> #if !defined _biohazard_included #assert Biohazard functions file required! #endif new const g_model[] = "models/pallet_with_bags.mdl" new Float:g_size_mins[] = {-20.0, -22.0, -22.5 } new Float:g_size_maxs[] = { 16.0, 22.0, 29.0 } new g_bagsmenu public plugin_init() { register_plugin("boost bags", "0.3", "cheap_suit") is_biomod_active() ? plugin_init2() : pause("ad") } public plugin_init2() { register_clcmd("boostbags", "cmd_boostbags", ADMIN_CFG, "Boost bag menu") register_srvcmd("make_bags", "cmd_make_bags", _, "") register_event("HLTV", "event_newround", "a", "1=0", "2=0") register_forward(FM_Think, "fwd_think") } public plugin_precache() precache_model(g_model) public plugin_cfg() { g_bagsmenu = menu_create("Boost Bags", "menu_boostbags", 0) menu_additem(g_bagsmenu, "Create (current location)", "1", 0, -1) menu_additem(g_bagsmenu, "Delete (deletes all bags ingame)", "2", 0, -1) menu_additem(g_bagsmenu, "Save (use wisely)", "3", 0, -1) new file[64]; get_configsdir(file, 63) format(file, 63, "%s/boostbags.cfg", file) if(file_exists(file)) server_cmd("exec %s", file), server_exec() } public fwd_think(ent) { if(!pev_valid(ent)) return FMRES_IGNORED static classname[11]; pev(ent, pev_classname, classname, 10) if(!equal(classname, "func_bags") || pev(ent, pev_effects) & EF_NODRAW) return FMRES_IGNORED static Float:health; pev(ent, pev_health, health) if(health <= 500.0) { set_pev(ent, pev_takedamage, DAMAGE_NO) set_pev(ent, pev_effects, EF_NODRAW) set_pev(ent, pev_solid, SOLID_NOT) } else set_pev(ent, pev_nextthink, get_gametime() + 0.1) return FMRES_HANDLED } public cmd_make_bags() { if(read_argc() != 5) return PLUGIN_HANDLED static mapname[2][32] read_argv(1, mapname[0], 31) get_mapname(mapname[1], 31) if(equal(mapname[0], mapname[1])) { static temp[32], Float:origin[3] read_argv(2, temp, 31), origin[0] = str_to_float(temp) read_argv(3, temp, 31), origin[1] = str_to_float(temp) read_argv(4, temp, 31), origin[2] = str_to_float(temp) create_bag(origin, SOLID_BBOX) } return PLUGIN_HANDLED } public event_newround() { static Float:origin[3], ent; ent = -1 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_bags"))) { if(pev(ent, pev_solid) != SOLID_NOT) continue pev(ent, pev_origin, origin) engfunc(EngFunc_RemoveEntity, ent) create_bag(origin, SOLID_BBOX) } } public cmd_boostbags(id, level, cid) { if(cmd_access(id, level, cid, 1)) menu_display(id, g_bagsmenu) return PLUGIN_HANDLED_MAIN } public menu_boostbags(id, menu, item) { if(item < 0) return PLUGIN_CONTINUE static cmd[2], name[64], access, callback, key menu_item_getinfo(menu, item, access, cmd, 1, name, 63, callback) key = str_to_num(cmd) switch(key) { case 1: { static ent; ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall")) if(ent) { static Float:origin[3]; pev(id, pev_origin, origin), create_bag(origin, SOLID_NOT) client_print(id, print_chat, "* Created a boost bag rack. Will be activated on newround.") } menu_display(id, g_bagsmenu) } case 2: { static ent, count; ent = -1, count = 0 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_bags"))) engfunc(EngFunc_RemoveEntity, ent), count++ client_print(id, print_chat, "* Deleted %d bag rack(s).", count), menu_display(id, g_bagsmenu) } case 3: { static map[32]; get_mapname(map, 31) static file[64]; get_configsdir(file, 63) format(file, 63, "%s/boostbags.cfg", file) if(!file_exists(file)) write_file(file, "// Boost Bags Origins") static text[256], Float:origin[3], ent, count; ent = -1, count = 0 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_bags"))) { pev(ent, pev_origin, origin) formatex(text, 255, "make_bags %s %f %f %f", map, origin[0], origin[1], origin[2]) write_file(file, text), count++ } client_print(id, print_chat, "* Saved %d bag origins for %s.", count, map) } } return PLUGIN_HANDLED } public create_bag(Float:origin[3], solid) { static ent; ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall")) if(ent) { engfunc(EngFunc_SetOrigin, ent, origin) engfunc(EngFunc_SetModel, ent, g_model) engfunc(EngFunc_SetSize, ent, g_size_mins, g_size_maxs) set_pev(ent, pev_classname, "func_bags") set_pev(ent, pev_solid, solid) set_pev(ent, pev_movetype, MOVETYPE_TOSS) set_pev(ent, pev_takedamage, DAMAGE_AIM) set_pev(ent, pev_health, 1000.0) set_pev(ent, pev_nextthink, get_gametime() + 0.1) return 1 } return 0 }
Tutaj moja przeróbka:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <xs> #tryinclude <biohazard> #if !defined _biohazard_included #assert Biohazard functions file required! #endif new const g_model[] = "models/dechy_1_lajty.mdl" new Float:g_size_mins[] = {-20.0, -22.0, -22.5 } new Float:g_size_maxs[] = { 16.0, 22.0, 29.0 } new g_dechymenu public plugin_init() { register_plugin("dechy", "0.3", "cheap_suit") is_biomod_active() ? plugin_init2() : pause("ad") } public plugin_init2() { register_clcmd("dechy", "cmd_dechy", ADMIN_CFG, "Menu DeseK") register_srvcmd("make_dechy", "cmd_make_dechy", _, "") register_event("HLTV", "event_newround", "a", "1=0", "2=0") register_forward(FM_Think, "fwd_think") } public plugin_precache() precache_model(g_model) public plugin_cfg() { g_dechymenu = menu_create("dechy", "menu_dechy", 0) menu_additem(g_dechymenu, "Postaw (current location)", "1", 0, -1) menu_additem(g_dechymenu, "Skasuj (deletes all dechys ingame)", "2", 0, -1) menu_additem(g_dechymenu, "Zapisz (use wisely)", "3", 0, -1) new file[64]; get_configsdir(file, 63) format(file, 63, "%s/dechy.cfg", file) if(file_exists(file)) server_cmd("exec %s", file), server_exec() } public fwd_think(ent) { if(!pev_valid(ent)) return FMRES_IGNORED static classname[11]; pev(ent, pev_classname, classname, 10) if(!equal(classname, "func_dechy") || pev(ent, pev_effects) & EF_NODRAW) return FMRES_IGNORED static Float:health; pev(ent, pev_health, health) if(health <= 500.0) { set_pev(ent, pev_takedamage, DAMAGE_NO) set_pev(ent, pev_effects, EF_NODRAW) set_pev(ent, pev_solid, SOLID_NOT) } else set_pev(ent, pev_nextthink, get_gametime() + 0.1) return FMRES_HANDLED } public cmd_make_dechy() { if(read_argc() != 5) return PLUGIN_HANDLED static mapname[2][32] read_argv(1, mapname[0], 31) get_mapname(mapname[1], 31) if(equal(mapname[0], mapname[1])) { static temp[32], Float:origin[3] read_argv(2, temp, 31), origin[0] = str_to_float(temp) read_argv(3, temp, 31), origin[1] = str_to_float(temp) read_argv(4, temp, 31), origin[2] = str_to_float(temp) create_dechy(origin, SOLID_BBOX) } return PLUGIN_HANDLED } public event_newround() { static Float:origin[3], ent; ent = -1 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_dechy"))) { if(pev(ent, pev_solid) != SOLID_NOT) continue pev(ent, pev_origin, origin) engfunc(EngFunc_RemoveEntity, ent) create_dechy(origin, SOLID_BBOX) } } public cmd_dechy(id, level, cid) { if(cmd_access(id, level, cid, 1)) menu_display(id, g_dechymenu) return PLUGIN_HANDLED_MAIN } public menu_dechy(id, menu, item) { if(item < 0) return PLUGIN_CONTINUE static cmd[2], name[64], access, callback, key menu_item_getinfo(menu, item, access, cmd, 1, name, 63, callback) key = str_to_num(cmd) switch(key) { case 1: { static ent; ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall")) if(ent) { static Float:origin[3]; pev(id, pev_origin, origin), create_dechy(origin, SOLID_NOT) client_print(id, print_chat, "* Created a boost dechy rack. Will be activated on newround.") } menu_display(id, g_dechymenu) } case 2: { static ent, count; ent = -1, count = 0 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_dechy"))) engfunc(EngFunc_RemoveEntity, ent), count++ client_print(id, print_chat, "* Deleted %d dechy rack(s).", count), menu_display(id, g_dechymenu) } case 3: { static map[32]; get_mapname(map, 31) static file[64]; get_configsdir(file, 63) format(file, 63, "%s/dechy.cfg", file) if(!file_exists(file)) write_file(file, "// Boost dechys Origins") static text[256], Float:origin[3], ent, count; ent = -1, count = 0 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_dechy"))) { pev(ent, pev_origin, origin) formatex(text, 255, "make_dechy %s %f %f %f", map, origin[0], origin[1], origin[2]) write_file(file, text), count++ } client_print(id, print_chat, "* Saved %d dechy origins for %s.", count, map) } } return PLUGIN_HANDLED } public create_dechy(Float:origin[3], solid) { static ent; ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall")) if(ent) { engfunc(EngFunc_SetOrigin, ent, origin) engfunc(EngFunc_SetModel, ent, g_model) engfunc(EngFunc_SetSize, ent, g_size_mins, g_size_maxs) set_pev(ent, pev_classname, "func_dechy") set_pev(ent, pev_solid, solid) set_pev(ent, pev_movetype, MOVETYPE_TOSS) set_pev(ent, pev_takedamage, DAMAGE_AIM) set_pev(ent, pev_health, 1000.0) set_pev(ent, pev_nextthink, get_gametime() + 0.1) return 1 } return 0 }
Na wszelki wypadek mówie, ze tego nie mozna kompilować online, tylko trzeba na lokalu z biohazardem