i create plugin nemesis to more fun
not work
any one help me i try but not work
i make chance 1 to test when become nemesis work i change it to 10
Code: Select all
/*
I create plugin nemesis round to fun
to work nemesis you need add plugin ze_leap (ze_leap.amxx)
*/
/* -- Included -- */
#include <zombie_escape>
#include <cstrike>
#include <fun>
/* -- Definded -- */
#define PLAYERMODEL_MAX_LENGTH 32
#define MODEL_MAX_LENGTH 64
/* -- Variable Cvars -- */
new Cvar_Nemesis_Chance
new Cvar_Nemesis_Health
new Cvar_Nemesis_Gravity
new Cvar_Nemesis_Speed
new Cvar_Nemesis_Glow
new Cvar_Nemesis_Leap
new Cvar_Nemesis_Sound
new Cvar_Nemesis_HudInfo
new Cvar_Nemesis_Damage
/* -- Global Variable -- */
new g_MaxPlayers
/* -- Bool Variable -- */
new g_IsNemesis
/* -- Natives -- */
native ze_get_longjump(id)
native ze_remove_longjump(id)
/* -- Custom Model -- */
// Settings file
new const ZE_SETTING_FILE[] = "zombie_escape.ini"
/*-- Default models --*/
new const models_nemesis_player[][] = { "ze_nemesis_host" }
new const models_nemesis_claw[][] = { "models/zombie_escape/v_knife_nemesis.mdl" }
/* -- Array -- */
new Array:g_models_nemesis_player
new Array:g_models_nemesis_claw
/* -- Sound Nemesis -- */
new const Snd_Nemesis[] = "sound/zombie_escape/ze_nemesis.wav"
/* ------------------ */
public plugin_init()
{
register_plugin("[ZE] Nemesis Class", "1.0.0", AUTHORS)
// Other Cvar
register_clcmd("ze_nemesis_round", "ze_round_nemesis", _, "Round Nemesis", ADMIN_KICK)
// Ham Take Damage
RegisterHam( Ham_TakeDamage, "player", "TakeDamage" );
// Max Players
g_MaxPlayers = get_maxplayers()
// Cvars
Cvar_Nemesis_Chance = register_cvar("ze_nemesis_chance", "1")
Cvar_Nemesis_Health = register_cvar("ze_nemsis_health", "50000")
Cvar_Nemesis_Gravity = register_cvar("ze_nemesis_gravity", "650.0")
Cvar_Nemesis_Speed = register_cvar("ze_nemesis_speed", "1.6")
Cvar_Nemesis_Glow = register_cvar("ze_nemesis_glow", "1")
Cvar_Nemesis_Leap = register_cvar("ze_nemesis_leap", "1")
Cvar_Nemesis_Sound = register_cvar("ze_nemesis_sound", "1")
Cvar_Nemesis_HudInfo = register_cvar("ze_nemesis_hudinfo", "1")
Cvar_Nemesis_Damage = register_cvar("ze_nemesis_damage", "25.0")
// Precache Lang Text
register_dictionary("zombie_escape.txt")
}
/* -- Precache Files -- */
public plugin_precache()
{
// Initialize arrays
g_models_nemesis_player = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
g_models_nemesis_claw = ArrayCreate(MODEL_MAX_LENGTH, 1)
// Load from external file
amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_models_nemesis_player)
amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_models_nemesis_claw)
// If we couldn't load from file, use and save default ones
new index
if (ArraySize(g_models_nemesis_player) == 0)
{
for (index = 0; index < sizeof models_nemesis_player; index++)
ArrayPushString(g_models_nemesis_player, models_nemesis_player[index])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_models_nemesis_player)
}
if (ArraySize(g_models_nemesis_claw) == 0)
{
for (index = 0; index < sizeof models_nemesis_claw; index++)
ArrayPushString(g_models_nemesis_claw, models_nemesis_claw[index])
// Save to external file
amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_models_nemesis_claw)
}
// Precache models
new player_model[PLAYERMODEL_MAX_LENGTH], model[MODEL_MAX_LENGTH], model_path[128]
for (index = 0; index < ArraySize(g_models_nemesis_player); index++)
{
ArrayGetString(g_models_nemesis_player, index, player_model, charsmax(player_model))
formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
precache_model(model_path)
// Support modelT.mdl files
formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
if (file_exists(model_path)) precache_model(model_path)
}
for (index = 0; index < ArraySize(g_models_nemesis_claw); index++)
{
ArrayGetString(g_models_nemesis_claw, index, model, charsmax(model))
precache_model(model)
}
}
/* -- Register Natives -- */
public plugin_natives()
{
register_native("ze_is_user_nemesis", "_native_is_nemesis")
}
public _native_is_nemesis(id)
{
return g_IsNemesis
}
/* -- Player Disconnected Server -- */
public client_disconnected(id)
{
g_IsNemesis = false
}
/* -- Start Round Nemesis -- */
public ze_round_nemesis(id)
{
g_IsNemesis = false
return 1;
}
/* -- New Round -- */
public ze_newround(id)
{
if(random_num(1, (Cvar_Nemesis_Chance)) != 1)
{
g_IsNemesis = true
}
}
/* -- Zombie Choosed -- */
public ze_zombie_appear()
{
if(g_IsNemesis)
{
for(new id = 0;id < g_MaxPlayers;id++)
{
// start feature nemesis
nemesis_feature(id)
// start hud + sound nemesis
nemesis_message(id)
}
}
return 1;
}
/* -- Nemesis Features -- */
public nemesis_feature(id)
{
if(is_user_alive(id) && g_IsNemesis)
{
// Message notice log jump is active
if(get_pcvar_num(Cvar_Nemesis_Leap) == 1)
{
ze_colored_print(0, "You Have ^4Long Jump^1, ^3Crouch + Jump")
}
// Feature Nemesis [HP + Gravity + Speed ]
set_user_health(id, get_pcvar_num(Cvar_Nemesis_Health)) // Health
set_user_gravity(id, get_pcvar_float(Cvar_Nemesis_Gravity)) // Gravity
set_user_maxspeed(id, get_pcvar_float(Cvar_Nemesis_Speed)) // Speed
// Glow
if(get_pcvar_num(Cvar_Nemesis_Glow) == 1)
{
Set_Rendering(id, kRenderFxNone, 255, 0, 0, kRenderNormal, 15)
}
if(get_pcvar_num(Cvar_Nemesis_Leap) == 1)
{
ze_get_longjump(id)
}
}
set_model(id) // Set Model Nemesis
return 1;
}
/* -- Make Nemesis Killer -- */
public TakeDamage(iVictim, iInfector, iAttacker, Float:iDamage, iDamageBits )
{
if(iInfector == iAttacker && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && !g_IsNemesis == true)
{
SetHamParamFloat(4, iDamage * get_pcvar_float(Cvar_Nemesis_Damage))
return HAM_HANDLED;
}
return HAM_IGNORED;
}
/* -- Message Nemesis -- */
public nemesis_message(id)
{
if(get_pcvar_num(Cvar_Nemesis_Sound))
{
// Notice Sound
client_cmd(id, "spk %s", Snd_Nemesis)
}
if(get_pcvar_num(Cvar_Nemesis_HudInfo))
{
// Hud Message Nemesis
static NNemesis[64]
formatex(NNemesis, charsmax(NNemesis), "%L", LANG_PLAYER, "NOTICE_NEMESIS")
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.1, 1.5, false)
show_hudmessage(id, NNemesis)
// Chat Message Nemesis
static NNemesisChat[64]
formatex(NNemesisChat, charsmax(NNemesisChat), "%L", LANG_PLAYER, "NOTICE_NEMESIS_CHAT")
ze_colored_print(id, NNemesisChat)
}
return 1;
}
/* -- Set Nemesis Model -- */
public set_model(id)
{
if(g_IsNemesis)
{
// Apply nemesis player model
new player_model[PLAYERMODEL_MAX_LENGTH]
ArrayGetString(g_models_nemesis_player, random_num(0, ArraySize(g_models_nemesis_player) - 1), player_model, charsmax(player_model))
cs_set_user_model(id, player_model)
// Apply nemesis claw model
new model[MODEL_MAX_LENGTH]
ArrayGetString(g_models_nemesis_claw, random_num(0, ArraySize(g_models_nemesis_claw) - 1), model, charsmax(model))
cs_set_player_view_model(id, CSW_KNIFE, model)
}
}
/* -- Round Ended -- */
public ze_roundend(id)
{
Set_Rendering(id)
g_IsNemesis = false
ze_remove_longjump(id)
}
Code: Select all
#include <zombie_escape>
#define PLUGIN "[ZE] Extra Item:Leap"
#define VERSION "1.5.7"
#define AUTHOR "Fry!"
/*================================================================================
[Plugin Customization]
=================================================================================*/
new bool:g_hasLongJump[33],g_SayText
new Float:g_last_LongJump_time[33]
new g_LongJump_force, g_LongJump_height, g_LongJump_cooldown
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("ze_leap",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
g_LongJump_force = register_cvar("ze_longjump_force", "580")
g_LongJump_height = register_cvar("ze_longjump_height", "320")
g_LongJump_cooldown = register_cvar("ze_longjump_cooldown", "5.0")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
register_event("DeathMsg", "death", "a")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_SayText = get_user_msgid("SayText")
}
public plugin_natives()
{
register_native("ze_get_longjump","native_give_longjump",1)
register_native("ze_remove_longjump","native_remove_longjump",1)
}
public native_give_longjump(id)
{
if(ze_is_user_zombie(id))
{
g_hasLongJump[id] = true
}
else
{
g_hasLongJump[id] = false
}
}
public native_remove_longjump(id)
{
g_hasLongJump[id] = false
}
stock Color(const id, const input[], any:...)
{
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")
message_begin(MSG_ONE_UNRELIABLE, g_SayText, _, id)
write_byte(id)
write_string(msg)
message_end()
}
// Reset on disconnection
public client_disconnected(id)
{
g_hasLongJump[id] = false
}
// Reset on death
public death()
{
g_hasLongJump[read_data(2)] = false
}
// Reset if turned into human
public ze_user_humanized(id)
{
g_hasLongJump[id] = false
}
// Reset at round start (for everyone)
public event_round_start()
{
for (new i = 1; i <= 32; i++)
g_hasLongJump[i] = false
}
public fw_PlayerPreThink(id)
{
if (!is_user_alive(id))
return FMRES_IGNORED
if (allow_LongJump(id))
{
static Float:velocity[3]
velocity_by_aim(id, get_pcvar_num(g_LongJump_force), velocity)
velocity[2] = get_pcvar_float(g_LongJump_height)
set_pev(id, pev_velocity, velocity)
g_last_LongJump_time[id] = get_gametime()
}
return FMRES_IGNORED
}
// Check if the player can longjump
allow_LongJump(id)
{
if (!g_hasLongJump[id])
return false
if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
return false
static buttons
buttons = pev(id, pev_button)
if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
return false
if (get_gametime() - g_last_LongJump_time[id] < get_pcvar_float(g_LongJump_cooldown))
return false
if(g_last_LongJump_time[id] == get_pcvar_float(g_LongJump_cooldown))
{
client_print(id,print_chat,"[ZE] You can use the Leap Jump now.")
return true
}
return true
}
// 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))
}