#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#define VIPFLAG ADMIN_LEVEL_H
new g_iExtraArmor, g_iStartHealth, g_iStartArmor
// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4
new Float:g_damage[33]
// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }
new g_has_unlimited_clip[33], g_damage_reward
enum
{
SCOREATTRIB_ARG_PLAYERID = 1,
SCOREATTRIB_ARG_FLAGS
};
enum ( <<= 1 )
{
SCOREATTRIB_FLAG_NONE = 0,
SCOREATTRIB_FLAG_DEAD = 1,
SCOREATTRIB_FLAG_BOMB,
SCOREATTRIB_FLAG_VIP
};
new jumpnum[33] = 0
new bool:dojump[33] = false
public plugin_init()
{
register_plugin("Zombie - Omegle VIP", "0.1", "LegendofWarior")
RegisterHam(Ham_Spawn, "player", "OnPlayerSpawnPost", 1)
RegisterHam(Ham_Killed, "player", "OnPlayerKilled")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
g_iExtraArmor = register_cvar("vip_extra_armor", "50")
g_iStartHealth = register_cvar("vip_start_HP", "300")
g_iStartArmor = register_cvar("vip_start_armor", "200")
g_damage_reward = register_cvar("vip_damage_reward", "250")
register_cvar("vip_enable_jumps","1")
register_cvar("vip_maxjumps","2")
register_event("ResetHUD", "resetModel", "b")
register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" );
}
public plugin_precache() {
precache_model("models/player/vip/vip.mdl") //Prechache
precache_model("models/player/vipzm/vipzm.mdl") //Prechache
}
/*
=====================================
============MAIN CODE================
=====================================
*/
public OnPlayerSpawnPost(id)
{
if(is_user_alive(id) && !zp_get_user_zombie(id) && get_user_flags(id) & VIPFLAG)
{
set_pev(id, pev_health, get_pcvar_float(g_iStartHealth))
set_pev(id, pev_armorvalue, get_pcvar_float(g_iStartArmor))
}
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(get_user_flags(attacker) & VIPFLAG)
{
damage *= 2
SetHamParamFloat(4, damage)
}
if(get_user_flags(attacker) & VIPFLAG) {
if(get_pcvar_num(g_damage_reward) > 0) {
g_damage[attacker]+=damage
if(g_damage[attacker] > get_pcvar_float(g_damage_reward)) {
zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker)+1)
g_damage[attacker] -= get_pcvar_float(g_damage_reward)
}
}
}
}
public OnPlayerKilled(victim, attacker)
{
if(!is_user_alive(attacker) || victim == attacker)
return
if(!zp_get_user_zombie(attacker) && get_user_flags(attacker) & VIPFLAG)
{
set_pev(attacker, pev_armorvalue, pev(attacker, pev_armorvalue) + get_pcvar_float(g_iExtraArmor))
for (new id; id <= 32; id++) g_has_unlimited_clip[id] = true;
}
}
// Reset flags for all players on newround
public event_round_start()
{
for (new id; id <= 32; id++) g_has_unlimited_clip[id] = false;
}
public client_putinserver(id)
{
jumpnum[id] = 0
dojump[id] = false
}
public client_disconnect(id)
{
jumpnum[id] = 0
dojump[id] = false
}
// Unlimited clip code
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
// Player doesn't have the unlimited clip upgrade
if (!g_has_unlimited_clip[msg_entity])
return;
// Player not alive or not an active weapon
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
return;
static weapon, clip
weapon = get_msg_arg_int(2) // get weapon ID
clip = get_msg_arg_int(3) // get weapon clip
// Unlimited Clip Ammo
if (MAXCLIP[weapon] > 2) // skip grenades
{
set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
if (clip < 2) // refill when clip is nearly empty
{
// Get the weapon entity
static wname[32], weapon_ent
get_weaponname(weapon, wname, sizeof wname - 1)
weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
// Set max clip on weapon
fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
}
}
}
public MessageScoreAttrib( iMsgId, iDest, iReceiver )
{
new iPlayer = get_msg_arg_int( SCOREATTRIB_ARG_PLAYERID );
if( access( iPlayer, VIPFLAG ) )
{
set_msg_arg_int( SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP );
}
}
public resetModel(id, level, cid) {
if (get_user_flags(id) & VIPFLAG) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
cs_set_user_model(id, "vipzm") //VIP Zombie
}
else if(userTeam == CS_TEAM_CT) {
cs_set_user_model(id, "vip") //VIP Human
}
else {
cs_reset_user_model(id)
}
}
return PLUGIN_CONTINUE
}
public client_PreThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(get_cvar_num("vip_enable_jumps") && (!access(id,VIPFLAG))) return PLUGIN_CONTINUE
new nbut = get_user_button(id)
new obut = get_user_oldbutton(id)
if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
{
if(jumpnum[id] < get_cvar_num("vip_maxjumps"))
{
dojump[id] = true
jumpnum[id]++
return PLUGIN_CONTINUE
}
}
if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
jumpnum[id] = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(get_cvar_num("vip_enable_jumps") && (!access(id,VIPFLAG))) return PLUGIN_CONTINUE
if(dojump[id] == true)
{
new Float:velocity[3]
entity_get_vector(id,EV_VEC_velocity,velocity)
velocity[2] = random_float(265.0,285.0)
entity_set_vector(id,EV_VEC_velocity,velocity)
dojump[id] = false
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
/*
=====================================
============STOCKS===================
=====================================
*/
// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
return entity;
}
// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ fbidis\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ ltrpar\\ lang1049\\ f0\\ fs16 \n\\ par }
*/