Rusu Radu Postat Martie 21 Postat Martie 21 MYSTERY BOX DROP Prezentare generală Pluginul introduce un sistem simplu dar extrem de atractiv: atunci când un jucător este eliminat, acesta dropează un Mystery Box. Creează un plus de suspans și recompensă în fiecare rundă — fiecare kill poate aduce un avantaj neașteptat. Link descărcare: MODELE Creator: sNk_DarK Denumire plugin: mysterybox.amxx Comenzi & Cvars Informații: Pluginul funcționează automat Nu necesită comenzi administrative Nu are cvar-uri publice cunoscute Instrucțiuni instalare Plasează fișierul mysterybox.sma în: addons/amxmodx/scripting Compilează sau folosește direct mysterybox.amxx Mută fișierul mysterybox.amxx în: addons/amxmodx/plugins Deschide fișierul: addons/amxmodx/configs/plugins.ini și adaugă: mysterybox.amxx Asigură-te că resursele din arhivă (modele, sunete etc.) sunt plasate corect în folderele serverului Cod sursă CLASSIC Spoiler #include amxmodx #include reapi native entity_set_model(ent, const model[]) #define BOX_MODEL_01 "models/box/mysterybox_T.mdl" #define BOX_MODEL_02 "models/box/mysterybox_CT.mdl" #define BOX_SOUND "box/box_pickup.wav" #define ENTITY_NAME "mystery_box" #define TIME_REMOVE_ENT 10.0 #define MAX_BOXES 16 new g_limit = 0 new bool:g_Damage[33], bool:g_Speed[33], bool:g_Gravity[33], g_Jumps[33], g_JumpsNum[33], MysteryBox_Type, BoxesNum public plugin_init() { register_plugin("[CS] Mystery Box", "2.5", "sNk_DarK") RegisterHookChain(RG_CBasePlayer_Killed, "RG_PlayerDeath") RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "RG_Reset_SpeedGravity") RegisterHookChain(RG_CBasePlayer_Jump, "RG_PlayerJump") RegisterHookChain(RG_CBasePlayer_TakeDamage, "RG_TakeDamage") register_event("HLTV", "RoundStart", "a", "1=0", "2=0") } public plugin_precache() { precache_model(BOX_MODEL_01) precache_model(BOX_MODEL_02) precache_sound(BOX_SOUND) } public RG_PlayerDeath(victim) { if (!is_user_connected(victim)) return g_Damage[victim] = false g_Speed[victim] = false g_Gravity[victim] = false g_JumpsNum[victim] = 0 if (g_limit != 0) if (BoxesNum >= MAX_BOXES) return CreateBox(victim) } CreateBox(victim) { new box = rg_create_entity("info_target") if (is_nullent(box) || !is_user_connected(victim)) return new Float:origin[3] get_entvar(victim, var_origin, origin) set_entvar(box, var_classname, ENTITY_NAME) if (get_user_team(victim) == 2) { entity_set_model(box, BOX_MODEL_01) set_entvar(box, var_rendercolor, Float:{255.0, 99.0, 71.0}) MysteryBox_Type = 1 } else if (get_user_team(victim) == 1) { entity_set_model(box, BOX_MODEL_02) set_entvar(box, var_rendercolor, Float:{135.0, 206.0, 250.0}) MysteryBox_Type = 2 } else { entity_set_model(box, BOX_MODEL_01) MysteryBox_Type = 1 } set_entvar(box, var_origin, origin) set_entvar(box, var_solid, SOLID_TRIGGER) set_entvar(box, var_movetype, MOVETYPE_TOSS) set_entvar(box, var_animtime, get_gametime()) set_entvar(box, var_framerate, 1.0) set_entvar(box, var_nextthink, get_gametime() + TIME_REMOVE_ENT) set_entvar(box, var_rendermode, 0) set_entvar(box, var_renderamt, 120.0) set_entvar(box, var_renderfx, 19) new Float:mins[3] = {-8.0, -8.0, -18.0} new Float:maxs[3] = {8.0, 8.0, 18.0} SetEntSize(box, mins, maxs) if (g_limit != 0) BoxesNum++ new param[1] param[0] = MysteryBox_Type SetTouch(box, "Touch_MysteryBox", param, 1) SetThink(box, "Think_MysteryBox") } public Think_MysteryBox(ent) { if (is_nullent(ent)) return SetThink(ent, "") SetTouch(ent, "") rg_remove_entity(ent) } public Touch_MysteryBox(ent, other, param[1]) { if (is_nullent(ent) || !is_user_alive(other)) return new box = param[0] if ((box == 2 && get_user_team(other) == 1) || (box == 1 && get_user_team(other) == 2)) return new random_item = random_num(0, 5) switch (random_item) { case 0: { set_entvar(other, var_health, floatmin(Float:get_entvar(other, var_health) + 15.0, 100.0)) client_print_color(other, other, "You got^4 ++Health") } case 1: { if (g_Damage[other]) client_print_color(other, other, "Sorry, you already have^3 Double Damage^1, try next box...") else { g_Damage[other] = true client_print_color(other, other, "You got^4 ++Damage") } } case 2: { if (g_JumpsNum[other] == 1) client_print_color(other, other, "Sorry, you already have^3 Double Jump^1, try next box...") else { g_JumpsNum[other]++ client_print_color(other, other, "You got^4 ++Jumps") } } case 3: { if (g_Speed[other]) client_print_color(other, other, "Sorry, you already have^3 Speed^1, try next box...") else { g_Speed[other] = true RG_Reset_SpeedGravity(other) client_print_color(other, other, "You got^4 ++Speed") } } case 4: { if (g_Gravity[other]) client_print_color(other, other, "Sorry, you already have^3 Gravity^1, try next box...") else { g_Gravity[other] = true RG_Reset_SpeedGravity(other) client_print_color(other, other, "You got^4 ++Gravity") } } case 5: client_print_color(other, other, "You got^4 Nothing^1, try next box") } emit_sound(other, CHAN_VOICE, BOX_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) rg_remove_entity(ent) } public RG_TakeDamage(victim, inflictor, attacker, Float:damage, damagetype) { if (!is_user_alive(attacker) || !is_user_alive(victim)) return if (!g_Damage[attacker]) return damage += 10.0 SetHookChainArg(4, ATYPE_FLOAT, damage) } public RG_Reset_SpeedGravity(id) { if (!is_user_alive(id)) return if (g_Speed[id] && Float:get_entvar(id, var_maxspeed) < 280.0) set_entvar(id, var_maxspeed, 280.0) if (g_Gravity[id] && Float:get_entvar(id, var_gravity) > 0.4) set_entvar(id, var_gravity, 0.4) } public RG_PlayerJump(id) { if (!is_user_alive(id)) return // ZP 6.2 Jumps if (g_JumpsNum[id]) { new nbut = get_entvar(id, var_button) new obut = get_entvar(id, var_oldbuttons) if ((nbut & IN_JUMP) && !(get_entvar(id, var_flags) & FL_ONGROUND) && !(obut & IN_JUMP) && g_Jumps[id] <= g_JumpsNum[id] - 1) { static Float:fVelocity[3] get_entvar(id, var_velocity, fVelocity) fVelocity[2] = random_float(265.0, 285.0) set_entvar(id, var_velocity, fVelocity) g_Jumps[id]++ } if ((nbut & IN_JUMP) && (get_entvar(id, var_flags) & FL_ONGROUND)) g_Jumps[id] = 0 } } public RoundStart() { for (new i = 1; i <= 32; i++) { if (is_user_connected(i)) { g_Damage[i] = false g_Speed[i] = false g_Gravity[i] = false g_JumpsNum[i] = 0 } } BoxesNum = 0 new ent = -1 while ((ent = rg_find_ent_by_class(ent, ENTITY_NAME)) != 0) { SetTouch(ent, "") SetThink(ent, "") rg_remove_entity(ent) } } public client_putinserver(id) { g_Damage[id] = false g_Speed[id] = false g_Gravity[id] = false g_JumpsNum[id] = 0 } public client_disconnected(id) { g_Damage[id] = false g_Speed[id] = false g_Gravity[id] = false g_JumpsNum[id] = 0 } SetEntSize(ent, Float:mins[3], Float:maxs[3]) { new Float:size[3] size[0] = maxs[0] - mins[0] size[1] = maxs[1] - mins[1] size[2] = maxs[2] - mins[2] set_entvar(ent, var_size, size) } RESPAWN Spoiler #include amxmodx #include reapi native entity_set_model(ent, const model[]) #define BOX_MODEL_01 "models/box/mysterybox_T.mdl" #define BOX_MODEL_02 "models/box/mysterybox_CT.mdl" #define BOX_SOUND "box/box_pickup.wav" #define ENTITY_NAME "mystery_box" #define TIME_REMOVE_ENT 10.0 #define MAX_BOXES 45 new g_limit = 0 new bool:g_Damage[33], bool:g_Speed[33], bool:g_Gravity[33], g_Jumps[33], g_JumpsNum[33], MysteryBox_Type, BoxesNum public plugin_init() { register_plugin("[RESPAWN] Mystery Box", "2.5", "sNk_DarK") RegisterHookChain(RG_CBasePlayer_Killed, "RG_PlayerDeath") RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "RG_Reset_SpeedGravity") RegisterHookChain(RG_CBasePlayer_Jump, "RG_PlayerJump") RegisterHookChain(RG_CBasePlayer_TakeDamage, "RG_TakeDamage") if (g_limit != 0) set_task(300.0, "Reset_Boxes", .flags="b") register_event("HLTV", "RoundStart", "a", "1=0", "2=0") } public Reset_Boxes() { if (BoxesNum >= MAX_BOXES) BoxesNum = 0 else return } public plugin_precache() { precache_model(BOX_MODEL_01) precache_model(BOX_MODEL_02) precache_sound(BOX_SOUND) } public RG_PlayerDeath(victim) { if (!is_user_connected(victim)) return g_Damage[victim] = false g_Speed[victim] = false g_Gravity[victim] = false g_JumpsNum[victim] = 0 if (g_limit != 0) if (BoxesNum >= MAX_BOXES) return CreateBox(victim) } CreateBox(victim) { new box = rg_create_entity("info_target") if (is_nullent(box) || !is_user_connected(victim)) return new Float:origin[3] get_entvar(victim, var_origin, origin) set_entvar(box, var_classname, ENTITY_NAME) if (get_user_team(victim) == 2) { entity_set_model(box, BOX_MODEL_01) set_entvar(box, var_rendercolor, Float:{255.0, 99.0, 71.0}) MysteryBox_Type = 1 } else if (get_user_team(victim) == 1) { entity_set_model(box, BOX_MODEL_02) set_entvar(box, var_rendercolor, Float:{135.0, 206.0, 250.0}) MysteryBox_Type = 2 } else { entity_set_model(box, BOX_MODEL_01) MysteryBox_Type = 1 } set_entvar(box, var_origin, origin) set_entvar(box, var_solid, SOLID_TRIGGER) set_entvar(box, var_movetype, MOVETYPE_TOSS) set_entvar(box, var_animtime, get_gametime()) set_entvar(box, var_framerate, 1.0) set_entvar(box, var_nextthink, get_gametime() + TIME_REMOVE_ENT) set_entvar(box, var_rendermode, 0) set_entvar(box, var_renderamt, 120.0) set_entvar(box, var_renderfx, 19) new Float:mins[3] = {-8.0, -8.0, -18.0} new Float:maxs[3] = {8.0, 8.0, 18.0} SetEntSize(box, mins, maxs) if (g_limit != 0) BoxesNum++ new param[1] param[0] = MysteryBox_Type SetTouch(box, "Touch_MysteryBox", param, 1) SetThink(box, "Think_MysteryBox") } public Think_MysteryBox(ent) { if (is_nullent(ent)) return SetThink(ent, "") SetTouch(ent, "") rg_remove_entity(ent) } public Touch_MysteryBox(ent, other, param[1]) { if (is_nullent(ent) || !is_user_alive(other)) return new box = param[0] if ((box == 2 && get_user_team(other) == 1) || (box == 1 && get_user_team(other) == 2)) return new random_item = random_num(0, 5) switch (random_item) { case 0: { set_entvar(other, var_health, floatmin(Float:get_entvar(other, var_health) + 15.0, 100.0)) client_print_color(other, other, "You got^4 ++Health") } case 1: { if (g_Damage[other]) client_print_color(other, other, "Sorry, you already have^3 Double Damage^1, try next box...") else { g_Damage[other] = true client_print_color(other, other, "You got^4 ++Damage") } } case 2: { if (g_JumpsNum[other] == 1) client_print_color(other, other, "Sorry, you already have^3 Double Jump^1, try next box...") else { g_JumpsNum[other]++ client_print_color(other, other, "You got^4 ++Jumps") } } case 3: { if (g_Speed[other]) client_print_color(other, other, "Sorry, you already have^3 Speed^1, try next box...") else { g_Speed[other] = true RG_Reset_SpeedGravity(other) client_print_color(other, other, "You got^4 ++Speed") } } case 4: { if (g_Gravity[other]) client_print_color(other, other, "Sorry, you already have^3 Gravity^1, try next box...") else { g_Gravity[other] = true RG_Reset_SpeedGravity(other) client_print_color(other, other, "You got^4 ++Gravity") } } case 5: client_print_color(other, other, "You got^4 Nothing^1, try next box") } emit_sound(other, CHAN_VOICE, BOX_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) rg_remove_entity(ent) } public RG_TakeDamage(victim, inflictor, attacker, Float:damage, damagetype) { if (!is_user_alive(attacker) || !is_user_alive(victim)) return if (!g_Damage[attacker]) return damage += 10.0 SetHookChainArg(4, ATYPE_FLOAT, damage) } public RG_Reset_SpeedGravity(id) { if (!is_user_alive(id)) return if (g_Speed[id] && Float:get_entvar(id, var_maxspeed) < 280.0) set_entvar(id, var_maxspeed, 280.0) if (g_Gravity[id] && Float:get_entvar(id, var_gravity) > 0.4) set_entvar(id, var_gravity, 0.4) } public RG_PlayerJump(id) { if (!is_user_alive(id)) return // ZP 6.2 Jumps if (g_JumpsNum[id]) { new nbut = get_entvar(id, var_button) new obut = get_entvar(id, var_oldbuttons) if ((nbut & IN_JUMP) && !(get_entvar(id, var_flags) & FL_ONGROUND) && !(obut & IN_JUMP) && g_Jumps[id] <= g_JumpsNum[id] - 1) { static Float:fVelocity[3] get_entvar(id, var_velocity, fVelocity) fVelocity[2] = random_float(265.0, 285.0) set_entvar(id, var_velocity, fVelocity) g_Jumps[id]++ } if ((nbut & IN_JUMP) && (get_entvar(id, var_flags) & FL_ONGROUND)) g_Jumps[id] = 0 } } public RoundStart() { for (new i = 1; i <= 32; i++) { if (is_user_connected(i)) { g_Damage[i] = false g_Speed[i] = false g_Gravity[i] = false g_JumpsNum[i] = 0 } } BoxesNum = 0 new ent = -1 while ((ent = rg_find_ent_by_class(ent, ENTITY_NAME)) != 0) { SetTouch(ent, "") SetThink(ent, "") rg_remove_entity(ent) } } public client_putinserver(id) { g_Damage[id] = false g_Speed[id] = false g_Gravity[id] = false g_JumpsNum[id] = 0 } public client_disconnected(id) { g_Damage[id] = false g_Speed[id] = false g_Gravity[id] = false g_JumpsNum[id] = 0 } SetEntSize(ent, Float:mins[3], Float:maxs[3]) { new Float:size[3] size[0] = maxs[0] - mins[0] size[1] = maxs[1] - mins[1] size[2] = maxs[2] - mins[2] set_entvar(ent, var_size, size) } ZOMBIE Spoiler #include amxmodx #include reapi native entity_set_model(ent, const model[]) native zp_get_user_zombie(id) native zp_get_user_ammo_packs(id) native zp_set_user_ammo_packs(id, ammount) native zp_has_round_ended() native zp_has_round_started() #define BOX_MODEL_01 "models/box/mysterybox_T.mdl" #define BOX_MODEL_02 "models/box/mysterybox_CT.mdl" #define BOX_SOUND "box/box_pickup.wav" #define ENTITY_NAME "mystery_box" #define TIME_REMOVE_ENT 10.0 #define MAX_BOXES 16 new g_limit = 0 new bool:g_Speed[33], bool:g_Gravity[33], g_Jumps[33], g_JumpsNum[33], BoxesNum public plugin_init() { register_plugin("[ZP] Mystery Box", "2.5", "sNk_DarK") RegisterHookChain(RG_CBasePlayer_Killed, "RG_PlayerDeath") RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "RG_Reset_SpeedGravity") RegisterHookChain(RG_CBasePlayer_Jump, "RG_PlayerJump") register_event("HLTV", "RoundStart", "a", "1=0", "2=0") } public plugin_precache() { precache_model(BOX_MODEL_01) precache_model(BOX_MODEL_02) precache_sound(BOX_SOUND) } public RG_PlayerDeath(victim) { if (!is_user_connected(victim)) return g_Speed[victim] = false g_Gravity[victim] = false g_JumpsNum[victim] = 0 if (g_limit != 0) if (BoxesNum >= MAX_BOXES) return CreateBox(victim) } CreateBox(victim) { if (!zp_has_round_started() || zp_has_round_ended()) return new box = rg_create_entity("info_target") if (is_nullent(box) || !is_user_connected(victim)) return new Float:origin[3] get_entvar(victim, var_origin, origin) set_entvar(box, var_classname, ENTITY_NAME) if (zp_get_user_zombie(victim)) { entity_set_model(box, BOX_MODEL_02) set_entvar(box, var_rendercolor, Float:{135.0, 206.0, 250.0}) } else { entity_set_model(box, BOX_MODEL_01) set_entvar(box, var_rendercolor, Float:{255.0, 99.0, 71.0}) } set_entvar(box, var_origin, origin) set_entvar(box, var_solid, SOLID_TRIGGER) set_entvar(box, var_movetype, MOVETYPE_TOSS) set_entvar(box, var_animtime, get_gametime()) set_entvar(box, var_framerate, 1.0) set_entvar(box, var_nextthink, get_gametime() + TIME_REMOVE_ENT) set_entvar(box, var_rendermode, 0) set_entvar(box, var_renderamt, 120.0) set_entvar(box, var_renderfx, 19) new Float:mins[3] = {-8.0, -8.0, -18.0} new Float:maxs[3] = {8.0, 8.0, 18.0} SetEntSize(box, mins, maxs) if (g_limit != 0) BoxesNum++ SetTouch(box, "Touch_MysteryBox") SetThink(box, "Think_MysteryBox") } public Think_MysteryBox(ent) { if (is_nullent(ent)) return SetThink(ent, "") SetTouch(ent, "") rg_remove_entity(ent) } public Touch_MysteryBox(ent, other) { if (is_nullent(ent) || !is_user_alive(other)) return new random_item = random_num(0, 5) switch (random_item) { case 0: { if (zp_get_user_zombie(other)) { client_print_color(other, other, "You got^4 ++Health") if (Float:get_entvar(other, var_health) + 450.0 <= 7500.0) set_entvar(other, var_health, Float:get_entvar(other, var_health) + 450.0) } else { client_print_color(other, other, "You got^4 ++Armor") if (rg_get_user_armor(other) + 30 <= 300) rg_set_user_armor(other, rg_get_user_armor(other) + 30, ARMOR_NONE) } } case 1: { zp_set_user_ammo_packs(other, zp_get_user_ammo_packs(other) + 25) client_print_color(other, other, "You got^4 ++Ammo Packs") } case 2: { if (g_JumpsNum[other] == 1) client_print_color(other, other, "Sorry, you already have^3 Double Jump^1, try next box...") else { g_JumpsNum[other]++ client_print_color(other, other, "You got^4 ++Jumps") } } case 3: { if (g_Speed[other]) client_print_color(other, other, "Sorry, you already have^3 Speed^1, try next box...") else { g_Speed[other] = true RG_Reset_SpeedGravity(other) client_print_color(other, other, "You got^4 ++Speed") } } case 4: { if (g_Gravity[other]) client_print_color(other, other, "Sorry, you already have^3 Gravity^1, try next box...") else { g_Gravity[other] = true RG_Reset_SpeedGravity(other) client_print_color(other, other, "You got^4 ++Gravity") } } case 5: client_print_color(other, other, "You got^4 Nothing^1, try next box") } emit_sound(other, CHAN_VOICE, BOX_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) rg_remove_entity(ent) } public RG_Reset_SpeedGravity(id) { if (!is_user_alive(id)) return if (g_Speed[id] && Float:get_entvar(id, var_maxspeed) < 280.0) set_entvar(id, var_maxspeed, 280.0) if (g_Gravity[id] && Float:get_entvar(id, var_gravity) > 0.4) set_entvar(id, var_gravity, 0.4) } public RG_PlayerJump(id) { if (!is_user_alive(id)) return // ZP 6.2 Jumps if (g_JumpsNum[id]) { new nbut = get_entvar(id, var_button) new obut = get_entvar(id, var_oldbuttons) if ((nbut & IN_JUMP) && !(get_entvar(id, var_flags) & FL_ONGROUND) && !(obut & IN_JUMP) && g_Jumps[id] <= g_JumpsNum[id] - 1) { static Float:fVelocity[3] get_entvar(id, var_velocity, fVelocity) fVelocity[2] = random_float(265.0, 285.0) set_entvar(id, var_velocity, fVelocity) g_Jumps[id]++ } if ((nbut & IN_JUMP) && (get_entvar(id, var_flags) & FL_ONGROUND)) g_Jumps[id] = 0 } } public RoundStart() { for (new i = 1; i <= 32; i++) { if (is_user_connected(i)) { g_Speed[i] = false g_Gravity[i] = false g_JumpsNum[i] = 0 } } BoxesNum = 0 new ent = -1 while ((ent = rg_find_ent_by_class(ent, ENTITY_NAME)) != 0) { SetTouch(ent, "") SetThink(ent, "") rg_remove_entity(ent) } } public client_putinserver(id) { g_Speed[id] = false g_Gravity[id] = false g_JumpsNum[id] = 0 } public client_disconnected(id) { g_Speed[id] = false g_Gravity[id] = false g_JumpsNum[id] = 0 } SetEntSize(ent, Float:mins[3], Float:maxs[3]) { new Float:size[3] size[0] = maxs[0] - mins[0] size[1] = maxs[1] - mins[1] size[2] = maxs[2] - mins[2] set_entvar(ent, var_size, size) } Module necesare amxmodx fakemeta (posibil, în funcție de versiune) engine (opțional) Observații ✔ Versiune: 2.5 ✔ Include variante modificate (optimizate) Ideal pentru servere fun / zombie / publice Adaugă un element de surpriză în gameplay
Postări Recomandate