I create nemesis plugin but not work [Help]
jack now plugin is working but there are some problems; starting countdown is not working also round ambience is not working and when players is becoming nemesis his skin is not resetting(it stays nemesis skin even when he is zombie and also when he is human)
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
For the menu try:
What do you mean by external skin?
Code: Select all
#include <zombie_escape>
native ze_is_user_nemesis(id)
native ze_set_user_nemesis(id, bool:set)
// Access to start nemesis menu
#define NEMESISMENU_ACCESS ADMIN_LEVEL_H
#define MENU_PAGE_PLAYERS g_menu_data[id]
const OFFSET_CSMENUCODE = 205
new g_menu_data[33]
public plugin_natives()
{
register_native("ze_open_nemesis_menu", "native_ze_open_nemesis_menu", 1)
}
public plugin_init()
{
register_plugin("[ZE] Nemesis Menu", "1.0", "Jack")
register_concmd("ze_nemmenu", "cmd_nemmenu", NEMESISMENU_ACCESS)
}
public cmd_nemmenu(id, level, cid)
{
if (!cmd_access(id, NEMESISMENU_ACCESS, cid, 0))
{
client_print(id, print_console, "You don't have access.")
return PLUGIN_HANDLED
}
open_nemesis_menu(id)
return PLUGIN_HANDLED
}
public open_nemesis_menu(id)
{
static szMenu[250], szName[32]
new iMenuID, index, buffer[2]
iMenuID = menu_create("Make nemesis", "menu_player_list")
for (index = 0; index <= get_member_game(m_nMaxPlayers); index++)
{
if (!is_user_alive(index))
continue
get_user_name(index, szName, charsmax(szName))
formatex(szMenu, charsmax(szMenu), "%s \r[%s]", szName, ze_is_user_zombie(index) ? "Zombie" : "Human")
buffer[0] = index
buffer[1] = 0
menu_additem(iMenuID, szMenu, buffer)
}
// Back - Next - Exit
formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_BACK")
menu_setprop(iMenuID, MPROP_BACKNAME, szMenu)
formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_NEXT")
menu_setprop(iMenuID, MPROP_NEXTNAME, szMenu)
formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_EXIT")
menu_setprop(iMenuID, MPROP_EXITNAME, szMenu)
MENU_PAGE_PLAYERS = min(MENU_PAGE_PLAYERS, menu_pages(iMenuID) - 1)
set_pdata_int(id, OFFSET_CSMENUCODE, 0)
menu_display(id, iMenuID, MENU_PAGE_PLAYERS)
}
public menu_player_list(id, menuid, item)
{
if (item == MENU_EXIT)
{
MENU_PAGE_PLAYERS = 0
menu_destroy(menuid)
open_nemesis_menu(id)
return PLUGIN_HANDLED
}
// Remember player's menu page
MENU_PAGE_PLAYERS = item / 7
// Retrieve player id
new buffer[2], dummy, player
menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy)
player = buffer[0]
if (is_user_alive(player))
{
new szName[2][32]
get_user_name(id, szName[0], charsmax(szName))
get_user_name(player, szName[1], charsmax(szName))
ze_set_user_nemesis(player, !ze_is_user_nemesis(player))
ze_colored_print(0, "!tAdmin !g%s!n: !g%s !tturned into %s!n.", szName[0], szName[1], ze_is_user_nemesis(player) ? "zombie" : "nemesis")
}
else
ze_colored_print(id, "Player isn't alive.")
menu_destroy(menuid)
open_nemesis_menu(id)
return PLUGIN_HANDLED
}
public native_ze_open_nemesis_menu(id)
{
if (!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
return -1
}
open_nemesis_menu(id)
return true
}
now frost nade is not working for nemesis; can u fix it plzMohamed Alaa wrote: ↑4 years ago For the menu try:
What do you mean by external skin?Code: Select all
#include <zombie_escape> native ze_is_user_nemesis(id) native ze_set_user_nemesis(id, bool:set) // Access to start nemesis menu #define NEMESISMENU_ACCESS ADMIN_LEVEL_H #define MENU_PAGE_PLAYERS g_menu_data[id] const OFFSET_CSMENUCODE = 205 new g_menu_data[33] public plugin_natives() { register_native("ze_open_nemesis_menu", "native_ze_open_nemesis_menu", 1) } public plugin_init() { register_plugin("[ZE] Nemesis Menu", "1.0", "Jack") register_concmd("ze_nemmenu", "cmd_nemmenu", NEMESISMENU_ACCESS) } public cmd_nemmenu(id, level, cid) { if (!cmd_access(id, NEMESISMENU_ACCESS, cid, 0)) { client_print(id, print_console, "You don't have access.") return PLUGIN_HANDLED } open_nemesis_menu(id) return PLUGIN_HANDLED } public open_nemesis_menu(id) { static szMenu[250], szName[32] new iMenuID, index, buffer[2] iMenuID = menu_create("Make nemesis", "menu_player_list") for (index = 0; index <= get_member_game(m_nMaxPlayers); index++) { if (!is_user_alive(index)) continue get_user_name(index, szName, charsmax(szName)) formatex(szMenu, charsmax(szMenu), "%s \r[%s]", szName, ze_is_user_zombie(index) ? "Zombie" : "Human") buffer[0] = index buffer[1] = 0 menu_additem(iMenuID, szMenu, buffer) } // Back - Next - Exit formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_BACK") menu_setprop(iMenuID, MPROP_BACKNAME, szMenu) formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_NEXT") menu_setprop(iMenuID, MPROP_NEXTNAME, szMenu) formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_EXIT") menu_setprop(iMenuID, MPROP_EXITNAME, szMenu) MENU_PAGE_PLAYERS = min(MENU_PAGE_PLAYERS, menu_pages(iMenuID) - 1) set_pdata_int(id, OFFSET_CSMENUCODE, 0) menu_display(id, iMenuID, MENU_PAGE_PLAYERS) } public menu_player_list(id, menuid, item) { if (item == MENU_EXIT) { MENU_PAGE_PLAYERS = 0 menu_destroy(menuid) open_nemesis_menu(id) return PLUGIN_HANDLED } // Remember player's menu page MENU_PAGE_PLAYERS = item / 7 // Retrieve player id new buffer[2], dummy, player menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy) player = buffer[0] if (is_user_alive(player)) { new szName[2][32] get_user_name(id, szName[0], charsmax(szName)) get_user_name(player, szName[1], charsmax(szName)) ze_set_user_nemesis(player, !ze_is_user_nemesis(player)) ze_colored_print(0, "!tAdmin !g%s!n: !g%s !tturned into %s!n.", szName[0], szName[1], ze_is_user_nemesis(player) ? "zombie" : "nemesis") } else ze_colored_print(id, "Player isn't alive.") menu_destroy(menuid) open_nemesis_menu(id) return PLUGIN_HANDLED } public native_ze_open_nemesis_menu(id) { if (!is_user_connected(id)) { log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id) return -1 } open_nemesis_menu(id) return true }
Post your Frost Nade Code.
- #include <zombie_escape>
- // Setting File
- new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
- // Defines
- #define MODEL_MAX_LENGTH 64
- #define SOUND_MAX_LENGTH 64
- #define SPRITE_MAX_LENGTH 64
- #define TASK_FROST_REMOVE 200
- #define ID_FROST_REMOVE (taskid - TASK_FROST_REMOVE)
- #define TASK_FREEZE 2018
- // Default Sounds
- new const szFrostGrenadeExplodeSound[][] =
- {
- "warcraft3/frostnova.wav"
- }
- new const szFrostGrenadePlayerSound[][] =
- {
- "warcraft3/impalehit.wav"
- }
- new const szFrostGrenadeBreakSound[][] =
- {
- "warcraft3/impalelaunch1.wav"
- }
- // Default Models
- new g_v_szFrostGrenadeModel[MODEL_MAX_LENGTH] = "models/zombie_escape/v_grenade_frost.mdl"
- new g_p_szFrostGrenadeModel[MODEL_MAX_LENGTH] = "models/zombie_escape/p_grenade_frost.mdl"
- new g_w_szFrostGrenadeModel[MODEL_MAX_LENGTH] = "models/zombie_escape/w_grenade_frost.mdl"
- // Default Sprites
- new g_szGrenadeTrailSprite[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr"
- new g_szGrenadeRingSprite[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr"
- new g_szGrenadeGlassSprite[SPRITE_MAX_LENGTH] = "models/glassgibs.mdl"
- // Dynamic Arrays
- new Array:g_szFrostGrenadeExplodeSound
- new Array:g_szFrostGrenadePlayerSound
- new Array:g_szFrostGrenadeBreakSound
- // Forwards
- enum _:TOTAL_FORWARDS
- {
- FW_USER_FREEZE_PRE = 0,
- FW_USER_UNFROZEN
- }
- new g_iForwards[TOTAL_FORWARDS]
- new g_iForwardReturn
- // Variables
- new bool:g_bIsFrozen[33],
- bool:g_bZombieReleased,
- g_iFrozenRenderingFx[33],
- Float:g_fFrozenRenderingColor[33][3],
- g_iFrozenRenderingRender[33],
- Float:g_fFrozenRenderingAmount[33],
- g_iMaxClients
- // Sprites
- new g_iTrailSpr,
- g_iExplodeSpr,
- g_iGlassSpr
- // Cvar
- new g_pCvarFrostDuration,
- g_pCvarFrostHudIcon,
- g_pCvarFrozenDamage,
- g_pCvarFrostRadius,
- g_pCvarHitType
- public plugin_init()
- {
- register_plugin("[ZE] Frost Nade", ZE_VERSION, AUTHORS)
- // Hook Chains
- RegisterHookChain(RG_CBasePlayer_TraceAttack, "Fw_TraceAttack_Pre", 0)
- RegisterHookChain(RG_CBasePlayer_Killed, "Fw_PlayerKilled_Post", 1)
- RegisterHookChain(RG_CBasePlayer_PreThink, "Fw_PreThink_Post", 1)
- // Events
- register_event("HLTV", "New_Round", "a", "1=0", "2=0")
- // Hams
- RegisterHam(Ham_Think, "grenade", "Fw_ThinkGrenade_Post", 1)
- // Fakemeta
- register_forward(FM_SetModel, "Fw_SetModel_Post", 1)
- // Forwards
- g_iForwards[FW_USER_FREEZE_PRE] = CreateMultiForward("ze_frost_pre", ET_CONTINUE, FP_CELL)
- g_iForwards[FW_USER_UNFROZEN] = CreateMultiForward("ze_frost_unfreeze", ET_IGNORE, FP_CELL)
- // Cvars
- g_pCvarFrostDuration = register_cvar("ze_frost_duration", "3")
- g_pCvarFrostHudIcon = register_cvar("ze_frost_hud_icon", "1")
- g_pCvarFrozenDamage = register_cvar("ze_freeze_damage", "0")
- g_pCvarFrostRadius = register_cvar("ze_freeze_radius", "240.0")
- g_pCvarHitType = register_cvar("ze_freeze_hit_type", "0")
- // Static Values
- g_iMaxClients = get_member_game(m_nMaxPlayers)
- }
- public plugin_natives()
- {
- register_native("ze_zombie_in_forst", "native_ze_zombie_in_forst", 1)
- register_native("ze_set_frost_grenade", "native_ze_set_frost_grenade", 1)
- }
- public native_ze_zombie_in_forst(id)
- {
- if (!is_user_alive(id))
- {
- return -1
- }
- return g_bIsFrozen[id]
- }
- public native_ze_set_frost_grenade(id, set)
- {
- if (!is_user_alive(id))
- {
- log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
- return -1;
- }
- // Unfreeze
- if (!set)
- {
- // Not frozen
- if (!g_bIsFrozen[id])
- return true
- // Remove freeze right away and stop the task
- RemoveFreeze(id+TASK_FROST_REMOVE)
- remove_task(id+TASK_FROST_REMOVE)
- return true
- }
- return set_freeze(id)
- }
- public plugin_precache()
- {
- // Initialize arrays
- g_szFrostGrenadeExplodeSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
- g_szFrostGrenadePlayerSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
- g_szFrostGrenadeBreakSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
- // Load from external file
- amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE EXPLODE", g_szFrostGrenadeExplodeSound)
- amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE PLAYER", g_szFrostGrenadePlayerSound)
- amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE BREAK", g_szFrostGrenadeBreakSound)
- // If we couldn't load custom sounds from file, use and save default ones
- new iIndex
- if (ArraySize(g_szFrostGrenadeExplodeSound) == 0)
- {
- for (iIndex = 0; iIndex < sizeof szFrostGrenadeExplodeSound; iIndex++)
- ArrayPushString(g_szFrostGrenadeExplodeSound, szFrostGrenadeExplodeSound[iIndex])
- // Save to external file
- amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE EXPLODE", g_szFrostGrenadeExplodeSound)
- }
- if (ArraySize(g_szFrostGrenadePlayerSound) == 0)
- {
- for (iIndex = 0; iIndex < sizeof szFrostGrenadePlayerSound; iIndex++)
- ArrayPushString(g_szFrostGrenadePlayerSound, szFrostGrenadePlayerSound[iIndex])
- // Save to external file
- amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE PLAYER", g_szFrostGrenadePlayerSound)
- }
- if (ArraySize(g_szFrostGrenadeBreakSound) == 0)
- {
- for (iIndex = 0; iIndex < sizeof szFrostGrenadeBreakSound; iIndex++)
- ArrayPushString(g_szFrostGrenadeBreakSound, szFrostGrenadeBreakSound[iIndex])
- // Save to external file
- amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "FROST GRENADE BREAK", g_szFrostGrenadeBreakSound)
- }
- // Load from external file, save if not found
- if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "V_GRENADE FROST", g_v_szFrostGrenadeModel, charsmax(g_v_szFrostGrenadeModel)))
- amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "V_GRENADE FROST", g_v_szFrostGrenadeModel)
- if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "P_GRENADE FROST", g_p_szFrostGrenadeModel, charsmax(g_p_szFrostGrenadeModel)))
- amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "P_GRENADE FROST", g_p_szFrostGrenadeModel)
- if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "W_GRENADE FROST", g_w_szFrostGrenadeModel, charsmax(g_w_szFrostGrenadeModel)))
- amx_save_setting_string(ZE_SETTING_RESOURCES, "Weapon Models", "W_GRENADE FROST", g_w_szFrostGrenadeModel)
- if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_szGrenadeTrailSprite, charsmax(g_szGrenadeTrailSprite)))
- amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "TRAIL", g_szGrenadeTrailSprite)
- if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_szGrenadeRingSprite, charsmax(g_szGrenadeRingSprite)))
- amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "RING", g_szGrenadeRingSprite)
- if (!amx_load_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "GLASS", g_szGrenadeGlassSprite, charsmax(g_szGrenadeGlassSprite)))
- amx_save_setting_string(ZE_SETTING_RESOURCES, "Grenade Sprites", "GLASS", g_szGrenadeGlassSprite)
- // Precache sounds
- new szSound[SOUND_MAX_LENGTH]
- for (iIndex = 0; iIndex < ArraySize(g_szFrostGrenadeExplodeSound); iIndex++)
- {
- ArrayGetString(g_szFrostGrenadeExplodeSound, iIndex, szSound, charsmax(szSound))
- precache_sound(szSound)
- }
- for (iIndex = 0; iIndex < ArraySize(g_szFrostGrenadePlayerSound); iIndex++)
- {
- ArrayGetString(g_szFrostGrenadePlayerSound, iIndex, szSound, charsmax(szSound))
- precache_sound(szSound)
- }
- for (iIndex = 0; iIndex < ArraySize(g_szFrostGrenadeBreakSound); iIndex++)
- {
- ArrayGetString(g_szFrostGrenadeBreakSound, iIndex, szSound, charsmax(szSound))
- precache_sound(szSound)
- }
- // Precache models
- precache_model(g_v_szFrostGrenadeModel)
- precache_model(g_p_szFrostGrenadeModel)
- precache_model(g_w_szFrostGrenadeModel)
- // Precache sprites
- g_iTrailSpr = precache_model(g_szGrenadeTrailSprite)
- g_iExplodeSpr = precache_model(g_szGrenadeRingSprite)
- g_iGlassSpr = precache_model(g_szGrenadeGlassSprite)
- }
- public ze_user_humanized(id)
- {
- // Set custom grenade model
- cs_set_player_view_model(id, CSW_FLASHBANG, g_v_szFrostGrenadeModel)
- cs_set_player_weap_model(id, CSW_FLASHBANG, g_p_szFrostGrenadeModel)
- cs_set_player_view_model(id, CSW_SMOKEGRENADE, g_v_szFrostGrenadeModel)
- cs_set_player_weap_model(id, CSW_SMOKEGRENADE, g_p_szFrostGrenadeModel)
- // If frozen, remove freeze after player is cured
- if (g_bIsFrozen[id])
- {
- // Update rendering values first
- ApplyFrozenRendering(id)
- // Remove freeze right away and stop the task
- RemoveFreeze(id+TASK_FROST_REMOVE)
- remove_task(id+TASK_FROST_REMOVE)
- }
- }
- public Fw_PreThink_Post(id)
- {
- if (!ze_is_user_zombie(id))
- return
- if (g_bIsFrozen[id] && g_bZombieReleased)
- {
- // Stop and Freeze Zombie
- set_entvar(id, var_velocity, Float:{0.0,0.0,0.0})
- set_entvar(id, var_maxspeed, 1.0)
- ApplyFrozenRendering(id)
- }
- }
- public client_disconnected(id)
- {
- g_bIsFrozen[id] = false
- remove_task(id+TASK_FROST_REMOVE)
- }
- public New_Round()
- {
- remove_task(TASK_FREEZE)
- g_bZombieReleased = false
- // Set w_ models for grenades on ground
- new szModel[32], iEntity = -1;
- while((iEntity = rg_find_ent_by_class( iEntity, "armoury_entity")))
- {
- get_entvar(iEntity, var_model, szModel, charsmax(szModel))
- if (equali(szModel, "models/w_flashbang.mdl") || equali(szModel, "models/w_smokegrenade.mdl"))
- {
- engfunc(EngFunc_SetModel, iEntity, g_w_szFrostGrenadeModel)
- }
- }
- }
- public Fw_TraceAttack_Pre(iVictim, iAttacker)
- {
- // Block damage while frozen
- if ((get_pcvar_num(g_pCvarFrozenDamage) == 0) && g_bIsFrozen[iVictim])
- return HC_SUPERCEDE
- return HC_CONTINUE
- }
- public Fw_PlayerKilled_Post(iVictim)
- {
- // Frozen player being killed
- if (g_bIsFrozen[iVictim])
- {
- // Remove freeze right away and stop the task
- RemoveFreeze(iVictim+TASK_FROST_REMOVE)
- remove_task(iVictim+TASK_FROST_REMOVE)
- }
- }
- public ze_zombie_release()
- {
- g_bZombieReleased = true
- }
- public Fw_SetModel_Post(entity, const model[])
- {
- // We don't care
- if (strlen(model) < 8)
- return FMRES_IGNORED
- // Get damage time of grenade
- static Float:dmgtime
- get_entvar(entity, var_dmgtime, dmgtime)
- // Grenade not yet thrown
- if (dmgtime == 0.0)
- return FMRES_IGNORED
- // Grenade's owner is zombie?
- if (ze_is_user_zombie(get_entvar(entity, var_owner)))
- return FMRES_IGNORED
- // Flashbang or Smoke
- if ((model[9] == 'f' && model[10] == 'l') || (model[9] == 's' && model[10] == 'm'))
- {
- // Give it a glow
- Set_Rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
- // And a colored trail
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMFOLLOW) // TE id
- write_short(entity) // entity
- write_short(g_iTrailSpr) // sprite
- write_byte(10) // life
- write_byte(10) // width
- write_byte(0) // r
- write_byte(100) // g
- write_byte(200) // b
- write_byte(200) // brightness
- message_end()
- // Set grenade type on the thrown grenade entity
- set_entvar(entity, var_flTimeStepSound, 3333.0)
- }
- // Set w_ model
- if (equali(model, "models/w_flashbang.mdl") || equali(model, "models/w_smokegrenade.mdl"))
- {
- engfunc(EngFunc_SetModel, entity, g_w_szFrostGrenadeModel)
- return FMRES_SUPERCEDE
- }
- return FMRES_IGNORED
- }
- public Fw_ThinkGrenade_Post(entity)
- {
- // Invalid entity
- if (!pev_valid(entity))
- return HAM_IGNORED
- // Get damage time of grenade
- static Float:dmgtime
- get_entvar(entity, var_dmgtime, dmgtime)
- // Check if it's time to go off
- if (dmgtime > get_gametime())
- return HAM_IGNORED
- // Check if it's one of our custom nades
- switch (get_entvar(entity, var_flTimeStepSound))
- {
- case 3333.0: // Frost Grenade
- {
- frost_explode(entity)
- return HAM_SUPERCEDE
- }
- }
- return HAM_IGNORED
- }
- // Frost Grenade Explosion
- frost_explode(ent)
- {
- // Get origin
- static Float:origin[3]
- get_entvar(ent, var_origin, origin)
- // Make the explosion
- create_blast3(origin)
- // Frost nade explode sound
- static sound[SOUND_MAX_LENGTH]
- ArrayGetString(g_szFrostGrenadeExplodeSound, random_num(0, ArraySize(g_szFrostGrenadeExplodeSound) - 1), sound, charsmax(sound))
- emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Collisions
- if (!get_pcvar_num(g_pCvarHitType))
- {
- new victim = -1
- while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, get_pcvar_float(g_pCvarFrostRadius))) != 0)
- {
- // Only effect alive zombies, If player not released yet don't freeze him
- if (!is_user_alive(victim) || !ze_is_user_zombie(victim) || !g_bZombieReleased)
- continue
- set_freeze(victim)
- }
- }
- else
- {
- new Float:flNadeOrigin[3], Float:flVictimOrigin[3], Float:flDistance, tr = create_tr2(), Float:flFraction
- get_entvar(ent, var_origin, flNadeOrigin)
- for(new iVictim = 1; iVictim <= g_iMaxClients; iVictim++)
- {
- if (!is_user_alive(iVictim) || !ze_is_user_zombie(iVictim) || !g_bZombieReleased)
- continue
- get_entvar(iVictim, var_origin, flVictimOrigin)
- // Get distance between nade and player
- flDistance = vector_distance(flNadeOrigin, flVictimOrigin)
- if(flDistance > get_pcvar_float(g_pCvarFrostRadius))
- continue
- flNadeOrigin[2] += 2.0;
- engfunc(EngFunc_TraceLine, flNadeOrigin, flVictimOrigin, DONT_IGNORE_MONSTERS, ent, tr);
- flNadeOrigin[2] -= 2.0;
- get_tr2(tr, TR_flFraction, flFraction);
- if(flFraction != 1.0 && get_tr2(tr, TR_pHit) != iVictim)
- continue;
- set_freeze(iVictim)
- }
- // Free the trace handler
- free_tr2(tr);
- }
- // Get rid of the grenade
- engfunc(EngFunc_RemoveEntity, ent)
- }
- set_freeze(victim)
- {
- // Already frozen
- if (g_bIsFrozen[victim])
- return false
- // Allow other plugins to decide whether player should be frozen or not
- ExecuteForward(g_iForwards[FW_USER_FREEZE_PRE], g_iForwardReturn, victim)
- if (g_iForwardReturn >= PLUGIN_HANDLED)
- {
- // Get player's origin
- static origin2[3]
- get_user_origin(victim, origin2)
- // Broken glass sound
- static sound[SOUND_MAX_LENGTH]
- ArrayGetString(g_szFrostGrenadeBreakSound, random_num(0, ArraySize(g_szFrostGrenadeBreakSound) - 1), sound, charsmax(sound))
- emit_sound(victim, CHAN_BODY, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Glass shatter
- message_begin(MSG_PVS, SVC_TEMPENTITY, origin2)
- write_byte(TE_BREAKMODEL) // TE id
- write_coord(origin2[0]) // x
- write_coord(origin2[1]) // y
- write_coord(origin2[2]+24) // z
- write_coord(16) // size x
- write_coord(16) // size y
- write_coord(16) // size z
- write_coord(random_num(-50, 50)) // velocity x
- write_coord(random_num(-50, 50)) // velocity y
- write_coord(25) // velocity z
- write_byte(10) // random velocity
- write_short(g_iGlassSpr) // model
- write_byte(10) // count
- write_byte(25) // life
- write_byte(0x01) // flags
- message_end()
- return false
- }
- // Freeze icon?
- if (get_pcvar_num(g_pCvarFrostHudIcon))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("Damage"), _, victim)
- write_byte(0) // damage save
- write_byte(0) // damage take
- write_long(DMG_DROWN) // damage type - DMG_FREEZE
- write_coord(0) // x
- write_coord(0) // y
- write_coord(0) // z
- message_end()
- }
- // Set frozen flag
- g_bIsFrozen[victim] = true
- // Freeze sound
- static sound[SOUND_MAX_LENGTH]
- ArrayGetString(g_szFrostGrenadePlayerSound, random_num(0, ArraySize(g_szFrostGrenadePlayerSound) - 1), sound, charsmax(sound))
- emit_sound(victim, CHAN_BODY, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Add a blue tint to their screen
- message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, victim)
- write_short(0) // duration
- write_short(0) // hold time
- write_short(0x0004) // fade type
- write_byte(0) // red
- write_byte(50) // green
- write_byte(200) // blue
- write_byte(100) // alpha
- message_end()
- // Update player entity rendering
- ApplyFrozenRendering(victim)
- // Set a task to remove the freeze
- set_task(get_pcvar_float(g_pCvarFrostDuration), "RemoveFreeze", victim+TASK_FROST_REMOVE)
- return true
- }
- ApplyFrozenRendering(id)
- {
- // Get current rendering
- new rendering_fx = get_entvar(id, var_renderfx)
- new Float:rendering_color[3]
- get_entvar(id, var_rendercolor, rendering_color)
- new rendering_render = get_entvar(id, var_rendermode)
- new Float:rendering_amount
- get_entvar(id, var_renderamt, rendering_amount)
- // Already set, no worries...
- if (rendering_fx == kRenderFxGlowShell && rendering_color[0] == 0.0 && rendering_color[1] == 100.0
- && rendering_color[2] == 200.0 && rendering_render == kRenderNormal && rendering_amount == 25.0)
- return
- // Save player's old rendering
- g_iFrozenRenderingFx[id] = get_entvar(id, var_renderfx)
- get_entvar(id, var_rendercolor, g_fFrozenRenderingColor[id])
- g_iFrozenRenderingRender[id] = get_entvar(id, var_rendermode)
- get_entvar(id, var_renderamt, g_fFrozenRenderingAmount[id])
- // Light blue glow while frozen
- Set_Rendering(id, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
- }
- // Remove freeze task
- public RemoveFreeze(taskid)
- {
- // Remove frozen flag
- g_bIsFrozen[ID_FROST_REMOVE] = false
- // Restore rendering
- new iRed = floatround(g_fFrozenRenderingColor[ID_FROST_REMOVE][0]),
- iGreen = floatround(g_fFrozenRenderingColor[ID_FROST_REMOVE][1]),
- iBlue = floatround(g_fFrozenRenderingColor[ID_FROST_REMOVE][2])
- Set_Rendering(ID_FROST_REMOVE, g_iFrozenRenderingFx[ID_FROST_REMOVE], iRed, iGreen, iBlue, g_iFrozenRenderingRender[ID_FROST_REMOVE], floatround(g_fFrozenRenderingAmount[ID_FROST_REMOVE]))
- // Gradually remove screen's blue tint
- message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, ID_FROST_REMOVE)
- write_short((1<<12)) // duration
- write_short(0) // hold time
- write_short(0x0000) // fade type
- write_byte(0) // red
- write_byte(50) // green
- write_byte(200) // blue
- write_byte(100) // alpha
- message_end()
- // Broken glass sound
- static sound[SOUND_MAX_LENGTH]
- ArrayGetString(g_szFrostGrenadeBreakSound, random_num(0, ArraySize(g_szFrostGrenadeBreakSound) - 1), sound, charsmax(sound))
- emit_sound(ID_FROST_REMOVE, CHAN_BODY, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
- // Get player's origin
- static origin[3]
- get_user_origin(ID_FROST_REMOVE, origin)
- // Glass shatter
- message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
- write_byte(TE_BREAKMODEL) // TE id
- write_coord(origin[0]) // x
- write_coord(origin[1]) // y
- write_coord(origin[2]+24) // z
- write_coord(16) // size x
- write_coord(16) // size y
- write_coord(16) // size z
- write_coord(random_num(-50, 50)) // velocity x
- write_coord(random_num(-50, 50)) // velocity y
- write_coord(25) // velocity z
- write_byte(10) // random velocity
- write_short(g_iGlassSpr) // model
- write_byte(10) // count
- write_byte(25) // life
- write_byte(BREAK_GLASS) // flags
- message_end()
- ExecuteForward(g_iForwards[FW_USER_UNFROZEN], g_iForwardReturn, ID_FROST_REMOVE)
- }
- // Frost Grenade: Freeze Blast
- create_blast3(const Float:originF[3])
- {
- // Smallest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
- write_short(g_iExplodeSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Medium ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
- write_short(g_iExplodeSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- // Largest ring
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- engfunc(EngFunc_WriteCoord, originF[0]) // x axis
- engfunc(EngFunc_WriteCoord, originF[1]) // y axis
- engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
- write_short(g_iExplodeSpr) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(60) // width
- write_byte(0) // noise
- write_byte(0) // red
- write_byte(100) // green
- write_byte(200) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- }
-
- Veteran Member
- Posts: 407
- Joined: 5 years ago
- Contact:
Setkaran wrote: ↑4 years agonow frost nade is not working for nemesis; can u fix it plzMohamed Alaa wrote: ↑4 years ago For the menu try:
What do you mean by external skin?Code: Select all
#include <zombie_escape> native ze_is_user_nemesis(id) native ze_set_user_nemesis(id, bool:set) // Access to start nemesis menu #define NEMESISMENU_ACCESS ADMIN_LEVEL_H #define MENU_PAGE_PLAYERS g_menu_data[id] const OFFSET_CSMENUCODE = 205 new g_menu_data[33] public plugin_natives() { register_native("ze_open_nemesis_menu", "native_ze_open_nemesis_menu", 1) } public plugin_init() { register_plugin("[ZE] Nemesis Menu", "1.0", "Jack") register_concmd("ze_nemmenu", "cmd_nemmenu", NEMESISMENU_ACCESS) } public cmd_nemmenu(id, level, cid) { if (!cmd_access(id, NEMESISMENU_ACCESS, cid, 0)) { client_print(id, print_console, "You don't have access.") return PLUGIN_HANDLED } open_nemesis_menu(id) return PLUGIN_HANDLED } public open_nemesis_menu(id) { static szMenu[250], szName[32] new iMenuID, index, buffer[2] iMenuID = menu_create("Make nemesis", "menu_player_list") for (index = 0; index <= get_member_game(m_nMaxPlayers); index++) { if (!is_user_alive(index)) continue get_user_name(index, szName, charsmax(szName)) formatex(szMenu, charsmax(szMenu), "%s \r[%s]", szName, ze_is_user_zombie(index) ? "Zombie" : "Human") buffer[0] = index buffer[1] = 0 menu_additem(iMenuID, szMenu, buffer) } // Back - Next - Exit formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_BACK") menu_setprop(iMenuID, MPROP_BACKNAME, szMenu) formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_NEXT") menu_setprop(iMenuID, MPROP_NEXTNAME, szMenu) formatex(szMenu, charsmax(szMenu), "%L", id, "MENU_EXIT") menu_setprop(iMenuID, MPROP_EXITNAME, szMenu) MENU_PAGE_PLAYERS = min(MENU_PAGE_PLAYERS, menu_pages(iMenuID) - 1) set_pdata_int(id, OFFSET_CSMENUCODE, 0) menu_display(id, iMenuID, MENU_PAGE_PLAYERS) } public menu_player_list(id, menuid, item) { if (item == MENU_EXIT) { MENU_PAGE_PLAYERS = 0 menu_destroy(menuid) open_nemesis_menu(id) return PLUGIN_HANDLED } // Remember player's menu page MENU_PAGE_PLAYERS = item / 7 // Retrieve player id new buffer[2], dummy, player menu_item_getinfo(menuid, item, dummy, buffer, charsmax(buffer), _, _, dummy) player = buffer[0] if (is_user_alive(player)) { new szName[2][32] get_user_name(id, szName[0], charsmax(szName)) get_user_name(player, szName[1], charsmax(szName)) ze_set_user_nemesis(player, !ze_is_user_nemesis(player)) ze_colored_print(0, "!tAdmin !g%s!n: !g%s !tturned into %s!n.", szName[0], szName[1], ze_is_user_nemesis(player) ? "zombie" : "nemesis") } else ze_colored_print(id, "Player isn't alive.") menu_destroy(menuid) open_nemesis_menu(id) return PLUGIN_HANDLED } public native_ze_open_nemesis_menu(id) { if (!is_user_connected(id)) { log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id) return -1 } open_nemesis_menu(id) return true }
ze_nemesis_freeze
to 1 and the nemesis will be frozen when they attacked with frost nade-
- Veteran Member
- Posts: 407
- Joined: 5 years ago
- Contact:
Finally someone made/fixed that addon
Nice work and thanks bro @Mohamed
Nice work and thanks bro @Mohamed
So it-s working now this nemesis plugin ?
no round ambience + no countdown and major bug is core's rules means when players disconnect the server it spamming restart can anyone fix it?
-
- Veteran Member
- Posts: 407
- Joined: 5 years ago
- Contact:
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
Wait for the next version..
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
Updated:
1- Added ambience.
2- Bug fixes.
3- Added countdown.
4- Added "ze_nemesis" command to set a specific player a nemesis.
Code:
1- Added ambience.
2- Bug fixes.
3- Added countdown.
4- Added "ze_nemesis" command to set a specific player a nemesis.
Code:
Code: Select all
#include <zombie_escape>
// Uncomment to use custom model for nemesis
// Note: This includes player model & claws
//#define USE_NEMESIS_MODEL
// Uncomment to use leap for nemesis
// Leap Code: https://escapers-zone.net/viewtopic.php?p=10582#p10582
//#define USE_NEMESIS_LEAP
#define TASK_MAKE_NEMESIS 4949849
#define TASK_AMBIENCESOUND 2020
#define TASK_REAMBIENCESOUND 5050
// Access to start nemesis round
#define STARTNEMESIS_ACCESS ADMIN_LEVEL_H
// Settings file
new const ZE_SETTING_FILE[] = "zombie_escape.ini"
#if defined USE_NEMESIS_MODEL
// Default models
new const g_szModels_Nemesis_Player[][] = { "ze_nemesis_host" }
new const g_szModels_Nemesis_Claws[][] = { "models/zombie_escape/v_knife_nemesis.mdl" }
new Array:g_aModels_Nemesis_Player,
Array:g_aModels_Nemesis_Claws
#endif
#if defined USE_NEMESIS_LEAP
native ze_get_longjump(id)
native ze_remove_longjump(id)
#endif
enum _:Colors
{
Red = 0,
Green,
Blue
}
new g_iAmbianceSoundDuration = 160 // Set ambience duration = highest sound duration
new const szAmbianceSound[][] =
{
"zombie_escape/ze_ambiance1.mp3"
}
new bool:g_bIsNemesis[33],
bool:g_bIsNextRoundNemesis = false,
g_iCountDown,
Array:g_szAmbianceSound
new g_pCvarNemesisHP,
g_pCvarNemesisGravity,
g_pCvarNemesisSpeed,
g_pCvarNemesisGlow,
g_pCvarNemesisGlowColor[Colors],
g_pCvarNemesisKB,
g_pCvarNemesisDmg,
g_pCvarNemesisFreeze,
g_pCvarNemesisFire
public plugin_natives()
{
register_native("ze_is_user_nemesis", "native_ze_is_user_nemesis", 1)
register_native("ze_set_user_nemesis", "native_ze_set_user_nemesis", 1)
}
public plugin_precache()
{
g_szAmbianceSound = ArrayCreate(64, 1)
amx_load_setting_string_arr(ZE_SETTING_FILE, "Sounds", "Nemesis Round Ambiance", g_szAmbianceSound)
new iIndex, szSound[64]
if (ArraySize(g_szAmbianceSound) == 0)
{
for (iIndex = 0; iIndex < sizeof szAmbianceSound; iIndex++)
ArrayPushString(g_szAmbianceSound, szAmbianceSound[iIndex])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_FILE, "Sounds", "Nemesis Round Ambiance", g_szAmbianceSound)
}
for (iIndex = 0; iIndex < ArraySize(g_szAmbianceSound); iIndex++)
{
ArrayGetString(g_szAmbianceSound, iIndex, szSound, charsmax(szSound))
if (equal(szSound[strlen(szSound)-4], ".mp3"))
{
format(szSound, charsmax(szSound), "sound/%s", szSound)
precache_generic(szSound)
}
else
{
precache_sound(szSound)
}
}
#if defined USE_NEMESIS_MODEL
// Initialize arrays
g_aModels_Nemesis_Player = ArrayCreate(32, 1)
g_aModels_Nemesis_Claws = ArrayCreate(64, 1)
// Load from external file
amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS MODEL", g_aModels_Nemesis_Player)
amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
// If we couldn't load from file, use and save default ones
if (ArraySize(g_aModels_Nemesis_Player) == 0)
{
for (iIndex = 0; iIndex < sizeof g_szModels_Nemesis_Player; iIndex++)
ArrayPushString(g_aModels_Nemesis_Player, g_szModels_Nemesis_Player[iIndex])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_aModels_Nemesis_Player)
}
if (ArraySize(g_aModels_Nemesis_Claws) == 0)
{
for (iIndex = 0; iIndex < sizeof g_szModels_Nemesis_Claws; iIndex++)
ArrayPushString(g_aModels_Nemesis_Claws, g_szModels_Nemesis_Claws[iIndex])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
}
// Precache models
new player_model[32], model[64], model_path[128]
for (iIndex = 0; iIndex < ArraySize(g_aModels_Nemesis_Player); iIndex++)
{
ArrayGetString(g_aModels_Nemesis_Player, iIndex, player_model, charsmax(player_model))
formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
precache_model(model_path)
// Support modelT.mdl files
formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
if (file_exists(model_path)) precache_model(model_path)
}
for (iIndex = 0; iIndex < ArraySize(g_aModels_Nemesis_Claws); iIndex++)
{
ArrayGetString(g_aModels_Nemesis_Claws, iIndex, model, charsmax(model))
precache_model(model)
}
#endif
}
public plugin_init()
{
register_plugin("[ZE] Addons: Nemesis", "2.0", "Jack")
RegisterHam(Ham_TakeDamage, "player", "Fw_TakeDamage")
register_clcmd("ze_start_nemesis_next", "cmd_start_nemesis", STARTNEMESIS_ACCESS)
register_concmd("ze_nemesis", "cmd_nemsis", STARTNEMESIS_ACCESS)
g_pCvarNemesisHP = register_cvar("ze_nemesis_hp", "20000") // Nemesis health - Set 0 to use zombie HP
g_pCvarNemesisGravity = register_cvar("ze_nemesis_gravity", "600") // Nemesis gravity - Set 0 to use zombie gravity
g_pCvarNemesisSpeed = register_cvar("ze_nemesis_speed", "300") // Nemesis speed - Set 0 to use zombie speed
g_pCvarNemesisGlow = register_cvar("ze_nemesis_glow", "1") // Nemesis glow - 1 = enable | 0 = disable
g_pCvarNemesisGlowColor[Red] = register_cvar("ze_nemesis_glow_r", "255") // Nemesis glow color RED
g_pCvarNemesisGlowColor[Green] = register_cvar("ze_nemesis_glow_g", "255") // Nemesis glow color GREEN
g_pCvarNemesisGlowColor[Blue] = register_cvar("ze_nemesis_glow_b", "255") // Nemesis glow color BLUE
g_pCvarNemesisKB = register_cvar("ze_nemesis_kb", "200.0") // Nemesis knockback - Set 0 to use zombie knockback
g_pCvarNemesisDmg = register_cvar("ze_nemesis_dmg", "200.0") // Nemesis damage
g_pCvarNemesisFreeze = register_cvar("ze_nemesis_freeze", "0") // Nemesis get frozen? - 1 = doesn't get frozen | 0 = gets frozen
g_pCvarNemesisFire = register_cvar("ze_nemesis_fire", "1") // Nemesis set on fire? - 1 = doesn't set on fire | 0 = set on fire
}
public client_disconnected(id)
{
if (g_bIsNemesis[id])
{
new szPlayerName[2][32], iNewNemId
get_user_name(id, szPlayerName[0], charsmax(szPlayerName))
iNewNemId = GetRandomNemesis()
get_user_name(iNewNemId, szPlayerName[1], charsmax(szPlayerName))
g_bIsNemesis[id] = false
Set_Nemesis(iNewNemId)
ze_colored_print(0, "!g%s !thas left !n& !g%s !thas become nemesis!n.", szPlayerName[0], szPlayerName[1])
}
}
public client_putinserver(id)
{
if (g_bIsNemesis[id])
g_bIsNemesis[id] = false
}
public ze_user_infected_pre(iVictim, iAttacker)
{
if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim))
{
SendDeathMsg(iAttacker, iVictim)
return 1
}
return 0
}
public Fw_TakeDamage(iVictim, iInfector, iAttacker, Float:iDamage)
{
if (iVictim == iAttacker || !is_user_alive(iAttacker))
return HAM_IGNORED
if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim) && iInfector == iAttacker)
{
SetHamParamFloat(4, iDamage * get_pcvar_float(g_pCvarNemesisDmg))
return HAM_HANDLED
}
return HAM_IGNORED
}
public ze_fire_pre(id)
{
if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFire))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public ze_frost_pre(id)
{
if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFreeze))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public ze_user_humanized(id)
{
UnSet_Nemesis(id)
}
public ze_roundend()
{
remove_task(TASK_AMBIENCESOUND)
remove_task(TASK_REAMBIENCESOUND)
remove_task(TASK_MAKE_NEMESIS)
for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
{
if (is_user_alive(id) && g_bIsNemesis[id])
UnSet_Nemesis(id)
}
}
public ze_game_started_pre()
{
if (get_playersnum())
{
if (g_bIsNextRoundNemesis)
{
g_bIsNextRoundNemesis = false
g_iCountDown = 5
set_task(1.0, "StartNemesis", TASK_MAKE_NEMESIS, _, _, "b")
set_task(3.0, "AmbianceSound", TASK_AMBIENCESOUND)
return PLUGIN_HANDLED
}
}
else
{
g_bIsNextRoundNemesis = false
ze_colored_print(0, "!gThe server doesn't have enough players to start nemesis round !n(!tat least 1!n)!n.")
}
return PLUGIN_CONTINUE
}
public AmbianceSound()
{
// Stop All Sounds
StopSound()
// Play The Ambiance Sound For All Players
new szSound[64]
ArrayGetString(g_szAmbianceSound, random_num(0, ArraySize(g_szAmbianceSound) - 1), szSound, charsmax(szSound))
for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
{
if (!is_user_connected(id))
continue
PlaySound(id, szSound)
}
// We should Set Task back again to replay (Repeated 5 times MAX)
set_task(float(g_iAmbianceSoundDuration), "AmbianceSound", TASK_REAMBIENCESOUND, _, _, "a", 5)
}
public StartNemesis(taskid)
{
if (!g_iCountDown)
{
Set_Nemesis(GetRandomNemesis())
remove_task(taskid)
return
}
set_hudmessage(random(256), random(256), random(256), -1.0, 0.21, 0, 0.8, 0.8)
show_hudmessage(0, "Nemesis starts in %d second(s).", g_iCountDown--)
}
public cmd_start_nemesis(id, level, cid)
{
if (!cmd_access(id, STARTNEMESIS_ACCESS, cid, 0))
{
client_print(id, print_console, "You have not access.")
return PLUGIN_HANDLED
}
g_bIsNextRoundNemesis = true
client_print(id, print_console, "Nemesis round will start next round.")
return PLUGIN_HANDLED
}
public cmd_nemsis(id, level, cid)
{
if (!cmd_access(id, STARTNEMESIS_ACCESS, cid, 0))
{
client_print(id, print_console, "You have not access.")
return PLUGIN_HANDLED
}
// Retrieve arguments
new arg[32], player
read_argv(1, arg, charsmax(arg))
player = cmd_target(id, arg, (CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF))
// Invalid target
if (!player || !is_user_alive(player))
{
ze_colored_print(id, "Invalid player.")
return PLUGIN_HANDLED
}
// Target not allowed to be nemesis
if (g_bIsNemesis[player])
{
new player_name[32]
get_user_name(player, player_name, charsmax(player_name))
client_print(id, print_console, "[ZE] %s is already nemesis.", player_name)
return PLUGIN_HANDLED
}
Set_Nemesis(player)
return PLUGIN_HANDLED
}
public Set_Nemesis(id)
{
g_bIsNemesis[id] = true
if (!ze_is_user_zombie(id))
ze_set_user_zombie(id)
#if defined USE_NEMESIS_LEAP
ze_get_longjump(id)
#endif
#if defined USE_NEMESIS_MODEL
new szPlayerModel[32], szModel[64]
ArrayGetString(g_aModels_Nemesis_Player, random_num(0, ArraySize(g_aModels_Nemesis_Player) - 1), szPlayerModel, charsmax(szPlayerModel))
cs_set_user_model(id, szPlayerModel)
ArrayGetString(g_aModels_Nemesis_Claws, random_num(0, ArraySize(g_aModels_Nemesis_Claws) - 1), szModel, charsmax(szModel))
cs_set_player_view_model(id, CSW_KNIFE, szModel)
#endif
if (get_pcvar_num(g_pCvarNemesisHP))
{
set_entvar(id, var_health, get_pcvar_float(g_pCvarNemesisHP))
}
if (get_pcvar_num(g_pCvarNemesisSpeed))
{
ze_set_zombie_speed(id, get_pcvar_num(g_pCvarNemesisSpeed))
}
if (get_pcvar_num(g_pCvarNemesisGravity))
{
ze_set_user_gravity(id, get_pcvar_num(g_pCvarNemesisGravity))
}
if (get_pcvar_num(g_pCvarNemesisKB))
{
ze_set_user_knockback(id, get_pcvar_float(g_pCvarNemesisKB))
}
if (get_pcvar_num(g_pCvarNemesisGlow))
{
Set_Rendering(id, kRenderFxNone, 255, 0, 0, kRenderNormal, 15)
}
new szName[32]
get_user_name(id, szName, charsmax(szName))
set_hudmessage(255, 0, 0, -1.0, 0.21, 0, 0.0, 5.0, 0.1, 1.5)
show_hudmessage(id, "%s became Nemesis", szName)
ze_colored_print(0, "!g%s !tbecame !gNemesis!n.", szName)
ze_colored_print(id, "!gYou !tbecame !gNemesis!n.")
}
public UnSet_Nemesis(id)
{
if (!g_bIsNemesis[id] || !is_user_alive(id))
return
g_bIsNemesis[id] = false
#if defined USE_NEMESIS_LEAP
ze_remove_longjump(id)
#endif
if (get_pcvar_num(g_pCvarNemesisSpeed))
{
ze_reset_zombie_speed(id)
}
if (get_pcvar_num(g_pCvarNemesisGravity))
{
ze_reset_user_gravity(id)
}
if (get_pcvar_num(g_pCvarNemesisKB))
{
ze_reset_user_knockback(id)
}
if (get_pcvar_num(g_pCvarNemesisGlow))
{
Set_Rendering(id)
}
}
public GetRandomNemesis()
{
if (get_playersnum())
{
new iPlayers[32], iSelected[33], iCount = 0, iTotalPlayers, id
get_players(iPlayers, iTotalPlayers)
for (new i = 0; i < iTotalPlayers; i++)
{
id = iPlayers[i]
if (is_user_alive(id) && !g_bIsNemesis[id])
{
iSelected[iCount++] = id
}
}
return iSelected[random(--iCount)]
}
return 0
}
public native_ze_is_user_nemesis(id)
{
if (!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
return -1
}
return g_bIsNemesis[id]
}
public native_ze_set_user_nemesis(id, bool:set)
{
if (!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
return false
}
if (set)
{
if (!g_bIsNemesis[id])
Set_Nemesis(id)
}
else
{
if (g_bIsNemesis[id])
UnSet_Nemesis(id)
}
return true
}
i try to compile but i got some errors :
//AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// ze_nemesis.sma
//
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(377) : error 017: undefined symbol "ze_set_user_gravity"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(382) : error 017: undefined symbol "ze_set_user_knockback"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(416) : error 017: undefined symbol "ze_reset_user_gravity"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(421) : error 017: undefined symbol "ze_reset_user_knockback"
//
// 4 Errors.
// Could not locate output file C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\compiled\ze_nemesis.amx (compile failed).
//
// Compilation Time: 3.08 sec
// ----------------------------------------
Press enter to exit ...
//AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// ze_nemesis.sma
//
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(377) : error 017: undefined symbol "ze_set_user_gravity"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(382) : error 017: undefined symbol "ze_set_user_knockback"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(416) : error 017: undefined symbol "ze_reset_user_gravity"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(421) : error 017: undefined symbol "ze_reset_user_knockback"
//
// 4 Errors.
// Could not locate output file C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\compiled\ze_nemesis.amx (compile failed).
//
// Compilation Time: 3.08 sec
// ----------------------------------------
Press enter to exit ...
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
Update your compiler ---> viewtopic.php?f=6&t=221BandiT wrote: ↑4 years ago i try to compile but i got some errors :
//AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// ze_nemesis.sma
//
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(377) : error 017: undefined symbol "ze_set_user_gravity"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(382) : error 017: undefined symbol "ze_set_user_knockback"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(416) : error 017: undefined symbol "ze_reset_user_gravity"
// C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\ze_nemesis.sma(421) : error 017: undefined symbol "ze_reset_user_knockback"
//
// 4 Errors.
// Could not locate output file C:\Users\Owner\Desktop\Compiler v1.8.3\scripting\compiled\ze_nemesis.amx (compile failed).
//
// Compilation Time: 3.08 sec
// ----------------------------------------
Press enter to exit ...
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
anyway this plugin is totally fucked up. When you are Nemesis, you cant infect, you cant kill, counting is messed up. Many errors in logs
L 12/06/2019 - 18:10:02: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20191206.log")
L 12/06/2019 - 18:10:02: Function "cmd_nemsis" was not found
L 12/06/2019 - 18:10:02: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:10:02: [AMXX] Run time error 19: function not found
L 12/06/2019 - 18:10:02: [AMXX] [0] nemesis.sma::plugin_init (line 155)
L 12/06/2019 - 18:12:31: Invalid CVAR pointer
L 12/06/2019 - 18:12:31: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:12:31: [AMXX] Run time error 10: native error (native "get_pcvar_float")
L 12/06/2019 - 18:12:31: [AMXX] [0] nemesis.sma::Set_Nemesis (line 365)
L 12/06/2019 - 18:12:31: [AMXX] [1] nemesis.sma::GetRandomNemesis (line 447)
L 12/06/2019 - 18:12:31: [AMXX] [2] nemesis.sma::StartNemesis (line 290)
L 12/06/2019 - 18:10:02: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20191206.log")
L 12/06/2019 - 18:10:02: Function "cmd_nemsis" was not found
L 12/06/2019 - 18:10:02: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:10:02: [AMXX] Run time error 19: function not found
L 12/06/2019 - 18:10:02: [AMXX] [0] nemesis.sma::plugin_init (line 155)
L 12/06/2019 - 18:12:31: Invalid CVAR pointer
L 12/06/2019 - 18:12:31: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:12:31: [AMXX] Run time error 10: native error (native "get_pcvar_float")
L 12/06/2019 - 18:12:31: [AMXX] [0] nemesis.sma::Set_Nemesis (line 365)
L 12/06/2019 - 18:12:31: [AMXX] [1] nemesis.sma::GetRandomNemesis (line 447)
L 12/06/2019 - 18:12:31: [AMXX] [2] nemesis.sma::StartNemesis (line 290)
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
I have updated the code.czirimbolo wrote: ↑4 years ago anyway this plugin is totally fucked up. When you are Nemesis, you cant infect, you cant kill, counting is messed up. Many errors in logs
L 12/06/2019 - 18:10:02: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20191206.log")
L 12/06/2019 - 18:10:02: Function "cmd_nemsis" was not found
L 12/06/2019 - 18:10:02: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:10:02: [AMXX] Run time error 19: function not found
L 12/06/2019 - 18:10:02: [AMXX] [0] nemesis.sma::plugin_init (line 155)
L 12/06/2019 - 18:12:31: Invalid CVAR pointer
L 12/06/2019 - 18:12:31: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:12:31: [AMXX] Run time error 10: native error (native "get_pcvar_float")
L 12/06/2019 - 18:12:31: [AMXX] [0] nemesis.sma::Set_Nemesis (line 365)
L 12/06/2019 - 18:12:31: [AMXX] [1] nemesis.sma::GetRandomNemesis (line 447)
L 12/06/2019 - 18:12:31: [AMXX] [2] nemesis.sma::StartNemesis (line 290)
viewtopic.php?p=10852#p10852
This plugin have some resources for sound sprites ?
-
- Veteran Member
- Posts: 598
- Joined: 7 years ago
- Contact:
still I cant infect or kill when I am the Nemesis. Also speed does not work. I have always 250 speed, cvar does not change anythingMohamed Alaa wrote: ↑4 years agoI have updated the code.czirimbolo wrote: ↑4 years ago anyway this plugin is totally fucked up. When you are Nemesis, you cant infect, you cant kill, counting is messed up. Many errors in logs
L 12/06/2019 - 18:10:02: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20191206.log")
L 12/06/2019 - 18:10:02: Function "cmd_nemsis" was not found
L 12/06/2019 - 18:10:02: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:10:02: [AMXX] Run time error 19: function not found
L 12/06/2019 - 18:10:02: [AMXX] [0] nemesis.sma::plugin_init (line 155)
L 12/06/2019 - 18:12:31: Invalid CVAR pointer
L 12/06/2019 - 18:12:31: [AMXX] Displaying debug trace (plugin "nemesis.amxx", version "2.0")
L 12/06/2019 - 18:12:31: [AMXX] Run time error 10: native error (native "get_pcvar_float")
L 12/06/2019 - 18:12:31: [AMXX] [0] nemesis.sma::Set_Nemesis (line 365)
L 12/06/2019 - 18:12:31: [AMXX] [1] nemesis.sma::GetRandomNemesis (line 447)
L 12/06/2019 - 18:12:31: [AMXX] [2] nemesis.sma::StartNemesis (line 290)
viewtopic.php?p=10852#p10852
just add this
and its done working for me
Code: Select all
public ze_user_infected_pre(iVictim, iAttacker)
{
if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim))
{
ExecuteHamB(Ham_Killed, iVictim, iAttacker, 100)
return 1
}
return 0
}
and also if u facing model bug add this
at public UnSet_Nemesis(id)
and done
Code: Select all
#if defined USE_NEMESIS_MODEL
new szPlayerModel[32], szModel[64]
ArrayGetString(g_aModels_Nemesis_Player, random_num(0, ArraySize(g_aModels_Nemesis_Player) - 1), szPlayerModel, charsmax(szPlayerModel))
cs_reset_user_model(id)
#endif
and done
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Sign in
Who is online
Users browsing this forum: Bing [Bot] and 2 guests