// Settings defines [here it is a good place to modify some of the settings] // Maxplayers [the max players, change this if you don't have 32 players(Low memory usage)] #define MAXPLAYERS 32
// Energy regeneration multiply if user crouches #define ENERGY_CROUCH 1.2
// Critical border additive so that the plugin will not do the CRITICAL CRITCAL CRITICAL sound [Do not set this to 0.0 or dare!] #define CRITICAL_EXTRA_ADD 10.0
// HIT constant damage multi new const Float:vec_hit_multi[] = { 1.0, 4.0, 1.0, 1.25, 1.0, 1.0, 0.75, 0.75, 0.0 }
new wpn_v_model[CSW_P90 + 1][30] new wpn_v_shield_model[CSW_P90 + 1][50] new wpn_ms_icon[CSW_P90 + 1][14]
// Sounds new const sound_strengh[] = "zp_nanosuit/nanosuit_strength.wav" new const sound_online[] = "zp_nanosuit/nanosuit_allonline.wav" new const sound_armor[] = "zp_nanosuit/nanosuit_armor.wav" new const sound_speed[] = "zp_nanosuit/nanosuit_speed.wav" new const sound_cloak[] = "zp_nanosuit/nanosuit_cloak.wav" new const sound_energy[] = "zp_nanosuit/nanosuit_energy.wav" new const sound_menu[] = "zp_nanosuit/nanosuit_menu.wav" new const sound_strength_throw[] = "zp_nanosuit/nanosuit_strength_hit.wav" new const sound_switch_strength[] = "zp_nanosuit/nanosuit_strength_switch.wav" new const sound_switch_armor[] = "zp_nanosuit/nanosuit_armor_switch.wav" new const sound_switch_speed[] = "zp_nanosuit/nanosuit_speed_switch.wav" new const sound_switch_cloak[] = "zp_nanosuit/nanosuit_cloak_switch.wav" new const sound_speed_run[] = "zp_nanosuit/nanosuit_speed_run.wav"
new const sound_ric_metal1[] = "weapons/ric_metal-1.wav" new const sound_ric_metal2[] = "weapons/ric_metal-2.wav"
// We use this to check if the client said in console model leet for example, we see wether the model is T or not or else we do not set it new vec_model_ct[][] = { "gign", "gsg9", "sas", "urban", "vip" } new vec_model_t[][] = { "arctic", "terror", "leet", "guerilla" }
// Pcvars new pcv_nn_price new pcv_nn_ff new pcv_nn_death new pcv_nn_bot new pcv_nn_bot_buy new pcv_nn_team new pcv_nn_energy new pcv_nn_critical new pcv_nn_health new pcv_nn_buyzone new pcv_nn_regenerate new pcv_nn_night new pcv_nn_hp_charge new pcv_nn_ar_speed new pcv_nn_ar_damage new pcv_nn_st_stab new pcv_nn_st_throw new pcv_nn_st_rec_att new pcv_nn_st_g_throw new pcv_nn_st_rec_en new pcv_nn_st_can_th new pcv_nn_sp_maxim new pcv_nn_sp_ground new pcv_nn_sp_critic new pcv_nn_sp_energy new pcv_nn_sp_reload new pcv_nn_sp_fattack new pcv_nn_sp_fatshre new pcv_nn_cl_energy new pcv_nn_cl_fire new pcv_nn_cl_knife new pcv_nn_cl_grenade new pcv_nn_cl_c4 new pcv_zm_regive
new g_msgScreenFade
// Plugin info holders new glb_maxplayers new ShadowIdX:SHADOW_CREATE new bool:glb_use_new_models = true
// Client general info new cl_player_model[MAXPLAYERS + 1][32] // player's model name new bool:cl_update_model[MAXPLAYERS + 1] = {false, ...} new cl_nn_weapon[MAXPLAYERS + 1] new bool:cl_is_bot[MAXPLAYERS + 1] = {false, ...} new bool:cl_nn_lowres[MAXPLAYERS + 1] = {false, ...} new NanoStatus:cl_nn_has[MAXPLAYERS + 1] = {NANO_NO, ...} new NanoStatus:cl_nn_had[MAXPLAYERS + 1] = {NANO_NO, ...} new bool:cl_added_velocity[MAXPLAYERS + 1] = {false, ...} new bool:cl_removed_shadow[MAXPLAYERS + 1] = {false, ...} new bool:cl_nn_zombie[MAXPLAYERS + 1] = {false, ...}
// Nanosuit special info new NanoSpdMode:cl_nn_sp_status[MAXPLAYERS + 1] new NanoSpeed:cl_nn_speed[MAXPLAYERS + 1] new NanoSpeedScreen:cl_nn_scr_speed[MAXPLAYERS + 1] new NanoModes:cl_nn_mode[MAXPLAYERS + 1] = {NANO_ARMOR, ...} new Float:cl_nn_energy[MAXPLAYERS + 1] new bool:cl_nn_critical[MAXPLAYERS + 1] new bool:cl_nn_online[MAXPLAYERS + 1] new cl_nn_counter[MAXPLAYERS + 1] = {NANO_LOW_RES, ...} new cl_nn_block_recharge[MAXPLAYERS + 1] new KnifeState:cl_nn_st_knife[MAXPLAYERS + 1] = {KNIFE_NOT, ...} new cl_is_thrown[MAXPLAYERS + 1] = {0, ...} new Float:cl_nn_punch[MAXPLAYERS + 1][3] new bool:cl_nn_actual_shot[MAXPLAYERS + 1] = {false, ...} new cl_nn_shotgun_ammo[MAXPLAYERS + 1]
// Needs -> hud + menu + monitor + messages new nd_menu[MAXPLAYERS + 1] new nd_hud_sync new nd_ent_monitor new nd_msg_saytext new nd_msg_damage new nd_msg_iconstatus new nd_msg_shadowidx new nd_msg_ammox
if (!glb_use_new_models) { server_print("[NANO] No models found, not registering the model block forwards!") } else { server_print("[NANO] Models found, activating model block forwards!") register_forward(FM_SetClientKeyValue, "fw_setclientkey") register_event("TeamInfo","event_teaminfo","a") register_forward(FM_ClientUserInfoChanged, "fw_clientuserinfochanged") }
// Ham forwards (yummy) RegisterHam(Ham_CS_RoundRespawn,"player","fw_spawn",1) RegisterHam(Ham_Spawn,"player","fw_spawn",1) RegisterHam(Ham_Killed,"player","fw_killed") RegisterHam(Ham_Player_ResetMaxSpeed,"player","fw_resetmaxspeed",1)
new weapon_name[24]
// Register all weapons for special functions for (new i=CSW_P228;i<=CSW_P90;i++) { if (!(UNREGISTERED_WEAPONS_BITSUM & 1<<i) && get_weaponname(i, weapon_name, charsmax(weapon_name))) { RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_primary_attack") RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_primary_attack_post",1) RegisterHam(Ham_Weapon_SecondaryAttack, weapon_name, "fw_secondary_attack") RegisterHam(Ham_Weapon_SecondaryAttack, weapon_name, "fw_secondary_attack_post",1)
if (!(NO_RELOAD_WEAPONS_BITSUM & (1<<i))) { RegisterHam(Ham_Weapon_Reload, weapon_name, "fw_reload_post", 1) } else { if (i != CSW_KNIFE) { RegisterHam(Ham_Item_Deploy, weapon_name, "fw_shotgun_deploy", 1) RegisterHam(Ham_Weapon_Reload, weapon_name, "fw_special_reload_post", 1) } }
// In the previous function we didn't register the grenades wpn_ms_icon[CSW_HEGRENADE] = "d_grenade" wpn_ms_icon[CSW_FLASHBANG] = "d_grenade" wpn_ms_icon[CSW_SMOKEGRENADE] = "d_grenade"
// Global Stuff glb_maxplayers = global_get(glb_maxClients)
public plugin_init_delay(nr) { // Register the takedamage after 1 second to let the other plugins mess with the variables RegisterHam(Ham_TakeDamage, "player", "fw_takedamage") RegisterHam(Ham_TakeDamage, "player", "fw_takedamage_post", 1) RegisterHam(Ham_TraceAttack, "player", "fw_traceattack")
// Speed fix server_cmd("sv_maxspeed 99999.0") }
public client_putinserver(id) { if (is_user_bot(id)) cl_is_bot[id] = true
if (get_pcvar_num(pcv_nn_price) <= 0) { if (cl_is_bot[id] && get_pcvar_num(pcv_nn_bot)) cl_nn_has[id] = NANO_YES if (!cl_is_bot[id]) cl_nn_has[id] = NANO_YES } else cl_nn_has[id] = NANO_NO }
if (get_pcvar_num(pcv_nn_price) <= 0) { cl_nn_has[id] = NANO_YES nanosuit_reset(id, true)
return } else { if (get_pcvar_num(pcv_nn_team) != _:cs_get_user_team(id) && get_pcvar_num(pcv_nn_team) != 3) { client_print(id,print_center,"You team is not allowed to buy!") return }
if (get_pcvar_num(pcv_nn_buyzone) && !cs_get_user_buyzone(id)) { client_print(id,print_center,"%L",id,"NANO_BUYZONE") return }
public fw_setclientkey(id,const infobuffer[],const key[]) { // Block CS model changes if (cl_nn_has[id] == NANO_YES && equal(key, "model")) return FMRES_SUPERCEDE
return FMRES_IGNORED }
public fw_clientuserinfochanged(id) { if (!is_user_connected(id)) return FMRES_IGNORED
// Get current model new currentmodel[32] fm_get_user_model(id, currentmodel, charsmax(currentmodel))
// Check whether it matches the custom model - if not, set it again if (!equal(currentmodel, cl_player_model[id])) { if (cl_nn_has[id] == NANO_YES) { switch (cs_get_user_team(id)) { case CS_TEAM_CT: { for (new i=0;i<5;i++) { if (equali(currentmodel,vec_model_ct[i])) { cl_update_model[id] = true copy(cl_player_model[id], 31, currentmodel) return FMRES_SUPERCEDE } } } case CS_TEAM_T: { for (new i=0;i<4;i++) { if (equali(currentmodel,vec_model_t[i])) { cl_update_model[id] = true copy(cl_player_model[id], 31, currentmodel) return FMRES_SUPERCEDE } } } } } else { switch (cs_get_user_team(id)) { case CS_TEAM_CT: { for (new i=0;i<5;i++) { if (equali(currentmodel,vec_model_ct[i])) { fm_set_user_model(id,currentmodel) return FMRES_SUPERCEDE } }
fm_reset_user_model(id) } case CS_TEAM_T: { for (new i=0;i<4;i++) { if (equali(currentmodel,vec_model_t[i])) { fm_set_user_model(id,currentmodel) return FMRES_SUPERCEDE } }
if (cl_nn_mode[id] == NANO_CLOAK) { if (cl_nn_weapon[id] == CSW_KNIFE && get_pcvar_num(pcv_nn_cl_knife)) { set_nano_energy(id,0.0,DELAY_CLK_FORCED) return HAM_IGNORED } }
return HAM_IGNORED }
public fw_secondary_attack_post(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
if (cl_nn_has[id] == NANO_YES && cl_nn_mode[id] == NANO_SPEED && cl_nn_energy[id] >= get_pcvar_float(pcv_nn_critical)) { new Float:multi = 1.0 switch (cl_nn_weapon[id]) { case CSW_KNIFE: { multi = REFIRE_KNIFE new Float:mdelay mdelay = get_pdata_float( ent, OFFSET_WEAPON_NEXT_SEC_ATTACK, EXTRA_OFFSET_WEAPON_LINUX) * multi set_pdata_float( ent, OFFSET_WEAPON_NEXT_SEC_ATTACK, mdelay, EXTRA_OFFSET_WEAPON_LINUX) } } if (multi != 1.0) set_nano_energy(id, cl_nn_energy[id] - get_pcvar_float(pcv_nn_sp_fattack),DELAY_SPD_FAST_ATTACK)
new Float:delay delay = get_pdata_float( ent, OFFSET_WEAPON_NEXT_PRIMARY_ATTACK, EXTRA_OFFSET_WEAPON_LINUX) * multi set_pdata_float( ent, OFFSET_WEAPON_NEXT_PRIMARY_ATTACK, delay, EXTRA_OFFSET_WEAPON_LINUX) } return HAM_IGNORED }
public fw_shotgun_deploy(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX) cl_nn_shotgun_ammo[id] = cs_get_weapon_ammo(ent) }
public fw_special_reload_post(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
new wpn_id = cs_get_weapon_id(ent) new maxammo = wpn_max_clip[wpn_id] new curammo = cs_get_weapon_ammo(ent)
// Update hud weapon info, emessage to be blocked if needed emessage_begin(MSG_ONE, nd_msg_ammox, {0,0,0}, id) ewrite_byte(SH_AMMO_MSG_AMMOID) ewrite_byte(curammo + 1) emessage_end()
} }
return HAM_IGNORED
}
public fw_reload_post(ent) { if(get_pdata_int(ent, OFFSET_WEAPON_IN_RELOAD, EXTRA_OFFSET_WEAPON_LINUX)) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
public fw_killed(id,attacker,gib) { if (cl_nn_has[id] == NANO_YES) { msg_statusicon(id,ICON_REMOVE,NanoStatusIcon[cl_nn_mode[id]],NanoScreenColor[cl_nn_mode[id]]) #if defined USE_WEAPON_STATUSICONS msg_statusicon(id,ICON_REMOVE,wpn_ms_icon[cl_nn_weapon[id]],{0,255,0}) #endif }
if (cl_nn_st_knife[attacker] == KNIFE_FIRST_ATTACK) { new Float:origin[3], Float:origin2[3], Float:throw[3], Float:aimvel[3]
// Get the origin of attacker and victim pev(victim,pev_origin,origin) pev(attacker,pev_origin,origin2) velocity_by_aim(attacker,2,aimvel)
// We need to make a vector between them and we multiply it's value so we can make it powerfull xs_vec_sub(origin,origin2,throw) xs_vec_div_scalar(throw,xs_vec_len(throw),throw) xs_vec_add(throw,aimvel,throw) xs_vec_div_scalar(throw,xs_vec_len(throw),throw) throw[2] += 0.6 xs_vec_mul_scalar(throw,get_pcvar_float(pcv_nn_st_throw),throw)
// We add it to the velocity so we can make it a throw set_pev(victim,pev_velocity,throw)
// We block the speed of the player so he can't influence the direction of the throw (too much :P) set_user_maxspeed(victim, 1.0) cl_is_thrown[victim] = attacker set_pev(victim,pev_flags,pev(victim,pev_flags) & ~FL_ONGROUND) }
/* =================================================== [Screen think of all players] ==================================================== */ public fw_screenthink(ent) { if (!pev_valid(ent)) return FMRES_IGNORED
if (ent != nd_ent_monitor) return FMRES_IGNORED
new players[32], count, id new Float:energy energy = get_pcvar_float(pcv_nn_energy)
get_players(players, count, "ac")
for (new i=0;i<count;i++) { id = players[i]
if (cl_nn_has[id] == NANO_YES && ((cl_nn_lowres[id] && cl_nn_counter[id] == 0) || !cl_nn_lowres[id])) { // Current Mode static hud[200]
formatex(hud, 199, "%L",id,"NANO_MODE")
switch (cl_nn_mode[id]) { case NANO_STREN: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_ST_MODE") case NANO_ARMOR: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_A_MODE") case NANO_SPEED: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_S_MODE") case NANO_CLOAK: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_C_MODE") }
formatex(hud, 199, "%L",id,"NANO_ENERGY", hud, floatround(cl_nn_energy[id] / energy * 100))
for (new x = 0; x < floatround(cl_nn_energy[id] / energy * 20); x++) formatex(hud, 199, "%s|", hud)
if (!is_user_alive(id)) { return PLUGIN_CONTINUE }
new NanoModes:active = cl_nn_mode[id] new Float:energy = cl_nn_energy[id]
// Decrease when player is running in speed mode if (active == NANO_SPEED && pev(id,pev_flags) & ON_LAND_CONST) { new Float:multi
switch (cl_nn_sp_status[id]) { case SPEED_NORMAL: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 1.0 case SPD_FAST: multi = 1.0 }
energy -= (0.1) * multi } case SPEED_CRITICAL: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 0.0 case SPD_FAST: multi = 1.0 }
energy -= (0.2) * multi } case SPEED_MAXIMUM: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 0.0 case SPD_FAST: { multi = 1.0 client_cmd(id, "speak %s", sound_speed_run) } }
energy -= get_pcvar_float(pcv_nn_sp_energy) * multi } }
if (multi != 0.0) cl_nn_block_recharge[id] = DELAY_SPD_RUN + 1 }
// Decrease in cloak mode if (active == NANO_CLOAK) { static Float:multi = 1.0
switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.1 case SPD_VSLOW: multi = 0.2 case SPD_SLOW: multi = 0.5 case SPD_NORMAL: multi = 1.0 case SPD_FAST: multi = 1.4 }
energy -= get_pcvar_float(pcv_nn_cl_energy) * multi }
// Useful to block the moment when a player energy is bigger than the maximum energy energy = floatmin(get_pcvar_float(pcv_nn_energy), energy2)
if (energy > get_pcvar_float(pcv_nn_critical) + CRITICAL_EXTRA_ADD) cl_nn_critical[id] = false } // White if (cl_nn_has[id] == NANO_YES && cl_nn_mode[id] == NANO_CLOAK) { message_begin(MSG_ONE, g_msgScreenFade, _, id) write_short((1<<12)*2) // duration write_short(0) // hold time write_short(0x0000) // fade type write_byte(200) // r write_byte(200) // g write_byte(200) // b write_byte(70) // nvg Alpha message_end() }
if (cl_nn_block_recharge[id] > 0) cl_nn_block_recharge[id] -= 1
cl_nn_energy[id] = energy
return PLUGIN_CONTINUE }
/* =================================================== [Armor and HitPoints nano recharge] ==================================================== */ public nanosuit_ah_charge(id) { id -= TASK_AH_REC
cl_nn_sp_status[id] = SPEED_CRITICAL } if (0 >= cl_nn_energy[id]) { if (cl_nn_sp_status[id] == SPEED_MAXIMUM) { set_user_maxspeed(id,get_user_maxspeed(id) / get_pcvar_float(pcv_nn_sp_maxim)) } if (cl_nn_sp_status[id] == SPEED_CRITICAL) { set_user_maxspeed(id,get_user_maxspeed(id) / get_pcvar_float(pcv_nn_sp_critic)) }
cl_nn_sp_status[id] = SPEED_NORMAL }
return }
if (cl_nn_mode[id] == NANO_STREN) set_pev(id, pev_fuser2, 0.0)
if (!is_glowing_in_nano(id)) { set_nano_glow(id) }
return }
/* =================================================== [Bot think task, allows bots to use the nano functions] ==================================================== */ public nanosuit_bot_think(id) { id -= TASK_AI
if (!is_user_alive(id)) return PLUGIN_CONTINUE
if (!cl_is_bot[id]) { remove_task(id + TASK_AI) return PLUGIN_CONTINUE }
new Float:health pev(id,pev_health,health)
if (health < 60.0) { nanosuit_menu_choose(id,0,_:NANO_ARMOR) return PLUGIN_CONTINUE }
new hit = -1 new Float:origin[3] pev(id,pev_origin,origin) new Float:velocity[3] pev(id,pev_velocity,velocity) vector_length(velocity)
public zp_user_humanized_post(id, survivor) { if (!get_pcvar_num(pcv_zm_regive)) return PLUGIN_CONTINUE
if (cl_nn_had[id] == NANO_YES) { cl_nn_has[id] = NANO_YES nanosuit_reset(id) }
return PLUGIN_CONTINUE }
/* =================================================== [Functions that come in handy] ==================================================== */ set_nano_mode(id, NanoModes:mode, bool:announce = true) { if (cl_nn_mode[id] == mode) return
if (cl_nn_mode[id] == NANO_CLOAK) { #if defined REMOVE_VIEWMODEL_ON_CLOAK if (!cl_is_bot[id]) { if (cs_get_user_shield(id) && (WEAPONS_WITH_SHIELD_BITSUM & 1<<cl_nn_weapon[id])) { set_pev(id,pev_viewmodel2,wpn_v_shield_model[cl_nn_weapon[id]]) } else set_pev(id,pev_viewmodel2,wpn_v_model[cl_nn_weapon[id]]) } #endif #if defined USE_WEAPON_STATUSICONS msg_statusicon(id,ICON_REMOVE,wpn_ms_icon[cl_nn_weapon[id]],{0,0,0}) #endif
msg_shadowidx(id,SHADOW_CREATE) } if (mode == NANO_CLOAK) { msg_shadowidx(id,SHADOW_REMOVE) }
if (affect_user_properties) { if (!zp_get_user_zombie(id)) { cl_nn_energy[id] = get_pcvar_float(pcv_nn_energy) set_user_health(id, get_pcvar_num(pcv_nn_health)) if (get_pcvar_num(pcv_nn_night)) cs_set_user_nvg(id,1) }
if (cl_nn_mode[id] == NANO_SPEED) { switch (cl_nn_sp_status[id]) { case SPEED_MAXIMUM: set_user_maxspeed(id,get_user_maxspeed(id) * get_pcvar_float(pcv_nn_sp_maxim)) case SPEED_CRITICAL: set_user_maxspeed(id,get_user_maxspeed(id) * get_pcvar_float(pcv_nn_sp_critic)) } } }
if (task_exists(id + TASK_ENERGY)) remove_task(id + TASK_ENERGY)
if (task_exists(id + TASK_AH_REC)) remove_task(id + TASK_AH_REC)
if (task_exists(id + TASK_AI)) remove_task(id + TASK_AI)
public fm_set_user_model(player,const model[]) { // Set new model engfunc(EngFunc_SetClientKeyValue, player, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", model) } Or you are using other plugin for parachute?
Personal message only for paid request. If you love this forum, kindly to donate by clicking the donate button at the footer of this forum.
[Forget the parachute thing,its hard(also in case the request i write below cannot be done let me know so i change the request to something more easy)]
I just want separate energy regeneration time for speed mode , that means if i change mode to armor mode and energy goes 100% and then switch back to speed mode the energy not be 100% because speed mode will have its own regeneration time of energy.
Here is the code and also updated in fist post as fixed from error logs.
// Settings defines [here it is a good place to modify some of the settings] // Maxplayers [the max players, change this if you don't have 32 players(Low memory usage)] #define MAXPLAYERS 32
// Energy regeneration multiply if user crouches #define ENERGY_CROUCH 1.2
// Critical border additive so that the plugin will not do the CRITICAL CRITCAL CRITICAL sound [Do not set this to 0.0 or dare!] #define CRITICAL_EXTRA_ADD 10.0
// HIT constant damage multi new const Float:vec_hit_multi[] = { 1.0, 4.0, 1.0, 1.25, 1.0, 1.0, 0.75, 0.75, 0.0 }
new wpn_v_model[CSW_P90 + 1][30] new wpn_v_shield_model[CSW_P90 + 1][50] new wpn_ms_icon[CSW_P90 + 1][14]
// Sounds new const sound_strengh[] = "zp_nanosuit/nanosuit_strength.wav" new const sound_online[] = "zp_nanosuit/nanosuit_allonline.wav" new const sound_armor[] = "zp_nanosuit/nanosuit_armor.wav" new const sound_speed[] = "zp_nanosuit/nanosuit_speed.wav" new const sound_cloak[] = "zp_nanosuit/nanosuit_cloak.wav" new const sound_energy[] = "zp_nanosuit/nanosuit_energy.wav" new const sound_menu[] = "zp_nanosuit/nanosuit_menu.wav" new const sound_strength_throw[] = "zp_nanosuit/nanosuit_strength_hit.wav" new const sound_switch_strength[] = "zp_nanosuit/nanosuit_strength_switch.wav" new const sound_switch_armor[] = "zp_nanosuit/nanosuit_armor_switch.wav" new const sound_switch_speed[] = "zp_nanosuit/nanosuit_speed_switch.wav" new const sound_switch_cloak[] = "zp_nanosuit/nanosuit_cloak_switch.wav" new const sound_speed_run[] = "zp_nanosuit/nanosuit_speed_run.wav"
new const sound_ric_metal1[] = "weapons/ric_metal-1.wav" new const sound_ric_metal2[] = "weapons/ric_metal-2.wav"
// We use this to check if the client said in console model leet for example, we see wether the model is T or not or else we do not set it new vec_model_ct[][] = { "gign", "gsg9", "sas", "urban", "vip" } new vec_model_t[][] = { "arctic", "terror", "leet", "guerilla" }
// Pcvars new pcv_nn_price new pcv_nn_ff new pcv_nn_death new pcv_nn_bot new pcv_nn_bot_buy new pcv_nn_team new pcv_nn_energy new pcv_nn_critical new pcv_nn_health new pcv_nn_buyzone new pcv_nn_regenerate new pcv_nn_night new pcv_nn_hp_charge new pcv_nn_ar_speed new pcv_nn_ar_damage new pcv_nn_st_stab new pcv_nn_st_throw new pcv_nn_st_rec_att new pcv_nn_st_g_throw new pcv_nn_st_rec_en new pcv_nn_st_can_th new pcv_nn_sp_maxim new pcv_nn_sp_ground new pcv_nn_sp_critic new pcv_nn_sp_energy new pcv_nn_sp_reload new pcv_nn_sp_fattack new pcv_nn_sp_fatshre new pcv_nn_cl_energy new pcv_nn_cl_fire new pcv_nn_cl_knife new pcv_nn_cl_grenade new pcv_nn_cl_c4 new pcv_zm_regive
new g_msgScreenFade
// Plugin info holders new glb_maxplayers new ShadowIdX:SHADOW_CREATE new bool:glb_use_new_models = true
// Client general info new cl_player_model[MAXPLAYERS + 1][32] // player's model name new bool:cl_update_model[MAXPLAYERS + 1] = {false, ...} new cl_nn_weapon[MAXPLAYERS + 1] new bool:cl_is_bot[MAXPLAYERS + 1] = {false, ...} new bool:cl_nn_lowres[MAXPLAYERS + 1] = {false, ...} new NanoStatus:cl_nn_has[MAXPLAYERS + 1] = {NANO_NO, ...} new NanoStatus:cl_nn_had[MAXPLAYERS + 1] = {NANO_NO, ...} new bool:cl_added_velocity[MAXPLAYERS + 1] = {false, ...} new bool:cl_removed_shadow[MAXPLAYERS + 1] = {false, ...} new bool:cl_nn_zombie[MAXPLAYERS + 1] = {false, ...}
// Nanosuit special info new NanoSpdMode:cl_nn_sp_status[MAXPLAYERS + 1] new NanoSpeed:cl_nn_speed[MAXPLAYERS + 1] new NanoSpeedScreen:cl_nn_scr_speed[MAXPLAYERS + 1] new NanoModes:cl_nn_mode[MAXPLAYERS + 1] = {NANO_ARMOR, ...} new Float:cl_nn_energy[MAXPLAYERS + 1] new bool:cl_nn_critical[MAXPLAYERS + 1] new bool:cl_nn_online[MAXPLAYERS + 1] new cl_nn_counter[MAXPLAYERS + 1] = {NANO_LOW_RES, ...} new cl_nn_block_recharge[MAXPLAYERS + 1] new KnifeState:cl_nn_st_knife[MAXPLAYERS + 1] = {KNIFE_NOT, ...} new cl_is_thrown[MAXPLAYERS + 1] = {0, ...} new Float:cl_nn_punch[MAXPLAYERS + 1][3] new bool:cl_nn_actual_shot[MAXPLAYERS + 1] = {false, ...} new cl_nn_shotgun_ammo[MAXPLAYERS + 1]
// Needs -> hud + menu + monitor + messages new nd_menu[MAXPLAYERS + 1] new nd_hud_sync new nd_ent_monitor new nd_msg_saytext new nd_msg_damage new nd_msg_iconstatus new nd_msg_shadowidx new nd_msg_ammox
if (!glb_use_new_models) { server_print("[NANO] No models found, not registering the model block forwards!") } else { server_print("[NANO] Models found, activating model block forwards!") register_forward(FM_SetClientKeyValue, "fw_setclientkey") register_event("TeamInfo","event_teaminfo","a") register_forward(FM_ClientUserInfoChanged, "fw_clientuserinfochanged") }
// Ham forwards (yummy) RegisterHam(Ham_CS_RoundRespawn,"player","fw_spawn",1) RegisterHam(Ham_Spawn,"player","fw_spawn",1) RegisterHam(Ham_Killed,"player","fw_killed") RegisterHam(Ham_Player_ResetMaxSpeed,"player","fw_resetmaxspeed",1)
new weapon_name[24]
// Register all weapons for special functions for (new i=CSW_P228;i<=CSW_P90;i++) { if (!(UNREGISTERED_WEAPONS_BITSUM & 1<<i) && get_weaponname(i, weapon_name, charsmax(weapon_name))) { RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_primary_attack") RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_primary_attack_post",1) RegisterHam(Ham_Weapon_SecondaryAttack, weapon_name, "fw_secondary_attack") RegisterHam(Ham_Weapon_SecondaryAttack, weapon_name, "fw_secondary_attack_post",1)
if (!(NO_RELOAD_WEAPONS_BITSUM & (1<<i))) { RegisterHam(Ham_Weapon_Reload, weapon_name, "fw_reload_post", 1) } else { if (i != CSW_KNIFE) { RegisterHam(Ham_Item_Deploy, weapon_name, "fw_shotgun_deploy", 1) RegisterHam(Ham_Weapon_Reload, weapon_name, "fw_special_reload_post", 1) } }
// In the previous function we didn't register the grenades wpn_ms_icon[CSW_HEGRENADE] = "d_grenade" wpn_ms_icon[CSW_FLASHBANG] = "d_grenade" wpn_ms_icon[CSW_SMOKEGRENADE] = "d_grenade"
// Global Stuff glb_maxplayers = global_get(glb_maxClients)
public plugin_init_delay(nr) { // Register the takedamage after 1 second to let the other plugins mess with the variables RegisterHam(Ham_TakeDamage, "player", "fw_takedamage") RegisterHam(Ham_TakeDamage, "player", "fw_takedamage_post", 1) RegisterHam(Ham_TraceAttack, "player", "fw_traceattack")
// Speed fix server_cmd("sv_maxspeed 99999.0") }
public client_putinserver(id) { if (is_user_bot(id)) cl_is_bot[id] = true
if (get_pcvar_num(pcv_nn_price) <= 0) { if (cl_is_bot[id] && get_pcvar_num(pcv_nn_bot)) cl_nn_has[id] = NANO_YES if (!cl_is_bot[id]) cl_nn_has[id] = NANO_YES } else cl_nn_has[id] = NANO_NO }
if (get_pcvar_num(pcv_nn_price) <= 0) { cl_nn_has[id] = NANO_YES nanosuit_reset(id, true)
return } else { if (get_pcvar_num(pcv_nn_team) != _:cs_get_user_team(id) && get_pcvar_num(pcv_nn_team) != 3) { client_print(id,print_center,"You team is not allowed to buy!") return }
if (get_pcvar_num(pcv_nn_buyzone) && !cs_get_user_buyzone(id)) { client_print(id,print_center,"%L",id,"NANO_BUYZONE") return }
public fw_setclientkey(id,const infobuffer[],const key[]) { // Block CS model changes if (cl_nn_has[id] == NANO_YES && equal(key, "model")) return FMRES_SUPERCEDE
return FMRES_IGNORED }
public fw_clientuserinfochanged(id) { if (!is_user_connected(id)) return FMRES_IGNORED
// Get current model new currentmodel[32] fm_get_user_model(id, currentmodel, charsmax(currentmodel))
// Check whether it matches the custom model - if not, set it again if (!equal(currentmodel, cl_player_model[id])) { if (cl_nn_has[id] == NANO_YES) { switch (cs_get_user_team(id)) { case CS_TEAM_CT: { for (new i=0;i<5;i++) { if (equali(currentmodel,vec_model_ct[i])) { cl_update_model[id] = true copy(cl_player_model[id], 31, currentmodel) return FMRES_SUPERCEDE } } } case CS_TEAM_T: { for (new i=0;i<4;i++) { if (equali(currentmodel,vec_model_t[i])) { cl_update_model[id] = true copy(cl_player_model[id], 31, currentmodel) return FMRES_SUPERCEDE } } } } } else { switch (cs_get_user_team(id)) { case CS_TEAM_CT: { for (new i=0;i<5;i++) { if (equali(currentmodel,vec_model_ct[i])) { fm_set_user_model(id,currentmodel) return FMRES_SUPERCEDE } }
fm_reset_user_model(id) } case CS_TEAM_T: { for (new i=0;i<4;i++) { if (equali(currentmodel,vec_model_t[i])) { fm_set_user_model(id,currentmodel) return FMRES_SUPERCEDE } }
if (cl_nn_mode[id] == NANO_CLOAK) { if (cl_nn_weapon[id] == CSW_KNIFE && get_pcvar_num(pcv_nn_cl_knife)) { set_nano_energy(id,0.0,DELAY_CLK_FORCED) return HAM_IGNORED } }
return HAM_IGNORED }
public fw_secondary_attack_post(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
if (cl_nn_has[id] == NANO_YES && cl_nn_mode[id] == NANO_SPEED && cl_nn_energy[id] >= get_pcvar_float(pcv_nn_critical)) { new Float:multi = 1.0 switch (cl_nn_weapon[id]) { case CSW_KNIFE: { multi = REFIRE_KNIFE new Float:mdelay mdelay = get_pdata_float( ent, OFFSET_WEAPON_NEXT_SEC_ATTACK, EXTRA_OFFSET_WEAPON_LINUX) * multi set_pdata_float( ent, OFFSET_WEAPON_NEXT_SEC_ATTACK, mdelay, EXTRA_OFFSET_WEAPON_LINUX) } } if (multi != 1.0) set_nano_energy(id, cl_nn_energy[id] - get_pcvar_float(pcv_nn_sp_fattack),DELAY_SPD_FAST_ATTACK)
new Float:delay delay = get_pdata_float( ent, OFFSET_WEAPON_NEXT_PRIMARY_ATTACK, EXTRA_OFFSET_WEAPON_LINUX) * multi set_pdata_float( ent, OFFSET_WEAPON_NEXT_PRIMARY_ATTACK, delay, EXTRA_OFFSET_WEAPON_LINUX) } return HAM_IGNORED }
public fw_shotgun_deploy(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX) cl_nn_shotgun_ammo[id] = cs_get_weapon_ammo(ent) }
public fw_special_reload_post(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
new wpn_id = cs_get_weapon_id(ent) new maxammo = wpn_max_clip[wpn_id] new curammo = cs_get_weapon_ammo(ent)
// Update hud weapon info, emessage to be blocked if needed emessage_begin(MSG_ONE, nd_msg_ammox, {0,0,0}, id) ewrite_byte(SH_AMMO_MSG_AMMOID) ewrite_byte(curammo + 1) emessage_end()
} }
return HAM_IGNORED
}
public fw_reload_post(ent) { if(get_pdata_int(ent, OFFSET_WEAPON_IN_RELOAD, EXTRA_OFFSET_WEAPON_LINUX)) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
public fw_killed(id,attacker,gib) { if (cl_nn_has[id] == NANO_YES) { msg_statusicon(id,ICON_REMOVE,NanoStatusIcon[cl_nn_mode[id]],NanoScreenColor[cl_nn_mode[id]]) #if defined USE_WEAPON_STATUSICONS msg_statusicon(id,ICON_REMOVE,wpn_ms_icon[cl_nn_weapon[id]],{0,255,0}) #endif }
if (cl_nn_st_knife[attacker] == KNIFE_FIRST_ATTACK) { new Float:origin[3], Float:origin2[3], Float:throw[3], Float:aimvel[3]
// Get the origin of attacker and victim pev(victim,pev_origin,origin) pev(attacker,pev_origin,origin2) velocity_by_aim(attacker,2,aimvel)
// We need to make a vector between them and we multiply it's value so we can make it powerfull xs_vec_sub(origin,origin2,throw) xs_vec_div_scalar(throw,xs_vec_len(throw),throw) xs_vec_add(throw,aimvel,throw) xs_vec_div_scalar(throw,xs_vec_len(throw),throw) throw[2] += 0.6 xs_vec_mul_scalar(throw,get_pcvar_float(pcv_nn_st_throw),throw)
// We add it to the velocity so we can make it a throw set_pev(victim,pev_velocity,throw)
// We block the speed of the player so he can't influence the direction of the throw (too much :P) set_user_maxspeed(victim, 1.0) cl_is_thrown[victim] = attacker set_pev(victim,pev_flags,pev(victim,pev_flags) & ~FL_ONGROUND) }
/* =================================================== [Screen think of all players] ==================================================== */ public fw_screenthink(ent) { if (!pev_valid(ent)) return FMRES_IGNORED
if (ent != nd_ent_monitor) return FMRES_IGNORED
new players[32], count, id new Float:energy energy = get_pcvar_float(pcv_nn_energy)
get_players(players, count, "ac")
for (new i=0;i<count;i++) { id = players[i]
if (cl_nn_has[id] == NANO_YES && ((cl_nn_lowres[id] && cl_nn_counter[id] == 0) || !cl_nn_lowres[id])) { // Current Mode static hud[200]
formatex(hud, 199, "%L",id,"NANO_MODE")
switch (cl_nn_mode[id]) { case NANO_STREN: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_ST_MODE") case NANO_ARMOR: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_A_MODE") case NANO_SPEED: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_S_MODE") case NANO_CLOAK: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_C_MODE") }
formatex(hud, 199, "%L",id,"NANO_ENERGY", hud, floatround(cl_nn_energy[id] / energy * 100))
for (new x = 0; x < floatround(cl_nn_energy[id] / energy * 20); x++) formatex(hud, 199, "%s|", hud)
if (!is_user_alive(id)) { return PLUGIN_CONTINUE }
new NanoModes:active = cl_nn_mode[id] new Float:energy = cl_nn_energy[id]
// Decrease when player is running in speed mode if (active == NANO_SPEED && pev(id,pev_flags) & ON_LAND_CONST) { new Float:multi
switch (cl_nn_sp_status[id]) { case SPEED_NORMAL: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 1.0 case SPD_FAST: multi = 1.0 }
energy -= (0.1) * multi } case SPEED_CRITICAL: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 0.0 case SPD_FAST: multi = 1.0 }
energy -= (0.2) * multi } case SPEED_MAXIMUM: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 0.0 case SPD_FAST: { multi = 1.0 client_cmd(id, "speak %s", sound_speed_run) } }
energy -= get_pcvar_float(pcv_nn_sp_energy) * multi } }
if (multi != 0.0) cl_nn_block_recharge[id] = DELAY_SPD_RUN + 1 }
// Decrease in cloak mode if (active == NANO_CLOAK) { static Float:multi = 1.0
switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.1 case SPD_VSLOW: multi = 0.2 case SPD_SLOW: multi = 0.5 case SPD_NORMAL: multi = 1.0 case SPD_FAST: multi = 1.4 }
energy -= get_pcvar_float(pcv_nn_cl_energy) * multi }
// Useful to block the moment when a player energy is bigger than the maximum energy energy = floatmin(get_pcvar_float(pcv_nn_energy), energy2)
if (energy > get_pcvar_float(pcv_nn_critical) + CRITICAL_EXTRA_ADD) cl_nn_critical[id] = false } // White if (cl_nn_has[id] == NANO_YES && cl_nn_mode[id] == NANO_CLOAK) { message_begin(MSG_ONE, g_msgScreenFade, _, id) write_short((1<<12)*2) // duration write_short(0) // hold time write_short(0x0000) // fade type write_byte(200) // r write_byte(200) // g write_byte(200) // b write_byte(70) // nvg Alpha message_end() }
if (cl_nn_block_recharge[id] > 0) cl_nn_block_recharge[id] -= 1
cl_nn_energy[id] = energy
return PLUGIN_CONTINUE }
/* =================================================== [Armor and HitPoints nano recharge] ==================================================== */ public nanosuit_ah_charge(id) { id -= TASK_AH_REC
cl_nn_sp_status[id] = SPEED_CRITICAL } if (0 >= cl_nn_energy[id]) { if (cl_nn_sp_status[id] == SPEED_MAXIMUM) { set_user_maxspeed(id,get_user_maxspeed(id) / get_pcvar_float(pcv_nn_sp_maxim)) } if (cl_nn_sp_status[id] == SPEED_CRITICAL) { set_user_maxspeed(id,get_user_maxspeed(id) / get_pcvar_float(pcv_nn_sp_critic)) }
cl_nn_sp_status[id] = SPEED_NORMAL }
return }
if (cl_nn_mode[id] == NANO_STREN) set_pev(id, pev_fuser2, 0.0)
if (!is_glowing_in_nano(id)) { set_nano_glow(id) }
return }
/* =================================================== [Bot think task, allows bots to use the nano functions] ==================================================== */ public nanosuit_bot_think(id) { id -= TASK_AI
if (!is_user_alive(id)) return PLUGIN_CONTINUE
if (!cl_is_bot[id]) { remove_task(id + TASK_AI) return PLUGIN_CONTINUE }
new Float:health pev(id,pev_health,health)
if (health < 60.0) { nanosuit_menu_choose(id,0,_:NANO_ARMOR) return PLUGIN_CONTINUE }
new hit = -1 new Float:origin[3] pev(id,pev_origin,origin) new Float:velocity[3] pev(id,pev_velocity,velocity) vector_length(velocity)
public zp_user_humanized_post(id, survivor) { if (!get_pcvar_num(pcv_zm_regive)) return PLUGIN_CONTINUE
if (cl_nn_had[id] == NANO_YES) { cl_nn_has[id] = NANO_YES nanosuit_reset(id) }
return PLUGIN_CONTINUE }
/* =================================================== [Functions that come in handy] ==================================================== */ set_nano_mode(id, NanoModes:mode, bool:announce = true) { if (cl_nn_mode[id] == mode) return
if (cl_nn_mode[id] == NANO_CLOAK) { #if defined REMOVE_VIEWMODEL_ON_CLOAK if (!cl_is_bot[id]) { if (cs_get_user_shield(id) && (WEAPONS_WITH_SHIELD_BITSUM & 1<<cl_nn_weapon[id])) { set_pev(id,pev_viewmodel2,wpn_v_shield_model[cl_nn_weapon[id]]) } else set_pev(id,pev_viewmodel2,wpn_v_model[cl_nn_weapon[id]]) } #endif #if defined USE_WEAPON_STATUSICONS msg_statusicon(id,ICON_REMOVE,wpn_ms_icon[cl_nn_weapon[id]],{0,0,0}) #endif
msg_shadowidx(id,SHADOW_CREATE) } if (mode == NANO_CLOAK) { msg_shadowidx(id,SHADOW_REMOVE) }
if (affect_user_properties) { if (!zp_get_user_zombie(id)) { cl_nn_energy[id] = get_pcvar_float(pcv_nn_energy) set_user_health(id, get_pcvar_num(pcv_nn_health)) if (get_pcvar_num(pcv_nn_night)) cs_set_user_nvg(id,1) }
if (cl_nn_mode[id] == NANO_SPEED) { switch (cl_nn_sp_status[id]) { case SPEED_MAXIMUM: set_user_maxspeed(id,get_user_maxspeed(id) * get_pcvar_float(pcv_nn_sp_maxim)) case SPEED_CRITICAL: set_user_maxspeed(id,get_user_maxspeed(id) * get_pcvar_float(pcv_nn_sp_critic)) } } }
if (task_exists(id + TASK_ENERGY)) remove_task(id + TASK_ENERGY)
if (task_exists(id + TASK_AH_REC)) remove_task(id + TASK_AH_REC)
if (task_exists(id + TASK_AI)) remove_task(id + TASK_AI)
public fm_set_user_model(player,const model[]) { // Set new model engfunc(EngFunc_SetClientKeyValue, player, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", model) }
// Settings defines [here it is a good place to modify some of the settings] // Maxplayers [the max players, change this if you don't have 32 players(Low memory usage)] #define MAXPLAYERS 32
// Energy regeneration multiply if user crouches #define ENERGY_CROUCH 1.2
// Critical border additive so that the plugin will not do the CRITICAL CRITCAL CRITICAL sound [Do not set this to 0.0 or dare!] #define CRITICAL_EXTRA_ADD 10.0
// HIT constant damage multi new const Float:vec_hit_multi[] = { 1.0, 4.0, 1.0, 1.25, 1.0, 1.0, 0.75, 0.75, 0.0 }
new wpn_v_model[CSW_P90 + 1][30] new wpn_v_shield_model[CSW_P90 + 1][50] new wpn_ms_icon[CSW_P90 + 1][14]
// Sounds new const sound_strengh[] = "zp_nanosuit/nanosuit_strength.wav" new const sound_online[] = "zp_nanosuit/nanosuit_allonline.wav" new const sound_armor[] = "zp_nanosuit/nanosuit_armor.wav" new const sound_speed[] = "zp_nanosuit/nanosuit_speed.wav" new const sound_cloak[] = "zp_nanosuit/nanosuit_cloak.wav" new const sound_energy[] = "zp_nanosuit/nanosuit_energy.wav" new const sound_menu[] = "zp_nanosuit/nanosuit_menu.wav" new const sound_strength_throw[] = "zp_nanosuit/nanosuit_strength_hit.wav" new const sound_switch_strength[] = "zp_nanosuit/nanosuit_strength_switch.wav" new const sound_switch_armor[] = "zp_nanosuit/nanosuit_armor_switch.wav" new const sound_switch_speed[] = "zp_nanosuit/nanosuit_speed_switch.wav" new const sound_switch_cloak[] = "zp_nanosuit/nanosuit_cloak_switch.wav" new const sound_speed_run[] = "zp_nanosuit/nanosuit_speed_run.wav"
new const sound_ric_metal1[] = "weapons/ric_metal-1.wav" new const sound_ric_metal2[] = "weapons/ric_metal-2.wav"
// We use this to check if the client said in console model leet for example, we see wether the model is T or not or else we do not set it new vec_model_ct[][] = { "gign", "gsg9", "sas", "urban", "vip" } new vec_model_t[][] = { "arctic", "terror", "leet", "guerilla" }
// Pcvars new pcv_nn_price new pcv_nn_ff new pcv_nn_death new pcv_nn_bot new pcv_nn_bot_buy new pcv_nn_team new pcv_nn_energy new pcv_nn_critical new pcv_nn_health new pcv_nn_buyzone new pcv_nn_regenerate new pcv_nn_night new pcv_nn_hp_charge new pcv_nn_ar_speed new pcv_nn_ar_damage new pcv_nn_st_stab new pcv_nn_st_throw new pcv_nn_st_rec_att new pcv_nn_st_g_throw new pcv_nn_st_rec_en new pcv_nn_st_can_th new pcv_nn_sp_maxim new pcv_nn_sp_ground new pcv_nn_sp_critic new pcv_nn_sp_energy new pcv_nn_sp_reload new pcv_nn_sp_fattack new pcv_nn_sp_fatshre new pcv_nn_cl_energy new pcv_nn_cl_fire new pcv_nn_cl_knife new pcv_nn_cl_grenade new pcv_nn_cl_c4 new pcv_zm_regive
new g_msgScreenFade
// Plugin info holders new glb_maxplayers new ShadowIdX:SHADOW_CREATE new bool:glb_use_new_models = true
// Client general info new cl_player_model[MAXPLAYERS + 1][32] // player's model name new bool:cl_update_model[MAXPLAYERS + 1] = {false, ...} new cl_nn_weapon[MAXPLAYERS + 1] new bool:cl_is_bot[MAXPLAYERS + 1] = {false, ...} new bool:cl_nn_lowres[MAXPLAYERS + 1] = {false, ...} new NanoStatus:cl_nn_has[MAXPLAYERS + 1] = {NANO_NO, ...} new NanoStatus:cl_nn_had[MAXPLAYERS + 1] = {NANO_NO, ...} new bool:cl_added_velocity[MAXPLAYERS + 1] = {false, ...} new bool:cl_removed_shadow[MAXPLAYERS + 1] = {false, ...} new bool:cl_nn_zombie[MAXPLAYERS + 1] = {false, ...}
// Nanosuit special info new NanoSpdMode:cl_nn_sp_status[MAXPLAYERS + 1] new NanoSpeed:cl_nn_speed[MAXPLAYERS + 1] new NanoSpeedScreen:cl_nn_scr_speed[MAXPLAYERS + 1] new NanoModes:cl_nn_mode[MAXPLAYERS + 1] = {NANO_ARMOR, ...} new Float:cl_nn_energy[MAXPLAYERS + 1] new bool:cl_nn_critical[MAXPLAYERS + 1] new bool:cl_nn_online[MAXPLAYERS + 1] new cl_nn_counter[MAXPLAYERS + 1] = {NANO_LOW_RES, ...} new cl_nn_block_recharge[MAXPLAYERS + 1] new KnifeState:cl_nn_st_knife[MAXPLAYERS + 1] = {KNIFE_NOT, ...} new cl_is_thrown[MAXPLAYERS + 1] = {0, ...} new Float:cl_nn_punch[MAXPLAYERS + 1][3] new bool:cl_nn_actual_shot[MAXPLAYERS + 1] = {false, ...} new cl_nn_shotgun_ammo[MAXPLAYERS + 1]
// Needs -> hud + menu + monitor + messages new nd_menu[MAXPLAYERS + 1] new nd_hud_sync new nd_ent_monitor new nd_msg_saytext new nd_msg_damage new nd_msg_iconstatus new nd_msg_shadowidx new nd_msg_ammox
if (!glb_use_new_models) { server_print("[NANO] No models found, not registering the model block forwards!") } else { server_print("[NANO] Models found, activating model block forwards!") register_forward(FM_SetClientKeyValue, "fw_setclientkey") register_event("TeamInfo","event_teaminfo","a") register_forward(FM_ClientUserInfoChanged, "fw_clientuserinfochanged") }
// Ham forwards (yummy) RegisterHam(Ham_CS_RoundRespawn,"player","fw_spawn",1) RegisterHam(Ham_Spawn,"player","fw_spawn",1) RegisterHam(Ham_Killed,"player","fw_killed") RegisterHam(Ham_Player_ResetMaxSpeed,"player","fw_resetmaxspeed",1)
new weapon_name[24]
// Register all weapons for special functions for (new i=CSW_P228;i<=CSW_P90;i++) { if (!(UNREGISTERED_WEAPONS_BITSUM & 1<<i) && get_weaponname(i, weapon_name, charsmax(weapon_name))) { RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_primary_attack") RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_primary_attack_post",1) RegisterHam(Ham_Weapon_SecondaryAttack, weapon_name, "fw_secondary_attack") RegisterHam(Ham_Weapon_SecondaryAttack, weapon_name, "fw_secondary_attack_post",1)
if (!(NO_RELOAD_WEAPONS_BITSUM & (1<<i))) { RegisterHam(Ham_Weapon_Reload, weapon_name, "fw_reload_post", 1) } else { if (i != CSW_KNIFE) { RegisterHam(Ham_Item_Deploy, weapon_name, "fw_shotgun_deploy", 1) RegisterHam(Ham_Weapon_Reload, weapon_name, "fw_special_reload_post", 1) } }
// In the previous function we didn't register the grenades wpn_ms_icon[CSW_HEGRENADE] = "d_grenade" wpn_ms_icon[CSW_FLASHBANG] = "d_grenade" wpn_ms_icon[CSW_SMOKEGRENADE] = "d_grenade"
// Global Stuff glb_maxplayers = global_get(glb_maxClients)
public plugin_init_delay(nr) { // Register the takedamage after 1 second to let the other plugins mess with the variables RegisterHam(Ham_TakeDamage, "player", "fw_takedamage") RegisterHam(Ham_TakeDamage, "player", "fw_takedamage_post", 1) RegisterHam(Ham_TraceAttack, "player", "fw_traceattack")
// Speed fix server_cmd("sv_maxspeed 99999.0") }
public client_putinserver(id) { if (is_user_bot(id)) cl_is_bot[id] = true
if (get_pcvar_num(pcv_nn_price) <= 0) { if (cl_is_bot[id] && get_pcvar_num(pcv_nn_bot)) cl_nn_has[id] = NANO_YES if (!cl_is_bot[id]) cl_nn_has[id] = NANO_YES } else cl_nn_has[id] = NANO_NO }
if (get_pcvar_num(pcv_nn_price) <= 0) { cl_nn_has[id] = NANO_YES nanosuit_reset(id, true)
return } else { if (get_pcvar_num(pcv_nn_team) != _:cs_get_user_team(id) && get_pcvar_num(pcv_nn_team) != 3) { client_print(id,print_center,"You team is not allowed to buy!") return }
if (get_pcvar_num(pcv_nn_buyzone) && !cs_get_user_buyzone(id)) { client_print(id,print_center,"%L",id,"NANO_BUYZONE") return }
public fw_setclientkey(id,const infobuffer[],const key[]) { // Block CS model changes if (cl_nn_has[id] == NANO_YES && equal(key, "model")) return FMRES_SUPERCEDE
return FMRES_IGNORED }
public fw_clientuserinfochanged(id) { if (!is_user_connected(id)) return FMRES_IGNORED
// Get current model new currentmodel[32] fm_get_user_model(id, currentmodel, charsmax(currentmodel))
// Check whether it matches the custom model - if not, set it again if (!equal(currentmodel, cl_player_model[id])) { if (cl_nn_has[id] == NANO_YES) { switch (cs_get_user_team(id)) { case CS_TEAM_CT: { for (new i=0;i<5;i++) { if (equali(currentmodel,vec_model_ct[i])) { cl_update_model[id] = true copy(cl_player_model[id], 31, currentmodel) return FMRES_SUPERCEDE } } } case CS_TEAM_T: { for (new i=0;i<4;i++) { if (equali(currentmodel,vec_model_t[i])) { cl_update_model[id] = true copy(cl_player_model[id], 31, currentmodel) return FMRES_SUPERCEDE } } } } } else { switch (cs_get_user_team(id)) { case CS_TEAM_CT: { for (new i=0;i<5;i++) { if (equali(currentmodel,vec_model_ct[i])) { fm_set_user_model(id,currentmodel) return FMRES_SUPERCEDE } }
fm_reset_user_model(id) } case CS_TEAM_T: { for (new i=0;i<4;i++) { if (equali(currentmodel,vec_model_t[i])) { fm_set_user_model(id,currentmodel) return FMRES_SUPERCEDE } }
if (cl_nn_mode[id] == NANO_CLOAK) { if (cl_nn_weapon[id] == CSW_KNIFE && get_pcvar_num(pcv_nn_cl_knife)) { set_nano_energy(id,0.0,DELAY_CLK_FORCED) return HAM_IGNORED } }
return HAM_IGNORED }
public fw_secondary_attack_post(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
if (cl_nn_has[id] == NANO_YES && cl_nn_mode[id] == NANO_SPEED && cl_nn_energy[id] >= get_pcvar_float(pcv_nn_critical)) { new Float:multi = 1.0 switch (cl_nn_weapon[id]) { case CSW_KNIFE: { multi = REFIRE_KNIFE new Float:mdelay mdelay = get_pdata_float( ent, OFFSET_WEAPON_NEXT_SEC_ATTACK, EXTRA_OFFSET_WEAPON_LINUX) * multi set_pdata_float( ent, OFFSET_WEAPON_NEXT_SEC_ATTACK, mdelay, EXTRA_OFFSET_WEAPON_LINUX) } } if (multi != 1.0) set_nano_energy(id, cl_nn_energy[id] - get_pcvar_float(pcv_nn_sp_fattack),DELAY_SPD_FAST_ATTACK)
new Float:delay delay = get_pdata_float( ent, OFFSET_WEAPON_NEXT_PRIMARY_ATTACK, EXTRA_OFFSET_WEAPON_LINUX) * multi set_pdata_float( ent, OFFSET_WEAPON_NEXT_PRIMARY_ATTACK, delay, EXTRA_OFFSET_WEAPON_LINUX) } return HAM_IGNORED }
public fw_shotgun_deploy(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX) cl_nn_shotgun_ammo[id] = cs_get_weapon_ammo(ent) }
public fw_special_reload_post(ent) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
new wpn_id = cs_get_weapon_id(ent) new maxammo = wpn_max_clip[wpn_id] new curammo = cs_get_weapon_ammo(ent)
// Update hud weapon info, emessage to be blocked if needed emessage_begin(MSG_ONE, nd_msg_ammox, {0,0,0}, id) ewrite_byte(SH_AMMO_MSG_AMMOID) ewrite_byte(curammo + 1) emessage_end()
} }
return HAM_IGNORED
}
public fw_reload_post(ent) { if(get_pdata_int(ent, OFFSET_WEAPON_IN_RELOAD, EXTRA_OFFSET_WEAPON_LINUX)) { new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, EXTRA_OFFSET_WEAPON_LINUX)
public fw_killed(id,attacker,gib) { if (cl_nn_has[id] == NANO_YES) { msg_statusicon(id,ICON_REMOVE,NanoStatusIcon[cl_nn_mode[id]],NanoScreenColor[cl_nn_mode[id]]) #if defined USE_WEAPON_STATUSICONS msg_statusicon(id,ICON_REMOVE,wpn_ms_icon[cl_nn_weapon[id]],{0,255,0}) #endif }
if (cl_nn_st_knife[attacker] == KNIFE_FIRST_ATTACK) { new Float:origin[3], Float:origin2[3], Float:throw[3], Float:aimvel[3]
// Get the origin of attacker and victim pev(victim,pev_origin,origin) pev(attacker,pev_origin,origin2) velocity_by_aim(attacker,2,aimvel)
// We need to make a vector between them and we multiply it's value so we can make it powerfull xs_vec_sub(origin,origin2,throw) xs_vec_div_scalar(throw,xs_vec_len(throw),throw) xs_vec_add(throw,aimvel,throw) xs_vec_div_scalar(throw,xs_vec_len(throw),throw) throw[2] += 0.6 xs_vec_mul_scalar(throw,get_pcvar_float(pcv_nn_st_throw),throw)
// We add it to the velocity so we can make it a throw set_pev(victim,pev_velocity,throw)
// We block the speed of the player so he can't influence the direction of the throw (too much :P) set_user_maxspeed(victim, 1.0) cl_is_thrown[victim] = attacker set_pev(victim,pev_flags,pev(victim,pev_flags) & ~FL_ONGROUND) }
/* =================================================== [Screen think of all players] ==================================================== */ public fw_screenthink(ent) { if (!pev_valid(ent)) return FMRES_IGNORED
if (ent != nd_ent_monitor) return FMRES_IGNORED
new players[32], count, id new Float:energy energy = get_pcvar_float(pcv_nn_energy)
get_players(players, count, "ac")
for (new i=0;i<count;i++) { id = players[i]
if (cl_nn_has[id] == NANO_YES && ((cl_nn_lowres[id] && cl_nn_counter[id] == 0) || !cl_nn_lowres[id])) { // Current Mode static hud[200]
formatex(hud, 199, "%L",id,"NANO_MODE")
switch (cl_nn_mode[id]) { case NANO_STREN: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_ST_MODE") case NANO_ARMOR: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_A_MODE") case NANO_SPEED: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_S_MODE") case NANO_CLOAK: formatex(hud, 199, "%s %L ^n",hud,id,"NANO_C_MODE") }
formatex(hud, 199, "%L",id,"NANO_ENERGY", hud, floatround(cl_nn_energy[id] / energy * 100))
for (new x = 0; x < floatround(cl_nn_energy[id] / energy * 20); x++) formatex(hud, 199, "%s|", hud)
if (!is_user_alive(id)) { return PLUGIN_CONTINUE }
new NanoModes:active = cl_nn_mode[id] new Float:energy = cl_nn_energy[id]
// Decrease when player is running in speed mode if (active == NANO_SPEED && pev(id,pev_flags) & ON_LAND_CONST) { new Float:multi
switch (cl_nn_sp_status[id]) { case SPEED_NORMAL: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 1.0 case SPD_FAST: multi = 1.0 }
energy -= (0.1) * multi } case SPEED_CRITICAL: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 0.0 case SPD_FAST: multi = 1.0 }
energy -= (0.2) * multi } case SPEED_MAXIMUM: { switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.0 case SPD_VSLOW: multi = 0.0 case SPD_SLOW: multi = 0.0 case SPD_NORMAL: multi = 0.0 case SPD_FAST: { multi = 1.0 client_cmd(id, "speak %s", sound_speed_run) } }
energy -= get_pcvar_float(pcv_nn_sp_energy) * multi } }
if (multi != 0.0) cl_nn_block_recharge[id] = DELAY_SPD_RUN + 1 }
// Decrease in cloak mode if (active == NANO_CLOAK) { static Float:multi = 1.0
switch (cl_nn_speed[id]) { case SPD_STILL: multi = 0.1 case SPD_VSLOW: multi = 0.2 case SPD_SLOW: multi = 0.5 case SPD_NORMAL: multi = 1.0 case SPD_FAST: multi = 1.4 }
energy -= get_pcvar_float(pcv_nn_cl_energy) * multi }
// Useful to block the moment when a player energy is bigger than the maximum energy energy = floatmin(get_pcvar_float(pcv_nn_energy), energy2)
if (energy > get_pcvar_float(pcv_nn_critical) + CRITICAL_EXTRA_ADD) cl_nn_critical[id] = false } // White if (cl_nn_has[id] == NANO_YES && cl_nn_mode[id] == NANO_CLOAK) { message_begin(MSG_ONE, g_msgScreenFade, _, id) write_short((1<<12)*2) // duration write_short(0) // hold time write_short(0x0000) // fade type write_byte(200) // r write_byte(200) // g write_byte(200) // b write_byte(70) // nvg Alpha message_end() }
if (cl_nn_block_recharge[id] > 0) cl_nn_block_recharge[id] -= 1
cl_nn_energy[id] = energy
return PLUGIN_CONTINUE }
/* =================================================== [Armor and HitPoints nano recharge] ==================================================== */ public nanosuit_ah_charge(id) { id -= TASK_AH_REC
cl_nn_sp_status[id] = SPEED_CRITICAL } if (0 >= cl_nn_energy[id]) { if (cl_nn_sp_status[id] == SPEED_MAXIMUM) { set_user_maxspeed(id,get_user_maxspeed(id) / get_pcvar_float(pcv_nn_sp_maxim)) } if (cl_nn_sp_status[id] == SPEED_CRITICAL) { set_user_maxspeed(id,get_user_maxspeed(id) / get_pcvar_float(pcv_nn_sp_critic)) }
cl_nn_sp_status[id] = SPEED_NORMAL }
return }
if (cl_nn_mode[id] == NANO_STREN) set_pev(id, pev_fuser2, 0.0)
if (!is_glowing_in_nano(id)) { set_nano_glow(id) }
return }
/* =================================================== [Bot think task, allows bots to use the nano functions] ==================================================== */ public nanosuit_bot_think(id) { id -= TASK_AI
if (!is_user_alive(id)) return PLUGIN_CONTINUE
if (!cl_is_bot[id]) { remove_task(id + TASK_AI) return PLUGIN_CONTINUE }
new Float:health pev(id,pev_health,health)
if (health < 60.0) { nanosuit_menu_choose(id,0,_:NANO_ARMOR) return PLUGIN_CONTINUE }
new hit = -1 new Float:origin[3] pev(id,pev_origin,origin) new Float:velocity[3] pev(id,pev_velocity,velocity) vector_length(velocity)
public zp_user_humanized_post(id, survivor) { if (!get_pcvar_num(pcv_zm_regive)) return PLUGIN_CONTINUE
if (cl_nn_had[id] == NANO_YES) { cl_nn_has[id] = NANO_YES nanosuit_reset(id) }
return PLUGIN_CONTINUE }
/* =================================================== [Functions that come in handy] ==================================================== */ set_nano_mode(id, NanoModes:mode, bool:announce = true) { if (cl_nn_mode[id] == mode) return
if (cl_nn_mode[id] == NANO_CLOAK) { #if defined REMOVE_VIEWMODEL_ON_CLOAK if (!cl_is_bot[id]) { if (cs_get_user_shield(id) && (WEAPONS_WITH_SHIELD_BITSUM & 1<<cl_nn_weapon[id])) { set_pev(id,pev_viewmodel2,wpn_v_shield_model[cl_nn_weapon[id]]) } else set_pev(id,pev_viewmodel2,wpn_v_model[cl_nn_weapon[id]]) } #endif #if defined USE_WEAPON_STATUSICONS msg_statusicon(id,ICON_REMOVE,wpn_ms_icon[cl_nn_weapon[id]],{0,0,0}) #endif
msg_shadowidx(id,SHADOW_CREATE) } if (mode == NANO_CLOAK) { msg_shadowidx(id,SHADOW_REMOVE) }
if (affect_user_properties) { if (!zp_get_user_zombie(id)) { cl_nn_energy[id] = get_pcvar_float(pcv_nn_energy) set_user_health(id, get_pcvar_num(pcv_nn_health)) if (get_pcvar_num(pcv_nn_night)) cs_set_user_nvg(id,1) }
if (cl_nn_mode[id] == NANO_SPEED) { switch (cl_nn_sp_status[id]) { case SPEED_MAXIMUM: set_user_maxspeed(id,get_user_maxspeed(id) * get_pcvar_float(pcv_nn_sp_maxim)) case SPEED_CRITICAL: set_user_maxspeed(id,get_user_maxspeed(id) * get_pcvar_float(pcv_nn_sp_critic)) } } }
if (task_exists(id + TASK_ENERGY)) remove_task(id + TASK_ENERGY)
if (task_exists(id + TASK_AH_REC)) remove_task(id + TASK_AH_REC)
if (task_exists(id + TASK_AI)) remove_task(id + TASK_AI)
public fm_set_user_model(player,const model[]) { // Set new model engfunc(EngFunc_SetClientKeyValue, player, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", model) }
Personal message only for paid request. If you love this forum, kindly to donate by clicking the donate button at the footer of this forum.
There is no error logs , no error during compiling just the plugin is loaded and running but for a reason its not fuctionable i cant use anymode its like no kind of nanosuit plugin is installed.
[Enjoy the life , have fun and be as good as you can in your job's related activities and for sure the path for success is close].
Yes im using that one for parasute,but the nanosuit doesnt work at all. When i join to server i see that the nanosuit plugin is running but i dont see any modes it seems the plugin is running but not working.
[Enjoy the life , have fun and be as good as you can in your job's related activities and for sure the path for success is close].