katoryje
Posted: 2011 Jun 25 16:02
reik man kažko
Code: Select all
#include <amxmodx>#include <hamsandwich>#include <engine>#include <cstrike>#include <fakemeta>#include <amxmisc> #define CELL_RADIUS Float:500.0 new g_Buttons[10], Trie:g_CellManagers public plugin_precache(){ g_CellManagers = TrieCreate()} public plugin_init(){ register_plugin("JailBreak: daysmenu", "0.1", "rez.lt") register_clcmd("say /open", "jail_open"); setup_buttons()} public jail_open(){ static i for(i = 0; i < sizeof(g_Buttons); i++) { if(g_Buttons[i]) { ExecuteHamB(Ham_Use, g_Buttons[i], 0, 0, 1, 1.0) entity_set_float(g_Buttons[i], EV_FL_frame, 0.0) } }} public setup_buttons(){ new ent[3] new Float:origin[3] new info[32] new pos while((pos <= sizeof(g_Buttons)) && (ent[0] = engfunc(EngFunc_FindEntityByString, ent[0], "classname", "info_player_deathmatch"))) { pev(ent[0], pev_origin, origin) while((ent[1] = engfunc(EngFunc_FindEntityInSphere, ent[1], origin, CELL_RADIUS))) { if(!is_valid_ent(ent[1])) continue entity_get_string(ent[1], EV_SZ_classname, info, charsmax(info)) if(!equal(info, "func_door")) continue entity_get_string(ent[1], EV_SZ_targetname, info, charsmax(info)) if(!info[0]) continue if(TrieKeyExists(g_CellManagers, info)) { TrieGetCell(g_CellManagers, info, ent[2]) } else { ent[2] = engfunc(EngFunc_FindEntityByString, 0, "target", info) } if(is_valid_ent(ent[2]) && (in_array(ent[2], g_Buttons, sizeof(g_Buttons)) < 0)) { g_Buttons[pos] = ent[2] pos++ break } } } TrieDestroy(g_CellManagers)} stock in_array(needle, data[], size){ for(new i = 0; i < size; i++) { if(data[i] == needle) return i } return -1}
Code: Select all
public plugin_precache(){ g_CellManagers = TrieCreate()}
Code: Select all
g_CellManagers = TrieCreate()
Gali kur nori.Pukuotukas951 wrote:Įmanoma šitą vietą kodo
šitą:Code: Select all
public plugin_precache(){ g_CellManagers = TrieCreate()}
įkišti kur nors, bet ne į precache? Nes man dėl jo pjaunasi kitas pluginas ir nepajungia map.Code: Select all
g_CellManagers = TrieCreate()
Code: Select all
#define MAX_BUTTONS 32#define CELL_RADIUS 200.0 new Buttons[MAX_BUTTONS];new ButtonCount; public plugin_init() GatherButtons(); GatherButtons(){ new spawn, door, target, Float:origin[3], className[32], i; while (ButtonCount < sizeof Buttons && (spawn = find_ent_by_class(spawn, "info_player_deathmatch"))) { entity_get_vector(spawn, EV_VEC_origin, origin); while ((door = find_ent_in_sphere(door, origin, CELL_RADIUS))) { entity_get_string(door, EV_SZ_classname, className, charsmax(className)); if (!equal(className, "func_door")) continue; entity_get_string(door, EV_SZ_targetname, className, charsmax(className)); if (className[0] == EOS) continue; target = find_ent_by_target(0, className); if (!target) continue; for (i = 0; i < ButtonCount; i++) if (target == Buttons[i]) continue; Buttons[ButtonCount++] = target; break; } door = 0; }} OpenCells(){ for (new i, ent; i < ButtonCount; i++) { ent = Buttons[i]; ExecuteHamB(Ham_Use, ent, 0, 0, 1, 1.0); entity_set_float(ent, EV_FL_frame, 0.0); } CellsOpened = true;}