public plugin_precache() { RegisterHam( Ham_Think, "grenade", "_FW_ThinkGrenade", 1 ) }
public zp_extra_item_selected( plr, itemid ) {
if( itemid == _ItemID ) { _MarkPlayerHasMask( plr ) Icon_On( plr ) ProtoChat(plr, "You bought a gas mask, so you can take better rips, i mean so you wount get infected by bombs and shit.") } }
Crossbow plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with HeadShot Detection; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--- Intro --- This is Crossbow from HL.It costs 25 Ammo packs(default).To attack press attack1 button, to use zoom press attack2.If you shoot while zooming crossbow just hit enemy/ wall, but if you are shooting without zoom bolt will explode and do more damage. You have 10 bolts in a clip and 25 in a back pack.
--- Credits --- NiHiLaNTh - Plugin VEN - Finding weapon entities Arkshine - Ham_Item_Deploy/getting fov/weapon animation/Ammo meTaLiCroSS - Weapon touch/Weapon drop after death Scorpieo - Alternative crossbow model
--- CVARs --- zp_crossbow_damage 175 Damage done by explosion zp_crossbow_damage2 300 Damage done by bolt zp_crossbow_radius 175 Explosion radius zp_crossbow_one_round 1 // 1 - one round; 0 - until player got infected/killed zp_crossbow_knockback 10 // Knockback power
--- Changelog --- v1.0 - First release v1.1 - Fixed bug where ammo was not updated correctly - Optimized bolt flight - Fixed crap runtime error v1.2 - Fixed some little bugs(ammo on zooming was not updated) v1.3 - Fixed bug with drop v1.4 - Fixed bug where player could reload infinite times - Fixed bug with score info - Added knockback from explosion v1.5 - Fixed bug where player were damaged and knockbacked, even he were not in radius - Fixed bug where player with godmode still could get damage - Fixed bug where player could reload with full clip - Fixed bug where player couldn't purchase crossbow after using antidote - Added bleed stuff - Added alternative model - Fixed bug where player could shoot while reloading v1.6 - Improved damage calculation system for exploding bolt - Added CVAR for crossbow one-round-only keeping - Improved damage detection system for normal bolt - Fixed bug with crossbow drop after death - Some minor optimizations/changes v1.7 - Added knockback CVAR - Improved knockback from explosion - Fixed bug with score info - Optimized code a bit
Any suggestions/improvements are welcome!!!
If you find any bug - report it on Crossbow thread, which can be found here http://forums.alliedmods.net/showthread.php?t=101379
// Uncomment following if you want to see alternative model //#define ALTERNATIVE_MODEL
// Plugin info new const PLUGIN[] = "[ZP] Extra Item: Crossbow" new const VERSION[] = "1.7" new const AUTHOR[] = "NiHiLaNTh"
// Crossbow/Bolt models #if defined ALTERNATIVE_MODEL new const P_MODEL[] = "models/p_crossbow_alt.mdl" new const V_MODEL[] = "models/v_crossbow_alt.mdl" new const W_MODEL[] = "models/w_crossbow_alt.mdl" #else new const P_MODEL[] = "models/p_crossbow.mdl" new const V_MODEL[] = "models/v_crossbow.mdl" new const W_MODEL[] = "models/w_crossbow.mdl" #endif new const BOLT_MODEL[] = "models/crossbow_bolt.mdl"
// Some sounds new const XBOW_SHOOT[] = "weapons/xbow_fire1.wav" new const XBOW_HITWALL[] = "weapons/xbow_hit1.wav" new const XBOW_HITSTAB[] = "weapons/xbow_hitbod1.wav" new const XBOW_RELOAD[] = "weapons/xbow_reload1.wav"
// Sprites new const EXPLO_SPRITE[] = "sprites/zerogxplode.spr" new const BLOOD_SPRITE[] = "sprites/blood.spr" new const BLOODSPRAY_SPRITE[] = "sprites/bloodspray.spr"
// Cached sprite indexes new sExplo, sBlood, sBlood2
// CVAR pointers new pDamage, pDamage2, pRadius, pOneRound, pKnockback
// Item ID new g_crossbow
// Player variables new g_hasXbow[33] // whether player has Crossbow new Float:g_last_shot_time[33] // Last time Crossbow used new g_FullClip[33] // whether player has Full Clip new g_bInReload[33]
// Max players new g_maxplayers
// Global vars new g_restarted
// Message ID's new g_msgCurWeapon, g_msgAmmoX, g_msgScoreInfo
// When client connected, he cant have our weapon public client_connect(id) { g_hasXbow[id] = false g_FullClip[id] = false g_bInReload[id] = false }
// Someone wants to buy our extra item public zp_extra_item_selected(id, itemid) { if (itemid == g_crossbow) { // Already have it if (g_hasXbow[id]) { // Warn player client_print(id, print_center, "Why you need 2 crossbows? you already got 1.") return ZP_PLUGIN_HANDLED } // Otherwise you can buy it else { // Notice client_print(id, print_chat, "[Crossbow] Good luck to zombies. Have fun trying to get to you xD, you bought a crossbow")
// Drop primary weapons if have if (cs_get_user_hasprim(id)) engclient_cmd(id, "drop")
// Give him awp give_item(id, "weapon_awp")
// Get weapon id new weapon_id = find_ent_by_owner(-1, "weapon_awp", id)
if (weapon_id) { // Set clip ammo cs_set_weapon_ammo(weapon_id, 10) }
// Set bp ammo cs_set_user_bpammo(id, CSW_AWP, 50)
// Target who have our weapon was infected - reset vars public zp_user_infected_post(id, infector, nemesis) { if (g_hasXbow[id]) { g_hasXbow[id] = false g_FullClip[id] = false g_bInReload[id] = false UpdateHud(id)
UpdateScore(infector, id, 0, 0, 1)
// Bugfix touch_fix(id) } }
// New round started public Event_NewRound() { if (g_restarted) { // Strip from Crossnow if game have been restarted for (new i = 1; i <= get_maxplayers(); i++) { if (g_hasXbow[i]) { g_hasXbow[i] = false g_FullClip[i] = false g_bInReload[i] = false } } g_restarted = false } }
// Restart public Event_GameRestart() { g_restarted = true }
// Remove any dropped crossbows public LogEvent_RoundEnd() { if (get_pcvar_num(pOneRound) == 1) { for (new i = 1; i < g_maxplayers; i++) { fm_strip_user_gun(i, CSW_AWP) g_hasXbow[i] = false } }
// Find and remove all dropped crossbows new ent = find_ent_by_class(-1, "drop_crossbow") if (ent) remove_entity(ent) }
// Called when player start a command(shoot, jump etc.) public fw_CmdStart(id, uc_handle, seed) { // Ignore dead zombies/nemesis/those who haven't our weapons if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !g_hasXbow[id]) return FMRES_IGNORED
// Get amo, clip, and weapon new ammo, clip, weapon = get_user_weapon(id, clip, ammo)
// Not AWP if (weapon != CSW_AWP) return FMRES_IGNORED
// Buttons new buttons = get_uc(uc_handle, UC_Buttons)
new ent = find_ent_by_owner(-1, "weapon_awp", id)
// Attack1 button was pressed if (buttons & IN_ATTACK) { // We have enough ammo if (clip>= 1 && !g_bInReload[id]) { // Next shot time has come if (get_gametime() - g_last_shot_time[id] > 2.0) { // Get FOV(Arkshine) new fov; fov = pev(id, pev_fov)
// Default FOV if (fov == 90) { FireCrossbow(id, 0) } // Is zooming? else FireCrossbow(id, 1)
g_FullClip[id] = false
// Decrease ammo cs_set_weapon_ammo(ent, cs_get_weapon_ammo(get_pdata_cbase(id, 373)) - 1)
// Update HUD UpdateHud(id)
// Remember last shot time g_last_shot_time[id] = get_gametime() } } // If out of ammo else if (clip <= 1 || ammo <= 1) { // Play empty sound emit_sound(id, CHAN_WEAPON, "weapons/357_cock1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) }
// Remove attack button from their buttons mask buttons &= ~IN_ATTACK set_uc(uc_handle, UC_Buttons, buttons) }
// Attack2 button was pressed if (buttons & IN_ATTACK2) { // Update HUD(bugfix) UpdateHud(id) }
return FMRES_HANDLED }
// Usually called after player dropped weapons public fw_SetModel(ent, const model[]) { // Prevent invalid entity messages if (!pev_valid(ent)) return FMRES_IGNORED
// Not required model if(!equali(model, "models/w_awp.mdl")) return FMRES_IGNORED
// Get owner and classname new owner = pev(ent, pev_owner) new classname[33]; pev(ent, pev_classname, classname, charsmax(classname))
// Entity classname is a weaponbox if(equal(classname, "weaponbox")) { // The weapon owner has a crossbow if(g_hasXbow[owner]) { // Strip from crossbow g_hasXbow[owner] = false
// Set world model engfunc(EngFunc_SetModel, ent, W_MODEL)
// Update HUD UpdateHud(owner)
// Touch fix set_task(0.1, "touch_fix", owner)
return FMRES_SUPERCEDE } }
return FMRES_IGNORED
}
// Called when player is holding this weapon public fw_CrossbowDeploy(iEnt) { // Get ID new id = get_pdata_cbase(iEnt, 41, 5)
if (is_user_alive(id) && g_hasXbow[id]) { // Change models ChangeModels(id)
// Play animation UTIL_PlayWeaponAnimation(id, crossbow_draw1)
// Update HUD UpdateHud(id)
g_bInReload[id] = false
// Start to reload if clip less than 0(bugfix) new awpclip = get_pdata_int(iEnt, 51, 5) if (awpclip <= 0) fw_WeaponReload(iEnt) } }
// Update client data public fw_UpdateClientData_Post(id, sw, cd_handle) { // Ignore dead zombies/nemesis/those who haven't our weapons if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !g_hasXbow[id]) return FMRES_IGNORED
// Get ammo, clip and weapon new ammo, clip, weapon = get_user_weapon(id, clip, ammo)
// Not AWP if (weapon != CSW_AWP) return FMRES_IGNORED
// Fire crossbow public FireCrossbow(id, type) { // Play animation UTIL_PlayWeaponAnimation(id, crossbow_fire1)
// Get origin, angle, and velocity new Float:fOrigin[3], Float:fAngle[3], Float:fVelocity[3] pev(id, pev_origin, fOrigin) pev(id, pev_v_angle, fAngle)
// New ent new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
// Not ent if (!ent) return PLUGIN_HANDLED
// If player shot while zooming... if (type == 1) { // Set classnames entity_set_string(ent, EV_SZ_classname, "xbow_bolt") } else { entity_set_string(ent, EV_SZ_classname, "xbow_bolt_xplode") }
// Set bolt model entity_set_model(ent, BOLT_MODEL)
// Size new Float:mins[3] = {-1.0, -1.0, -1.0} new Float:maxs[3] = {1.0, 1.0, 1.0} entity_set_size(ent, mins, maxs)
// Play sound emit_sound(id, CHAN_WEAPON, XBOW_SHOOT, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_CONTINUE }
// Normal bolt touched something public bolt_touch(bolt, ent) { // Invalid ent if (!pev_valid(bolt)) { //client_print(0, print_chat, "Error! Invalid entity %d! You are getting banned! joke xD dont shit yourself bro.", bolt) return }
// GEt owner and classname new owner = pev(bolt, pev_owner); new classname[32]; pev(ent, pev_classname, classname, 31)
// Get it's origin new Float:originF[3], aimvec[3], tid, body pev(bolt, pev_origin, originF) get_user_origin(owner, aimvec, 3) get_user_aiming(owner, tid, body)
if (equal(classname, "player")) { // Alive... if (is_user_alive(tid) == 1 && get_user_godmode(tid) == 0) { // Zombie/Nemesis if (zp_get_user_zombie(tid) || zp_get_user_nemesis(tid)) { // Get origina and distance new Float:VictimOrigin[3] pev(tid, pev_origin, VictimOrigin)
// We hit them emit_sound(tid, CHAN_WEAPON, XBOW_HITSTAB, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
// Do fake damage fakedamage(tid, "crossbow", 0.0, DMG_PARALYZE)
// Health/Damage new health = get_user_health(tid) new damage = get_pcvar_num(pDamage2)
if (health - damage >= 1) { set_user_health(tid, health - damage)
// Get health/dmg/damage ratio new Float:dratio, damage dratio = floatdiv(float(distance),float(get_pcvar_num(pRadius))) damage = get_pcvar_num(pDamage) - floatround(floatmul(float(get_pcvar_num(pDamage)), dratio)) new health = get_user_health(i)
// Make some knockback new Float:knockback = get_pcvar_float(pKnockback) make_knockback(i, originV, knockback*damage)
if (health - damage >= 1) { set_user_health(i, health - damage)
// Update HUD(Arkshine) stock UpdateHud(Player) { // This set clip ammo message_begin(MSG_ONE_UNRELIABLE, g_msgCurWeapon, .player = Player); write_byte(true); write_byte(CSW_AWP); write_byte(cs_get_weapon_ammo(get_pdata_cbase(Player, 373))) message_end()
// This set BP ammo message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoX, .player = Player); write_byte(CSW_AWP); write_byte(cs_get_user_bpammo(Player, CSW_AWP)); message_end(); }
// Allowed toucher stock allowed_toucher(player) { // Already has it if (g_hasXbow[player] || zp_get_user_zombie(player) || zp_get_user_nemesis(player)) return false
return true }
// From WeaponMod stock make_knockback(victim, Float:origin[3], Float:maxspeed) { // Get and set velocity new Float:fVelocity[3]; kickback(victim, origin, maxspeed, fVelocity) entity_set_vector(victim, EV_VEC_velocity, fVelocity);
return (1); }
// Blood!!! stock ShowSomeBlood(const Float:origin[3]) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BLOODSPRITE) // Spr ID write_coord(floatround(origin[0]+random_num(-20,20))) // Positions X... write_coord(floatround(origin[1]+random_num(-20,20))) // Y write_coord(floatround(origin[2]+random_num(-20,20))) // Z write_short(sBlood) // write_short(sBlood2) write_byte(248) // Color write_byte(5) // Amount message_end() }
// Remove reloading public no_reload(id) { if (g_bInReload[id]) g_bInReload[id] = false }
// From fakemeta_util.inc(VEN) stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") { if (!is_user_alive(index) || !is_user_connected(index)) return false
new ent_class[32]; if (!wid && wname[0]) copy(ent_class, sizeof ent_class - 1, wname); else { new weapon = wid, clip, ammo; if (!weapon && !(weapon = get_user_weapon(index, clip, ammo))) return false;
public plugin_precache() { RegisterHam( Ham_Think, "grenade", "_FW_ThinkGrenade", 1 ) }
public zp_extra_item_selected( plr, itemid ) {
if( itemid == _ItemID ) { _MarkPlayerHasMask( plr ) Icon_On( plr ) ProtoChat(plr, "You bought a gas mask, so you can take better rips, i mean so you wount get infected by bombs and shit.") } }
Crossbow plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with HeadShot Detection; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--- Intro --- This is Crossbow from HL.It costs 25 Ammo packs(default).To attack press attack1 button, to use zoom press attack2.If you shoot while zooming crossbow just hit enemy/ wall, but if you are shooting without zoom bolt will explode and do more damage. You have 10 bolts in a clip and 25 in a back pack.
--- Credits --- NiHiLaNTh - Plugin VEN - Finding weapon entities Arkshine - Ham_Item_Deploy/getting fov/weapon animation/Ammo meTaLiCroSS - Weapon touch/Weapon drop after death Scorpieo - Alternative crossbow model
--- CVARs --- zp_crossbow_damage 175 Damage done by explosion zp_crossbow_damage2 300 Damage done by bolt zp_crossbow_radius 175 Explosion radius zp_crossbow_one_round 1 // 1 - one round; 0 - until player got infected/killed zp_crossbow_knockback 10 // Knockback power
--- Changelog --- v1.0 - First release v1.1 - Fixed bug where ammo was not updated correctly - Optimized bolt flight - Fixed crap runtime error v1.2 - Fixed some little bugs(ammo on zooming was not updated) v1.3 - Fixed bug with drop v1.4 - Fixed bug where player could reload infinite times - Fixed bug with score info - Added knockback from explosion v1.5 - Fixed bug where player were damaged and knockbacked, even he were not in radius - Fixed bug where player with godmode still could get damage - Fixed bug where player could reload with full clip - Fixed bug where player couldn't purchase crossbow after using antidote - Added bleed stuff - Added alternative model - Fixed bug where player could shoot while reloading v1.6 - Improved damage calculation system for exploding bolt - Added CVAR for crossbow one-round-only keeping - Improved damage detection system for normal bolt - Fixed bug with crossbow drop after death - Some minor optimizations/changes v1.7 - Added knockback CVAR - Improved knockback from explosion - Fixed bug with score info - Optimized code a bit
Any suggestions/improvements are welcome!!!
If you find any bug - report it on Crossbow thread, which can be found here http://forums.alliedmods.net/showthread.php?t=101379
// Uncomment following if you want to see alternative model //#define ALTERNATIVE_MODEL
// Plugin info new const PLUGIN[] = "[ZP] Extra Item: Crossbow" new const VERSION[] = "1.7" new const AUTHOR[] = "NiHiLaNTh"
// Crossbow/Bolt models #if defined ALTERNATIVE_MODEL new const P_MODEL[] = "models/p_crossbow_alt.mdl" new const V_MODEL[] = "models/v_crossbow_alt.mdl" new const W_MODEL[] = "models/w_crossbow_alt.mdl" #else new const P_MODEL[] = "models/p_crossbow.mdl" new const V_MODEL[] = "models/v_crossbow.mdl" new const W_MODEL[] = "models/w_crossbow.mdl" #endif new const BOLT_MODEL[] = "models/crossbow_bolt.mdl"
// Some sounds new const XBOW_SHOOT[] = "weapons/xbow_fire1.wav" new const XBOW_HITWALL[] = "weapons/xbow_hit1.wav" new const XBOW_HITSTAB[] = "weapons/xbow_hitbod1.wav" new const XBOW_RELOAD[] = "weapons/xbow_reload1.wav"
// Sprites new const EXPLO_SPRITE[] = "sprites/zerogxplode.spr" new const BLOOD_SPRITE[] = "sprites/blood.spr" new const BLOODSPRAY_SPRITE[] = "sprites/bloodspray.spr"
// Cached sprite indexes new sExplo, sBlood, sBlood2
// CVAR pointers new pDamage, pDamage2, pRadius, pOneRound, pKnockback
// Item ID new g_crossbow
// Player variables new g_hasXbow[33] // whether player has Crossbow new Float:g_last_shot_time[33] // Last time Crossbow used new g_FullClip[33] // whether player has Full Clip new g_bInReload[33]
// Max players new g_maxplayers
// Global vars new g_restarted
// Message ID's new g_msgCurWeapon, g_msgAmmoX, g_msgScoreInfo
// When client connected, he cant have our weapon public client_connect(id) { g_hasXbow[id] = false g_FullClip[id] = false g_bInReload[id] = false }
// Someone wants to buy our extra item public zp_extra_item_selected(id, itemid) { if (itemid == g_crossbow) { // Already have it if (g_hasXbow[id]) { // Warn player client_print(id, print_center, "Why you need 2 crossbows? you already got 1.") return ZP_PLUGIN_HANDLED } // Otherwise you can buy it else { // Notice client_print(id, print_chat, "[Crossbow] Good luck to zombies. Have fun trying to get to you xD, you bought a crossbow")
// Drop primary weapons if have if (cs_get_user_hasprim(id)) engclient_cmd(id, "drop")
// Give him awp give_item(id, "weapon_awp")
// Get weapon id new weapon_id = find_ent_by_owner(-1, "weapon_awp", id)
if (weapon_id) { // Set clip ammo cs_set_weapon_ammo(weapon_id, 10) }
// Set bp ammo cs_set_user_bpammo(id, CSW_AWP, 50)
// Target who have our weapon was infected - reset vars public zp_user_infected_post(id, infector, nemesis) { if (g_hasXbow[id]) { g_hasXbow[id] = false g_FullClip[id] = false g_bInReload[id] = false UpdateHud(id)
UpdateScore(infector, id, 0, 0, 1)
// Bugfix touch_fix(id) } }
// New round started public Event_NewRound() { if (g_restarted) { // Strip from Crossnow if game have been restarted for (new i = 1; i <= get_maxplayers(); i++) { if (g_hasXbow[i]) { g_hasXbow[i] = false g_FullClip[i] = false g_bInReload[i] = false } } g_restarted = false } }
// Restart public Event_GameRestart() { g_restarted = true }
// Remove any dropped crossbows public LogEvent_RoundEnd() { if (get_pcvar_num(pOneRound) == 1) { for (new i = 1; i < g_maxplayers; i++) { fm_strip_user_gun(i, CSW_AWP) g_hasXbow[i] = false } }
// Find and remove all dropped crossbows new ent = find_ent_by_class(-1, "drop_crossbow") if (ent) remove_entity(ent) }
// Called when player start a command(shoot, jump etc.) public fw_CmdStart(id, uc_handle, seed) { // Ignore dead zombies/nemesis/those who haven't our weapons if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !g_hasXbow[id]) return FMRES_IGNORED
// Get amo, clip, and weapon new ammo, clip, weapon = get_user_weapon(id, clip, ammo)
// Not AWP if (weapon != CSW_AWP) return FMRES_IGNORED
// Buttons new buttons = get_uc(uc_handle, UC_Buttons)
new ent = find_ent_by_owner(-1, "weapon_awp", id)
// Attack1 button was pressed if (buttons & IN_ATTACK) { // We have enough ammo if (clip>= 1 && !g_bInReload[id]) { // Next shot time has come if (get_gametime() - g_last_shot_time[id] > 2.0) { // Get FOV(Arkshine) new fov; fov = pev(id, pev_fov)
// Default FOV if (fov == 90) { FireCrossbow(id, 0) } // Is zooming? else FireCrossbow(id, 1)
g_FullClip[id] = false
// Decrease ammo cs_set_weapon_ammo(ent, cs_get_weapon_ammo(get_pdata_cbase(id, 373)) - 1)
// Update HUD UpdateHud(id)
// Remember last shot time g_last_shot_time[id] = get_gametime() } } // If out of ammo else if (clip <= 1 || ammo <= 1) { // Play empty sound emit_sound(id, CHAN_WEAPON, "weapons/357_cock1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) }
// Remove attack button from their buttons mask buttons &= ~IN_ATTACK set_uc(uc_handle, UC_Buttons, buttons) }
// Attack2 button was pressed if (buttons & IN_ATTACK2) { // Update HUD(bugfix) UpdateHud(id) }
return FMRES_HANDLED }
// Usually called after player dropped weapons public fw_SetModel(ent, const model[]) { // Prevent invalid entity messages if (!pev_valid(ent)) return FMRES_IGNORED
// Not required model if(!equali(model, "models/w_awp.mdl")) return FMRES_IGNORED
// Get owner and classname new owner = pev(ent, pev_owner) new classname[33]; pev(ent, pev_classname, classname, charsmax(classname))
// Entity classname is a weaponbox if(equal(classname, "weaponbox")) { // The weapon owner has a crossbow if(g_hasXbow[owner]) { // Strip from crossbow g_hasXbow[owner] = false
// Set world model engfunc(EngFunc_SetModel, ent, W_MODEL)
// Update HUD UpdateHud(owner)
// Touch fix set_task(0.1, "touch_fix", owner)
return FMRES_SUPERCEDE } }
return FMRES_IGNORED
}
// Called when player is holding this weapon public fw_CrossbowDeploy(iEnt) { // Get ID new id = get_pdata_cbase(iEnt, 41, 5)
if (is_user_alive(id) && g_hasXbow[id]) { // Change models ChangeModels(id)
// Play animation UTIL_PlayWeaponAnimation(id, crossbow_draw1)
// Update HUD UpdateHud(id)
g_bInReload[id] = false
// Start to reload if clip less than 0(bugfix) new awpclip = get_pdata_int(iEnt, 51, 5) if (awpclip <= 0) fw_WeaponReload(iEnt) } }
// Update client data public fw_UpdateClientData_Post(id, sw, cd_handle) { // Ignore dead zombies/nemesis/those who haven't our weapons if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !g_hasXbow[id]) return FMRES_IGNORED
// Get ammo, clip and weapon new ammo, clip, weapon = get_user_weapon(id, clip, ammo)
// Not AWP if (weapon != CSW_AWP) return FMRES_IGNORED
// Fire crossbow public FireCrossbow(id, type) { // Play animation UTIL_PlayWeaponAnimation(id, crossbow_fire1)
// Get origin, angle, and velocity new Float:fOrigin[3], Float:fAngle[3], Float:fVelocity[3] pev(id, pev_origin, fOrigin) pev(id, pev_v_angle, fAngle)
// New ent new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
// Not ent if (!ent) return PLUGIN_HANDLED
// If player shot while zooming... if (type == 1) { // Set classnames entity_set_string(ent, EV_SZ_classname, "xbow_bolt") } else { entity_set_string(ent, EV_SZ_classname, "xbow_bolt_xplode") }
// Set bolt model entity_set_model(ent, BOLT_MODEL)
// Size new Float:mins[3] = {-1.0, -1.0, -1.0} new Float:maxs[3] = {1.0, 1.0, 1.0} entity_set_size(ent, mins, maxs)
// Play sound emit_sound(id, CHAN_WEAPON, XBOW_SHOOT, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_CONTINUE }
// Normal bolt touched something public bolt_touch(bolt, ent) { // Invalid ent if (!pev_valid(bolt)) { //client_print(0, print_chat, "Error! Invalid entity %d! You are getting banned! joke xD dont shit yourself bro.", bolt) return }
// GEt owner and classname new owner = pev(bolt, pev_owner); new classname[32]; pev(ent, pev_classname, classname, 31)
// Get it's origin new Float:originF[3], aimvec[3], tid, body pev(bolt, pev_origin, originF) get_user_origin(owner, aimvec, 3) get_user_aiming(owner, tid, body)
if (equal(classname, "player")) { // Alive... if (is_user_alive(tid) == 1 && get_user_godmode(tid) == 0) { // Zombie/Nemesis if (zp_get_user_zombie(tid) || zp_get_user_nemesis(tid)) { // Get origina and distance new Float:VictimOrigin[3] pev(tid, pev_origin, VictimOrigin)
// We hit them emit_sound(tid, CHAN_WEAPON, XBOW_HITSTAB, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
// Do fake damage fakedamage(tid, "crossbow", 0.0, DMG_PARALYZE)
// Health/Damage new health = get_user_health(tid) new damage = get_pcvar_num(pDamage2)
if (health - damage >= 1) { set_user_health(tid, health - damage)
// Get health/dmg/damage ratio new Float:dratio, damage dratio = floatdiv(float(distance),float(get_pcvar_num(pRadius))) damage = get_pcvar_num(pDamage) - floatround(floatmul(float(get_pcvar_num(pDamage)), dratio)) new health = get_user_health(i)
// Make some knockback new Float:knockback = get_pcvar_float(pKnockback) make_knockback(i, originV, knockback*damage)
if (health - damage >= 1) { set_user_health(i, health - damage)
// Update HUD(Arkshine) stock UpdateHud(Player) { // This set clip ammo message_begin(MSG_ONE_UNRELIABLE, g_msgCurWeapon, .player = Player); write_byte(true); write_byte(CSW_AWP); write_byte(cs_get_weapon_ammo(get_pdata_cbase(Player, 373))) message_end()
// This set BP ammo message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoX, .player = Player); write_byte(CSW_AWP); write_byte(cs_get_user_bpammo(Player, CSW_AWP)); message_end(); }
// Allowed toucher stock allowed_toucher(player) { // Already has it if (g_hasXbow[player] || zp_get_user_zombie(player) || zp_get_user_nemesis(player)) return false
return true }
// From WeaponMod stock make_knockback(victim, Float:origin[3], Float:maxspeed) { // Get and set velocity new Float:fVelocity[3]; kickback(victim, origin, maxspeed, fVelocity) entity_set_vector(victim, EV_VEC_velocity, fVelocity);
return (1); }
// Blood!!! stock ShowSomeBlood(const Float:origin[3]) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BLOODSPRITE) // Spr ID write_coord(floatround(origin[0]+random_num(-20,20))) // Positions X... write_coord(floatround(origin[1]+random_num(-20,20))) // Y write_coord(floatround(origin[2]+random_num(-20,20))) // Z write_short(sBlood) // write_short(sBlood2) write_byte(248) // Color write_byte(5) // Amount message_end() }
// Remove reloading public no_reload(id) { if (g_bInReload[id]) g_bInReload[id] = false }
// From fakemeta_util.inc(VEN) stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") { if (!is_user_alive(index) || !is_user_connected(index)) return false
new ent_class[32]; if (!wid && wname[0]) copy(ent_class, sizeof ent_class - 1, wname); else { new weapon = wid, clip, ammo; if (!weapon && !(weapon = get_user_weapon(index, clip, ammo))) return false;
stock give_weapon(id, wpnID, ammo, bpammo) { new weapon[32] get_weaponname(wpnID, weapon, 31)
give_item(id, weapon) cs_set_weapon_ammo(fm_get_weapon_id(id, weapon), ammo); cs_set_user_bpammo(id, wpnID, cs_get_user_bpammo(id, wpnID) + bpammo) }*/ /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par } */
The jumper zombie only doesn't count the first 3 jumps, after first time you land it starts count straight away. But now there is no movement speed bugs I was getting from last one.
Thanks a lot, you are freaking quick I appreciate that, most of us do. You've put a lot of time in this forum, thanks from me and everyone else here.
Well I tested 11 with bots on that map and I didn't see that error, so maybe maybe. Tested 10 on my self, went zombie, threw infection bomb, quickly revived to human and bought gas mask, seemed to work. Had some crazy error where the gas mask went on zombie team, and I had an item from zombie team on human team, then showed some error with zp_extra_item or something along those lines in zombie_plague40, it was after going on that map. I fixed it by removing zombie item and re adding gas mask.
If you are talking about 40 jump zombie I wrote in last post, the same thing is happening.
public lightning5(id) { new xy[2] xy[0] = random_num(-2000,2200) xy[1] = random_num(-2000,2200) message_begin(MSG_BROADCAST,SVC_TEMPENTITY) write_byte(0) write_coord(xy[0]) // Start X write_coord(xy[1]) // Start Y write_coord(4000) // Start Z write_coord(xy[0]) // End X write_coord(xy[1]) // End Y write_coord(-2000) // End Z write_short(light) write_byte(1) // framestart write_byte(5) // framerate write_byte(2) // life write_byte(180) // width write_byte(70) // noise write_byte(0) // r, g, b write_byte(255) // r, g, b write_byte(0) // r, g, b write_byte(200) // brightness write_byte(200) // message_end()