Member
Join Date: Sep 2016
Location: Kosova
|
09-01-2016
, 15:13
Help To Many bugs :/
|
#1
|
Please Help Iam goind to Much Bugs in mode Zp 5.0.8
Bugs Are This +more
PHP Code:
[AMXX] Displaying debug trace (plugin "zp50_zombie_features.amxx") L 08/31/2016 - 15:10:04: [AMXX] Run time error 10: native error (native "zp_core_is_zombie") L 08/31/2016 - 15:10:04: [AMXX] [0] zp50_zombie_features.sma::message_setfov (line 116)
[AMXX] Displaying debug trace (plugin "zp50_flashlight.amxx") L 08/31/2016 - 15:10:04: [AMXX] Run time error 10: native error (native "zp_core_is_zombie") L 08/31/2016 - 15:10:04: [AMXX] [0] zp50_flashlight.sma::message_flashbat (line 223)
[AMXX] Displaying debug trace (plugin "zp50_leap.amxx") L 08/31/2016 - 15:09:50: [AMXX] Run time error 10: native error (native "zp_gamemodes_get_id") L 08/31/2016 - 15:09:50: [AMXX] [0] zp50_leap.sma::plugin_cfg (line 106)
[AMXX] Run time error 10: native error (native "zp_gamemodes_get_id") L 08/31/2016 - 15:09:50: [AMXX] [0] zp50_item_infection_bomb.sma::plugin_cfg (line 130)
[AMXX] Displaying debug trace (plugin "zp50_item_antidote.amxx") L 08/31/2016 - 15:09:50: [AMXX] Run time error 10: native error (native "zp_gamemodes_get_id") L 08/31/2016 - 15:09:50: [AMXX] [0] zp50_item_antidote.sma::plugin_cfg (line 37)
Here Is And Sma I hope anyone fixed this :/
PHP Code:
/*================================================================================ --------------------------- -*- [ZP] Item: Antidote -*- --------------------------- This plugin is part of Zombie Plague Mod and is distributed under the terms of the GNU General Public License. Check ZP_ReadMe.txt for details. ================================================================================*/
#define ITEM_NAME "Antidote" #define ITEM_COST 15
#include <amxmodx> #include <zp50_items> #include <zp50_gamemodes>
new g_ItemID new g_GameModeInfectionID new g_GameModeMultiID new cvar_deathmatch, cvar_respawn_after_last_human new g_AntidotesTaken, cvar_antidote_round_limit
public plugin_init() { register_plugin("[ZP] Item: Antidote", ZP_VERSION_STRING, "ZP Dev Team") register_event("HLTV", "event_round_start", "a", "1=0", "2=0") g_ItemID = zp_items_register(ITEM_NAME, ITEM_COST) cvar_antidote_round_limit = register_cvar("zp_antidote_round_limit", "5") }
public plugin_cfg() { g_GameModeInfectionID = zp_gamemodes_get_id("Infection Mode") g_GameModeMultiID = zp_gamemodes_get_id("Multiple Infection Mode") cvar_deathmatch = get_cvar_pointer("zp_deathmatch") cvar_respawn_after_last_human = get_cvar_pointer("zp_respawn_after_last_human") }
public event_round_start() { g_AntidotesTaken = 0 }
public zp_fw_items_select_pre(id, itemid, ignorecost) { // This is not our item if (itemid != g_ItemID) return ZP_ITEM_AVAILABLE; // Antidote only available during infection modes new current_mode = zp_gamemodes_get_current() if (current_mode != g_GameModeInfectionID && current_mode != g_GameModeMultiID) return ZP_ITEM_DONT_SHOW; // Antidote only available to zombies if (!zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW; // Display remaining item count for this round static text[32] formatex(text, charsmax(text), "[%d/%d]", g_AntidotesTaken, get_pcvar_num(cvar_antidote_round_limit)) zp_items_menu_text_add(text) // Antidote not available to last zombie if (zp_core_get_zombie_count() == 1) return ZP_ITEM_NOT_AVAILABLE; // Deathmatch mode enabled, respawn after last human disabled, and only one human left if (cvar_deathmatch && get_pcvar_num(cvar_deathmatch) && cvar_respawn_after_last_human && !get_pcvar_num(cvar_respawn_after_last_human) && zp_core_get_human_count() == 1) return ZP_ITEM_NOT_AVAILABLE; // Reached antidote limit for this round if (g_AntidotesTaken >= get_pcvar_num(cvar_antidote_round_limit)) return ZP_ITEM_NOT_AVAILABLE; return ZP_ITEM_AVAILABLE; }
public zp_fw_items_select_post(id, itemid, ignorecost) { // This is not our item if (itemid != g_ItemID) return; // Make player cure himself zp_core_cure(id, id) g_AntidotesTaken++ }
PHP Code:
/*================================================================================ --------------------------------- -*- [ZP] Item: Infection Bomb -*- --------------------------------- This plugin is part of Zombie Plague Mod and is distributed under the terms of the GNU General Public License. Check ZP_ReadMe.txt for details. ================================================================================*/
#define ITEM_NAME "Infection Bomb" #define ITEM_COST 20
#include <amxmodx> #include <fun> #include <fakemeta> #include <hamsandwich> #include <amx_settings_api> #include <cs_weap_models_api> #include <zp50_items> #include <zp50_gamemodes>
// Settings file new const ZP_SETTINGS_FILE[] = "zombieplague.ini"
// Default sounds new const sound_grenade_infect_explode[][] = { "zombie_plague/grenade_infect.wav" } new const sound_grenade_infect_player[][] = { "scientist/scream20.wav" , "scientist/scream22.wav" , "scientist/scream05.wav" }
#define MODEL_MAX_LENGTH 64 #define SOUND_MAX_LENGTH 64 #define SPRITE_MAX_LENGTH 64
// Models new g_model_grenade_infect[MODEL_MAX_LENGTH] = "models/zombie_plague/v_grenade_infect.mdl"
// Sprites new g_sprite_grenade_trail[SPRITE_MAX_LENGTH] = "sprites/laserbeam.spr" new g_sprite_grenade_ring[SPRITE_MAX_LENGTH] = "sprites/shockwave.spr"
new Array:g_sound_grenade_infect_explode new Array:g_sound_grenade_infect_player
// Explosion radius for custom grenades const Float:NADE_EXPLOSION_RADIUS = 240.0
// HACK: pev_ field used to store custom nade types and their values const PEV_NADE_TYPE = pev_flTimeStepSound const NADE_TYPE_INFECTION = 1111
new g_trailSpr, g_exploSpr
new g_ItemID new g_GameModeInfectionID new g_GameModeMultiID new g_InfectionBombCounter, cvar_infection_bomb_round_limit
public plugin_init() { register_plugin("[ZP] Item: Infection Bomb", ZP_VERSION_STRING, "ZP Dev Team") register_event("HLTV", "event_round_start", "a", "1=0", "2=0") register_forward(FM_SetModel, "fw_SetModel") RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade") g_ItemID = zp_items_register(ITEM_NAME, ITEM_COST) cvar_infection_bomb_round_limit = register_cvar("zp_infection_bomb_round_limit", "3") }
public plugin_precache() { // Initialize arrays g_sound_grenade_infect_explode = ArrayCreate(SOUND_MAX_LENGTH, 1) g_sound_grenade_infect_player = ArrayCreate(SOUND_MAX_LENGTH, 1) // Load from external file amx_load_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "GRENADE INFECT EXPLODE", g_sound_grenade_infect_explode) amx_load_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "GRENADE INFECT PLAYER", g_sound_grenade_infect_player) // If we couldn't load custom sounds from file, use and save default ones new index if (ArraySize(g_sound_grenade_infect_explode) == 0) { for (index = 0; index < sizeof sound_grenade_infect_explode; index++) ArrayPushString(g_sound_grenade_infect_explode, sound_grenade_infect_explode[index]) // Save to external file amx_save_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "GRENADE INFECT EXPLODE", g_sound_grenade_infect_explode) } if (ArraySize(g_sound_grenade_infect_player) == 0) { for (index = 0; index < sizeof sound_grenade_infect_player; index++) ArrayPushString(g_sound_grenade_infect_player, sound_grenade_infect_player[index]) // Save to external file amx_save_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "GRENADE INFECT PLAYER", g_sound_grenade_infect_player) } // Load from external file, save if not found if (!amx_load_setting_string(ZP_SETTINGS_FILE, "Weapon Models", "GRENADE INFECT", g_model_grenade_infect, charsmax(g_model_grenade_infect))) amx_save_setting_string(ZP_SETTINGS_FILE, "Weapon Models", "GRENADE INFECT", g_model_grenade_infect) if (!amx_load_setting_string(ZP_SETTINGS_FILE, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail, charsmax(g_sprite_grenade_trail))) amx_save_setting_string(ZP_SETTINGS_FILE, "Grenade Sprites", "TRAIL", g_sprite_grenade_trail) if (!amx_load_setting_string(ZP_SETTINGS_FILE, "Grenade Sprites", "RING", g_sprite_grenade_ring, charsmax(g_sprite_grenade_ring))) amx_save_setting_string(ZP_SETTINGS_FILE, "Grenade Sprites", "RING", g_sprite_grenade_ring) // Precache sounds new sound[SOUND_MAX_LENGTH] for (index = 0; index < ArraySize(g_sound_grenade_infect_explode); index++) { ArrayGetString(g_sound_grenade_infect_explode, index, sound, charsmax(sound)) precache_sound(sound) } for (index = 0; index < ArraySize(g_sound_grenade_infect_player); index++) { ArrayGetString(g_sound_grenade_infect_player, index, sound, charsmax(sound)) precache_sound(sound) } // Precache models precache_model(g_model_grenade_infect) g_trailSpr = precache_model(g_sprite_grenade_trail) g_exploSpr = precache_model(g_sprite_grenade_ring) }
public plugin_cfg() { g_GameModeInfectionID = zp_gamemodes_get_id("Infection Mode") g_GameModeMultiID = zp_gamemodes_get_id("Multiple Infection Mode") }
public event_round_start() { g_InfectionBombCounter = 0 }
public zp_fw_items_select_pre(id, itemid, ignorecost) { // This is not our item if (itemid != g_ItemID) return ZP_ITEM_AVAILABLE; // Infection bomb only available during infection modes new current_mode = zp_gamemodes_get_current() if (current_mode != g_GameModeInfectionID && current_mode != g_GameModeMultiID) return ZP_ITEM_DONT_SHOW; // Infection bomb only available to zombies if (!zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW; // Display remaining item count for this round static text[32] formatex(text, charsmax(text), "[%d/%d]", g_InfectionBombCounter, get_pcvar_num(cvar_infection_bomb_round_limit)) zp_items_menu_text_add(text) // Reached infection bomb limit for this round if (g_InfectionBombCounter >= get_pcvar_num(cvar_infection_bomb_round_limit)) return ZP_ITEM_NOT_AVAILABLE; // Player already owns infection bomb if (user_has_weapon(id, CSW_HEGRENADE)) return ZP_ITEM_NOT_AVAILABLE; return ZP_ITEM_AVAILABLE; }
public zp_fw_items_select_post(id, itemid, ignorecost) { // This is not our item if (itemid != g_ItemID) return; // Give infection bomb give_item(id, "weapon_hegrenade") g_InfectionBombCounter++ }
public zp_fw_core_cure(id, attacker) { // Remove custom grenade model cs_reset_player_view_model(id, CSW_HEGRENADE) }
public zp_fw_core_infect_post(id, attacker) { // Set custom grenade model cs_set_player_view_model(id, CSW_HEGRENADE, g_model_grenade_infect) }
// Forward Set Model public fw_SetModel(entity, const model[]) { // We don't care if (strlen(model) < 8) return; // Narrow down our matches a bit if (model[7] != 'w' || model[8] != '_') return; // Get damage time of grenade static Float:dmgtime pev(entity, pev_dmgtime, dmgtime) // Grenade not yet thrown if (dmgtime == 0.0) return; // Grenade's owner isn't zombie? if (!zp_core_is_zombie(pev(entity, pev_owner))) return; // HE Grenade if (model[9] == 'h' && model[10] == 'e') { // Give it a glow fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, 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_trailSpr) // sprite write_byte(10) // life write_byte(10) // width write_byte(0) // r write_byte(200) // g write_byte(0) // b write_byte(200) // brightness message_end() // Set grenade type on the thrown grenade entity set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_INFECTION) } }
// Ham Grenade Think Forward public fw_ThinkGrenade(entity) { // Invalid entity if (!pev_valid(entity)) return HAM_IGNORED; // Get damage time of grenade static Float:dmgtime pev(entity, pev_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 (pev(entity, PEV_NADE_TYPE)) { case NADE_TYPE_INFECTION: // Infection Bomb { infection_explode(entity) return HAM_SUPERCEDE; } } return HAM_IGNORED; }
// Infection Bomb Explosion infection_explode(ent) { // Round ended if (zp_gamemodes_get_current() == ZP_NO_GAME_MODE) { // Get rid of the grenade engfunc(EngFunc_RemoveEntity, ent) return; } // Get origin static Float:origin[3] pev(ent, pev_origin, origin) // Make the explosion create_blast(origin) // Infection nade explode sound static sound[SOUND_MAX_LENGTH] ArrayGetString(g_sound_grenade_infect_explode, random_num(0, ArraySize(g_sound_grenade_infect_explode) - 1), sound, charsmax(sound)) emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM) // Get attacker new attacker = pev(ent, pev_owner) // Infection bomb owner disconnected or not zombie anymore? if (!is_user_connected(attacker) || !zp_core_is_zombie(attacker)) { // Get rid of the grenade engfunc(EngFunc_RemoveEntity, ent) return; } // Collisions new victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, NADE_EXPLOSION_RADIUS)) != 0) { // Only effect alive humans if (!is_user_alive(victim) || zp_core_is_zombie(victim)) continue; // Last human is killed if (zp_core_get_human_count() == 1) { ExecuteHamB(Ham_Killed, victim, attacker, 0) continue; } // Turn into zombie zp_core_infect(victim, attacker) // Victim's sound ArrayGetString(g_sound_grenade_infect_player, random_num(0, ArraySize(g_sound_grenade_infect_player) - 1), sound, charsmax(sound)) emit_sound(victim, CHAN_VOICE, sound, 1.0, ATTN_NORM, 0, PITCH_NORM) } // Get rid of the grenade engfunc(EngFunc_RemoveEntity, ent) }
// Infection Bomb: Green Blast create_blast(const Float:origin[3]) { // Smallest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+385.0) // z axis write_short(g_exploSpr) // 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(200) // green write_byte(0) // blue write_byte(200) // brightness write_byte(0) // speed message_end() // Medium ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+470.0) // z axis write_short(g_exploSpr) // 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(200) // green write_byte(0) // blue write_byte(200) // brightness write_byte(0) // speed message_end() // Largest ring engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0) write_byte(TE_BEAMCYLINDER) // TE id engfunc(EngFunc_WriteCoord, origin[0]) // x engfunc(EngFunc_WriteCoord, origin[1]) // y engfunc(EngFunc_WriteCoord, origin[2]) // z engfunc(EngFunc_WriteCoord, origin[0]) // x axis engfunc(EngFunc_WriteCoord, origin[1]) // y axis engfunc(EngFunc_WriteCoord, origin[2]+555.0) // z axis write_short(g_exploSpr) // 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(200) // green write_byte(0) // blue write_byte(200) // brightness write_byte(0) // speed message_end() }
// Set entity's rendering type (from fakemeta_util) stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static Float:color[3] color[0] = float(r) color[1] = float(g) color[2] = float(b) set_pev(entity, pev_renderfx, fx) set_pev(entity, pev_rendercolor, color) set_pev(entity, pev_rendermode, render) set_pev(entity, pev_renderamt, float(amount)) }
PHP Code:
/*================================================================================ -------------------------- -*- [ZP] Leap/Longjump -*- -------------------------- This plugin is part of Zombie Plague Mod and is distributed under the terms of the GNU General Public License. Check ZP_ReadMe.txt for details. ================================================================================*/
#include <amxmodx> #include <fun> #include <fakemeta> #include <zp50_gamemodes> #define LIBRARY_NEMESIS "zp50_class_nemesis" #include <zp50_class_nemesis> #define LIBRARY_ASSASSIN "zp50_class_assassin" #include <zp50_class_assassin> #define LIBRARY_SURVIVOR "zp50_class_survivor" #include <zp50_class_survivor> #define LIBRARY_SNIPER "zp50_class_sniper" #include <zp50_class_sniper>
#define MAXPLAYERS 32
new g_GameModeInfectionID new Float:g_LeapLastTime[MAXPLAYERS+1]
new cvar_leap_zombie, cvar_leap_zombie_force, cvar_leap_zombie_height, cvar_leap_zombie_cooldown new cvar_leap_nemesis, cvar_leap_nemesis_force, cvar_leap_nemesis_height, cvar_leap_nemesis_cooldown new cvar_leap_assassin, cvar_leap_assassin_force, cvar_leap_assassin_height, cvar_leap_assassin_cooldown new cvar_leap_survivor, cvar_leap_survivor_force, cvar_leap_survivor_height, cvar_leap_survivor_cooldown new cvar_leap_sniper, cvar_leap_sniper_force, cvar_leap_sniper_height, cvar_leap_sniper_cooldown
public plugin_init() { register_plugin("[ZP] Leap/Longjump", ZP_VERSION_STRING, "ZP Dev Team") cvar_leap_zombie = register_cvar("zp_leap_zombie", "3") // 1-all // 2-first only // 3-last only cvar_leap_zombie_force = register_cvar("zp_leap_zombie_force", "500") cvar_leap_zombie_height = register_cvar("zp_leap_zombie_height", "300") cvar_leap_zombie_cooldown = register_cvar("zp_leap_zombie_cooldown", "10.0") // Nemesis Class loaded? if (LibraryExists(LIBRARY_NEMESIS, LibType_Library)) { cvar_leap_nemesis = register_cvar("zp_leap_nemesis", "1") cvar_leap_nemesis_force = register_cvar("zp_leap_nemesis_force", "500") cvar_leap_nemesis_height = register_cvar("zp_leap_nemesis_height", "300") cvar_leap_nemesis_cooldown = register_cvar("zp_leap_nemesis_cooldown", "5.0") }
// Assassin Class loaded? if (LibraryExists(LIBRARY_ASSASSIN, LibType_Library)) { cvar_leap_assassin = register_cvar("zp_leap_assassin", "1") cvar_leap_assassin_force = register_cvar("zp_leap_assassin_force", "500") cvar_leap_assassin_height = register_cvar("zp_leap_assassin_height", "300") cvar_leap_assassin_cooldown = register_cvar("zp_leap_assassin_cooldown", "5.0") } // Survivor Class loaded? if (LibraryExists(LIBRARY_SURVIVOR, LibType_Library)) { cvar_leap_survivor = register_cvar("zp_leap_survivor", "0") cvar_leap_survivor_force = register_cvar("zp_leap_survivor_force", "500") cvar_leap_survivor_height = register_cvar("zp_leap_survivor_height", "300") cvar_leap_survivor_cooldown = register_cvar("zp_leap_survivor_cooldown", "5.0") }
// Sniper Class loaded? if (LibraryExists(LIBRARY_SNIPER, LibType_Library)) { cvar_leap_sniper = register_cvar("zp_leap_sniper", "0") cvar_leap_sniper_force = register_cvar("zp_leap_sniper_force", "500") cvar_leap_sniper_height = register_cvar("zp_leap_sniper_height", "300") cvar_leap_sniper_cooldown = register_cvar("zp_leap_sniper_cooldown", "5.0") } register_forward(FM_PlayerPreThink, "fw_PlayerPreThink") }
public plugin_natives() { set_module_filter("module_filter") set_native_filter("native_filter") } public module_filter(const module[]) { if (equal(module, LIBRARY_NEMESIS) || equal(module, LIBRARY_ASSASSIN) || equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_SNIPER)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } public native_filter(const name[], index, trap) { if (!trap) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; }
public plugin_cfg() { g_GameModeInfectionID = zp_gamemodes_get_id("Infection Mode") }
// Forward Player PreThink public fw_PlayerPreThink(id) { // Not alive if (!is_user_alive(id)) return; // Don't allow leap if player is frozen (e.g. freezetime) if (get_user_maxspeed(id) == 1.0) return; static Float:cooldown, force, Float:height // Nemesis Class loaded? if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_nemesis_get(id)) { // Check if nemesis should leap if (!get_pcvar_num(cvar_leap_nemesis)) return; cooldown = get_pcvar_float(cvar_leap_nemesis_cooldown) force = get_pcvar_num(cvar_leap_nemesis_force) height = get_pcvar_float(cvar_leap_nemesis_height) } // Assassin Class loaded? else if (LibraryExists(LIBRARY_ASSASSIN, LibType_Library) && zp_class_assassin_get(id)) { // Check if assassin should leap if (!get_pcvar_num(cvar_leap_assassin)) return; cooldown = get_pcvar_float(cvar_leap_assassin_cooldown) force = get_pcvar_num(cvar_leap_assassin_force) height = get_pcvar_float(cvar_leap_assassin_height) } // Survivor Class loaded? else if (LibraryExists(LIBRARY_SURVIVOR, LibType_Library) && zp_class_survivor_get(id)) { // Check if survivor should leap if (!get_pcvar_num(cvar_leap_survivor)) return; cooldown = get_pcvar_float(cvar_leap_survivor_cooldown) force = get_pcvar_num(cvar_leap_survivor_force) height = get_pcvar_float(cvar_leap_survivor_height) } // Sniper Class loaded? else if (LibraryExists(LIBRARY_SNIPER, LibType_Library) && zp_class_sniper_get(id)) { // Check if sniper should leap if (!get_pcvar_num(cvar_leap_sniper)) return; cooldown = get_pcvar_float(cvar_leap_sniper_cooldown) force = get_pcvar_num(cvar_leap_sniper_force) height = get_pcvar_float(cvar_leap_sniper_height) } else { // Not a zombie if (!zp_core_is_zombie(id)) return; // Check if zombie should leap switch (get_pcvar_num(cvar_leap_zombie)) { // Disabled case 0: return; // First zombie (only on infection rounds) case 2: if (!zp_core_is_first_zombie(id) || (zp_gamemodes_get_current() != g_GameModeInfectionID)) return; // Last zombie case 3: if (!zp_core_is_last_zombie(id)) return; } cooldown = get_pcvar_float(cvar_leap_zombie_cooldown) force = get_pcvar_num(cvar_leap_zombie_force) height = get_pcvar_float(cvar_leap_zombie_height) } static Float:current_time current_time = get_gametime() // Cooldown not over yet if (current_time - g_LeapLastTime[id] < cooldown) return; // Not doing a longjump (don't perform check for bots, they leap automatically) if (!is_user_bot(id) && !(pev(id, pev_button) & (IN_JUMP | IN_DUCK) == (IN_JUMP | IN_DUCK))) return; // Not on ground or not enough speed if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80) return; static Float:velocity[3] // Make velocity vector velocity_by_aim(id, force, velocity) // Set custom height velocity[2] = height // Apply the new velocity set_pev(id, pev_velocity, velocity) // Update last leap time g_LeapLastTime[id] = current_time }
// Get entity's speed (from fakemeta_util) stock fm_get_speed(entity) { static Float:velocity[3] pev(entity, pev_velocity, velocity) return floatround(vector_length(velocity)); }
PHP Code:
/*================================================================================ ----------------------- -*- [ZP] Flashlight -*- ----------------------- This plugin is part of Zombie Plague Mod and is distributed under the terms of the GNU General Public License. Check ZP_ReadMe.txt for details. ================================================================================*/
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <xs> #include <cs_ham_bots_api> #include <zp50_core>
#define TASK_FLASHLIGHT 100 #define TASK_CHARGE 200 #define ID_FLASHLIGHT (taskid - TASK_FLASHLIGHT) #define ID_CHARGE (taskid - TASK_CHARGE)
// CS Player PData Offsets (win32) const PDATA_SAFE = 2 const OFFSET_FLASHLIGHT_BATTERIES = 244
const IMPULSE_FLASHLIGHT = 100
new const g_sound_flashlight[] = "items/flashlight1.wav"
#define MAXPLAYERS 32
#define flag_get(%1,%2) (%1 & (1 << (%2 & 31))) #define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false) #define flag_set(%1,%2) %1 |= (1 << (%2 & 31)) #define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))
new g_MsgFlashlight, g_MsgFlashBat
new g_FlashlightActive new g_FlashlightCharge[MAXPLAYERS+1] new Float:g_FlashlightLastTime[MAXPLAYERS+1]
new cvar_flashlight_starting_charge new cvar_flashlight_custom, cvar_flashlight_radius new cvar_flashlight_distance, cvar_flashlight_show_all new cvar_flashlight_drain_rate, cvar_flashlight_charge_rate new cvar_flashlight_color_R, cvar_flashlight_color_G, cvar_flashlight_color_B
public plugin_init() { register_plugin("[ZP] Flashlight", ZP_VERSION_STRING, "ZP Dev Team") register_forward(FM_CmdStart, "fw_CmdStart") RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") RegisterHamBots(Ham_Killed, "fw_PlayerKilled") g_MsgFlashlight = get_user_msgid("Flashlight") g_MsgFlashBat = get_user_msgid("FlashBat") register_message(g_MsgFlashBat, "message_flashbat") cvar_flashlight_starting_charge = register_cvar("zp_flashlight_starting_charge", "100") cvar_flashlight_custom = register_cvar("zp_flashlight_custom", "0") cvar_flashlight_radius = register_cvar("zp_flashlight_radius", "10") cvar_flashlight_distance = register_cvar("zp_flashlight_distance", "1000") cvar_flashlight_show_all = register_cvar("zp_flashlight_show_all", "1") cvar_flashlight_drain_rate = register_cvar("zp_flashlight_drain_rate", "1") cvar_flashlight_charge_rate = register_cvar("zp_flashlight_charge_rate", "5") cvar_flashlight_color_R = register_cvar("zp_flashlight_color_R", "100") cvar_flashlight_color_G = register_cvar("zp_flashlight_color_G", "100") cvar_flashlight_color_B = register_cvar("zp_flashlight_color_B", "100") }
public plugin_natives() { register_library("zp50_flashlight") register_native("zp_flashlight_get_charge", "native_flashlight_get_charge") register_native("zp_flashlight_set_charge", "native_flashlight_set_charge") }
public native_flashlight_get_charge(plugin_id, num_params) { new id = get_param(1) if (!is_user_connected(id)) { log_error(AMX_ERR_NATIVE, "[ZP] Invalid Player (%d)", id) return -1; } // Custom flashlight not enabled if (!get_pcvar_num(cvar_flashlight_custom)) return -1; return g_FlashlightCharge[id]; }
public native_flashlight_set_charge(plugin_id, num_params) { new id = get_param(1) new charge = get_param(2) if (!is_user_connected(id)) { log_error(AMX_ERR_NATIVE, "[ZP] Invalid Player (%d)", id) return false; } // Custom flashlight not enabled if (!get_pcvar_num(cvar_flashlight_custom)) return false; g_FlashlightCharge[id] = clamp(charge, 0, 100) // Set the flashlight charge task to update batteries remove_task(id+TASK_CHARGE) set_task(1.0, "flashlight_charge_task", id+TASK_CHARGE, _, _, "b") return true; }
public plugin_precache() { precache_sound(g_sound_flashlight) }
public plugin_cfg() { // Enables flashlight server_cmd("mp_flashlight 1") }
// Forward CmdStart public fw_CmdStart(id, handle) { // Not alive if (!is_user_alive(id)) return; // Check if it's a flashlight impulse if (get_uc(handle, UC_Impulse) != IMPULSE_FLASHLIGHT) return; // Flashlight is being turned off if (pev(id, pev_effects) & EF_DIMLIGHT) return; if (zp_core_is_zombie(id)) { // Block it! set_uc(handle, UC_Impulse, 0) } else if (get_pcvar_num(cvar_flashlight_custom)) { // Block it! set_uc(handle, UC_Impulse, 0) // Should human's custom flashlight be turned on? if (g_FlashlightCharge[id] > 2 && get_gametime() - g_FlashlightLastTime[id] > 1.2) { // Prevent calling flashlight too quickly (bugfix) g_FlashlightLastTime[id] = get_gametime() // Toggle custom flashlight if (flag_get(g_FlashlightActive, id)) { // Remove flashlight task remove_task(id+TASK_FLASHLIGHT) flag_unset(g_FlashlightActive, id) } else { // Set the custom flashlight task set_task(0.1, "custom_flashlight_task", id+TASK_FLASHLIGHT, _, _, "b") flag_set(g_FlashlightActive, id) } // Set the flashlight charge task remove_task(id+TASK_CHARGE) set_task(1.0, "flashlight_charge_task", id+TASK_CHARGE, _, _, "b") // Play flashlight toggle sound emit_sound(id, CHAN_ITEM, g_sound_flashlight, 1.0, ATTN_NORM, 0, PITCH_NORM) // Update flashlight status on HUD message_begin(MSG_ONE, g_MsgFlashlight, _, id) write_byte(flag_get_boolean(g_FlashlightActive, id)) // toggle write_byte(g_FlashlightCharge[id]) // batteries message_end() } } }
// Ham Player Killed Forward public fw_PlayerKilled(victim, attacker, shouldgib) { // Reset flashlight flags flag_unset(g_FlashlightActive, victim) remove_task(victim+TASK_FLASHLIGHT) remove_task(victim+TASK_CHARGE) }
public client_disconnect(id) { // Reset flashlight flags flag_unset(g_FlashlightActive, id) remove_task(id+TASK_FLASHLIGHT) remove_task(id+TASK_CHARGE) }
// Flashlight batteries messages public message_flashbat(msg_id, msg_dest, msg_entity) { // Block if custom flashlight is enabled instead if (get_pcvar_num(cvar_flashlight_custom)) return PLUGIN_HANDLED; // Block if zombie if (is_user_connected(msg_entity) && zp_core_is_zombie(msg_entity)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; }
public zp_fw_core_infect_post(id, attacker) { // Turn off zombies flashlight turn_off_flashlight(id) }
public zp_fw_core_cure_post(id, attacker) { // Turn off humans flashlight (prevents double flashlight bug/exploit after respawn) turn_off_flashlight(id) }
// Turn Off Flashlight and Restore Batteries turn_off_flashlight(id) { // Restore batteries to starting charge if (get_pcvar_num(cvar_flashlight_custom)) g_FlashlightCharge[id] = get_pcvar_num(cvar_flashlight_starting_charge) else fm_cs_set_flash_batteries(id, get_pcvar_num(cvar_flashlight_starting_charge)) // Check if flashlight is on if (pev(id, pev_effects) & EF_DIMLIGHT) { // Turn it off set_pev(id, pev_impulse, IMPULSE_FLASHLIGHT) } else { // Clear any stored flashlight impulse (bugfix) set_pev(id, pev_impulse, 0) // Update flashlight HUD message_begin(MSG_ONE, g_MsgFlashlight, _, id) write_byte(0) // toggle write_byte(get_pcvar_num(cvar_flashlight_starting_charge)) // batteries message_end() } if (get_pcvar_num(cvar_flashlight_custom)) { // Turn it off flag_unset(g_FlashlightActive, id) // Remove previous tasks remove_task(id+TASK_CHARGE) remove_task(id+TASK_FLASHLIGHT) } }
// Custom Flashlight Task public custom_flashlight_task(taskid) { // Get player and aiming origins static Float:origin[3], Float:destorigin[3] pev(ID_FLASHLIGHT, pev_origin, origin) fm_get_aim_origin(ID_FLASHLIGHT, destorigin) // Max distance check if (get_distance_f(origin, destorigin) > get_pcvar_float(cvar_flashlight_distance)) return; // Send to all players? if (get_pcvar_num(cvar_flashlight_show_all)) engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, destorigin, 0) else message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, ID_FLASHLIGHT) // Flashlight write_byte(TE_DLIGHT) // TE id engfunc(EngFunc_WriteCoord, destorigin[0]) // x engfunc(EngFunc_WriteCoord, destorigin[1]) // y engfunc(EngFunc_WriteCoord, destorigin[2]) // z write_byte(get_pcvar_num(cvar_flashlight_radius)) // radius write_byte(get_pcvar_num(cvar_flashlight_color_R)) // r write_byte(get_pcvar_num(cvar_flashlight_color_G)) // g write_byte(get_pcvar_num(cvar_flashlight_color_B)) // b write_byte(3) // life write_byte(0) // decay rate message_end() }
// Flashlight Charge Task public flashlight_charge_task(taskid) { // Drain or charge? if (flag_get(g_FlashlightActive, ID_CHARGE)) g_FlashlightCharge[ID_CHARGE] = max(g_FlashlightCharge[ID_CHARGE] - get_pcvar_num(cvar_flashlight_drain_rate), 0) else g_FlashlightCharge[ID_CHARGE] = min(g_FlashlightCharge[ID_CHARGE] + get_pcvar_num(cvar_flashlight_charge_rate), 100) // Batteries fully charged if (g_FlashlightCharge[ID_CHARGE] == 100) { // Update flashlight batteries on HUD message_begin(MSG_ONE, g_MsgFlashBat, _, ID_CHARGE) write_byte(100) // batteries message_end() // Task not needed anymore remove_task(taskid) return; } // Batteries depleted if (g_FlashlightCharge[ID_CHARGE] == 0) { // Turn it off flag_unset(g_FlashlightActive, ID_CHARGE) // Remove flashlight task for this player remove_task(ID_CHARGE+TASK_FLASHLIGHT) // Play flashlight toggle sound emit_sound(ID_CHARGE, CHAN_ITEM, g_sound_flashlight, 1.0, ATTN_NORM, 0, PITCH_NORM) // Update flashlight status on HUD message_begin(MSG_ONE, g_MsgFlashlight, _, ID_CHARGE) write_byte(0) // toggle write_byte(0) // batteries message_end() return; } // Update flashlight batteries on HUD message_begin(MSG_ONE_UNRELIABLE, g_MsgFlashBat, _, ID_CHARGE) write_byte(g_FlashlightCharge[ID_CHARGE]) // batteries message_end() }
// Set Flashlight Batteries stock fm_cs_set_flash_batteries(id, value) { // Prevent server crash if entity's private data not initalized if (pev_valid(id) != PDATA_SAFE) return; set_pdata_int(id, OFFSET_FLASHLIGHT_BATTERIES, value) }
// Get entity's aim origins (from fakemeta_util) stock fm_get_aim_origin(id, Float:origin[3]) { static Float:origin1F[3], Float:origin2F[3] pev(id, pev_origin, origin1F) pev(id, pev_view_ofs, origin2F) xs_vec_add(origin1F, origin2F, origin1F)
pev(id, pev_v_angle, origin2F); engfunc(EngFunc_MakeVectors, origin2F) global_get(glb_v_forward, origin2F) xs_vec_mul_scalar(origin2F, 9999.0, origin2F) xs_vec_add(origin1F, origin2F, origin2F)
engfunc(EngFunc_TraceLine, origin1F, origin2F, 0, id, 0) get_tr2(0, TR_vecEndPos, origin) }
PHP Code:
/*================================================================================ ---------------------------- -*- [ZP] Zombie Features -*- ---------------------------- This plugin is part of Zombie Plague Mod and is distributed under the terms of the GNU General Public License. Check ZP_ReadMe.txt for details. ================================================================================*/
#include <amxmodx> #include <fun> #include <fakemeta> #include <hamsandwich> #include <amx_settings_api> #include <cs_ham_bots_api> #include <zp50_core> #define LIBRARY_NEMESIS "zp50_class_nemesis" #include <zp50_class_nemesis> #define LIBRARY_ASSASSIN "zp50_class_assassin" #include <zp50_class_assassin>
// Settings file new const ZP_SETTINGS_FILE[] = "zombieplague.ini"
new const bleeding_decals[] = { 99 , 107 , 108 , 184 , 185 , 186 , 187 , 188 , 189 }
new Array:g_bleeding_decals
#define TASK_BLOOD 100 #define ID_BLOOD (taskid - TASK_BLOOD)
#define CS_DEFAULT_FOV 90
new g_IsModCZ new g_MsgSetFOV
new cvar_zombie_fov, cvar_zombie_silent, cvar_zombie_bleeding
public plugin_init() { register_plugin("[ZP] Zombie Features", ZP_VERSION_STRING, "ZP Dev Team") g_MsgSetFOV = get_user_msgid("SetFOV") register_message(g_MsgSetFOV, "message_setfov") cvar_zombie_fov = register_cvar("zp_zombie_fov", "110") cvar_zombie_silent = register_cvar("zp_zombie_silent", "1") cvar_zombie_bleeding = register_cvar("zp_zombie_bleeding", "1") RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") RegisterHamBots(Ham_Killed, "fw_PlayerKilled") // Check if it's a CZ server new mymod[6] get_modname(mymod, charsmax(mymod)) if (equal(mymod, "czero")) g_IsModCZ = 1 }
public plugin_precache() { // Initialize arrays g_bleeding_decals = ArrayCreate(1, 1) // Load from external file amx_load_setting_int_arr(ZP_SETTINGS_FILE, "Zombie Decals", "DECALS", g_bleeding_decals) // If we couldn't load from file, use and save default ones new index if (ArraySize(g_bleeding_decals) == 0) { for (index = 0; index < sizeof bleeding_decals; index++) ArrayPushCell(g_bleeding_decals, bleeding_decals[index]) // Save to external file amx_save_setting_int_arr(ZP_SETTINGS_FILE, "Zombie Decals", "DECALS", g_bleeding_decals) } }
public plugin_natives() { set_module_filter("module_filter") set_native_filter("native_filter") } public module_filter(const module[]) { if (equal(module, LIBRARY_NEMESIS) || equal(module, LIBRARY_ASSASSIN)) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; } public native_filter(const name[], index, trap) { if (!trap) return PLUGIN_HANDLED; return PLUGIN_CONTINUE; }
// Ham Player Killed Forward public fw_PlayerKilled(victim, attacker, shouldgib) { // Remove bleeding task remove_task(victim+TASK_BLOOD) }
public client_disconnect(id) { // Remove bleeding task remove_task(id+TASK_BLOOD) }
public message_setfov(msg_id, msg_dest, msg_entity) { if (!is_user_alive(msg_entity) || !zp_core_is_zombie(msg_entity) || get_msg_arg_int(1) != CS_DEFAULT_FOV) return; set_msg_arg_int(1, get_msg_argtype(1), get_pcvar_num(cvar_zombie_fov)) }
public zp_fw_core_infect_post(id, attacker) { // Set custom FOV? if (get_pcvar_num(cvar_zombie_fov) != CS_DEFAULT_FOV && get_pcvar_num(cvar_zombie_fov) != 0) { message_begin(MSG_ONE, g_MsgSetFOV, _, id) write_byte(get_pcvar_num(cvar_zombie_fov)) // angle message_end() } // Remove previous tasks remove_task(id+TASK_BLOOD) // Nemesis Class loaded? if (!LibraryExists(LIBRARY_NEMESIS, LibType_Library) || !zp_class_nemesis_get(id)) { // Set silent footsteps? if (get_pcvar_num(cvar_zombie_silent)) set_user_footsteps(id, 1) // Zombie bleeding? if (get_pcvar_num(cvar_zombie_bleeding)) set_task(0.7, "zombie_bleeding", id+TASK_BLOOD, _, _, "b") } // Assassin Class loaded? else if (!LibraryExists(LIBRARY_ASSASSIN, LibType_Library) || !zp_class_assassin_get(id)) { // Set silent footsteps? if (get_pcvar_num(cvar_zombie_silent)) set_user_footsteps(id, 1) // Zombie bleeding? if (get_pcvar_num(cvar_zombie_bleeding)) set_task(0.7, "zombie_bleeding", id+TASK_BLOOD, _, _, "b") } else { // Restore normal footsteps? if (get_pcvar_num(cvar_zombie_silent)) set_user_footsteps(id, 0) } }
public zp_fw_core_cure_post(id, attacker) { // Restore FOV? if (get_pcvar_num(cvar_zombie_fov) != CS_DEFAULT_FOV && get_pcvar_num(cvar_zombie_fov) != 0) { message_begin(MSG_ONE, g_MsgSetFOV, _, id) write_byte(CS_DEFAULT_FOV) // angle message_end() } // Restore normal footsteps? if (get_pcvar_num(cvar_zombie_silent)) set_user_footsteps(id, 0) // Remove bleeding task remove_task(id+TASK_BLOOD) }
// Make zombies leave footsteps and bloodstains on the floor public zombie_bleeding(taskid) { // Only bleed when moving on ground if (!(pev(ID_BLOOD, pev_flags) & FL_ONGROUND) || fm_get_speed(ID_BLOOD) < 80) return; // Get user origin static Float:originF[3] pev(ID_BLOOD, pev_origin, originF) // If ducking set a little lower if (pev(ID_BLOOD, pev_bInDuck)) originF[2] -= 18.0 else originF[2] -= 36.0 // Send the decal message message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_WORLDDECAL) // TE id engfunc(EngFunc_WriteCoord, originF[0]) // x engfunc(EngFunc_WriteCoord, originF[1]) // y engfunc(EngFunc_WriteCoord, originF[2]) // z write_byte(ArrayGetCell(g_bleeding_decals, random_num(0, ArraySize(g_bleeding_decals) - 1)) + (g_IsModCZ * 12)) // decal number (offsets +12 for CZ) message_end() }
// Get entity's speed (from fakemeta_util) stock fm_get_speed(entity) { static Float:velocity[3] pev(entity, pev_velocity, velocity) return floatround(vector_length(velocity)); }
|
|