[code]
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#pragma tabsize 0
#define is_user_vip(%1) (get_user_flags(%1) & ADMIN_LEVEL_H)
new const PLUGIN_NAME[] = "[RS] VIP System",
PLUGIN_VERSION[] = "1.0",
PLUGIN_AUTHOR[] = "YONTU";
// Hack to be able to use Ham_Player_ResetMaxSpeed (by joaquimandrade)
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new g_JumpNum[33] = 0
new bool:g_bJump[33] = false
enum { HEALTH = 0, ARMOR = 1, START_MONEY, MAX_JUMPS, SPEED, DAMAGE, HP_KILL, HP_HEADSHOT, MONEY_KILL };
new const vip_benefits[] =
{
180, // VIATA LA SPAWN
180, // ARMURA LA SPAWN
16000, // BANII LA START
3, // NUMARUL MAXIM DE SARITURI
440, // VITEZA MAXIMA
50, // DAMAGE IN PLUS (VALOAREA SA FIE INTRE 1 SI 100) (50 reprezinta 50% din dmg)
20, // VIATA PE KILL NORMAL
35, // VIATA PE HEADSHOT
600, // BANII PE KILL
}
new const g_weapons[] =
{
CSW_P228,
CSW_SCOUT,
CSW_XM1014,
CSW_MAC10,
CSW_AUG,
CSW_ELITE,
CSW_FIVESEVEN,
CSW_UMP45,
CSW_SG550,
CSW_GALI,
CSW_GALIL,
CSW_FAMAS,
CSW_USP,
CSW_GLOCK18,
CSW_AWP,
CSW_MP5NAVY,
CSW_M249,
CSW_M3,
CSW_M4A1,
CSW_TMP,
CSW_G3SG1,
CSW_DEAGLE,
CSW_SG552,
CSW_AK47,
CSW_P90
}
new const g_max_clip[] =
{
13,
10,
7,
30,
30,
30,
20,
25,
30,
35,
35,
25,
12,
20,
10,
30,
100,
8,
30,
30,
20,
7,
30,
30,
50
}
new const g_other_weapons[] =
{
CSW_KNIFE,
CSW_HEGRENADE,
CSW_C4
}
new g_type , g_recieved, g_hudmsg1, g_hudmsg2
new active=0
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_cvar("level_mod_", PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER);
set_cvar_string("level_mod_", PLUGIN_VERSION);
register_event("DeathMsg", "event_DeathMsg", "a");
RegisterHam(Ham_TakeDamage, "player", "fw_PlayerTakeDamage");
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawnPost", 1);
RegisterHam(Ham_Player_ResetMaxSpeed, "player", "fw_ResetMaxSpeed_Post", 1);
register_clcmd( "say /vips", "print_list" );
register_clcmd( "say_team /vips", "print_list" );
register_clcmd( "say /vreauvip", "print_info" );
register_clcmd( "say_team /vreauvip", "print_info" );
register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
g_type = register_cvar("amx_bulletdamage","1")
g_recieved = register_cvar("amx_bulletdamage_recieved","1")
g_hudmsg1 = CreateHudSyncObj()
g_hudmsg2 = CreateHudSyncObj()
}
public event_new_round() active++
public client_putinserver(id)
{
g_JumpNum[id] = 0;
g_bJump[id] = false;
}
public client_PreThink(id)
{
if(!is_user_alive(id) || !is_user_vip(id))
return PLUGIN_CONTINUE;
new nbut = get_user_button(id);
new obut = get_user_oldbutton(id);
new jump_num = vip_benefits[MAX_JUMPS];
if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
{
if(g_JumpNum[id] < jump_num)
{
g_bJump[id] = true;
g_JumpNum[id]++;
return PLUGIN_CONTINUE;
}
}
if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
g_JumpNum[id] = 0;
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
public client_PostThink(id)
{
if(!is_user_alive(id) || !is_user_vip(id))
return PLUGIN_CONTINUE;
if(g_bJump[id])
{
new Float:fVelocity[3];
entity_get_vector(id, EV_VEC_velocity, fVelocity);
fVelocity[2] = random_float(265.0, 285.0);
entity_set_vector(id, EV_VEC_velocity, fVelocity);
g_bJump[id] = false;
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
public event_DeathMsg()
{
new attacker = read_data(1);
new victim = read_data(2);
new headshot = read_data(3);
new hitself = (attacker == victim) ? 1 : 0;
if(is_user_alive(attacker) && is_user_vip(attacker))
{
if(hitself)
return;
if(headshot)
{
set_user_health(attacker, get_user_health(attacker) + vip_benefits[HP_HEADSHOT]);
for (new a = 0; a < sizeof (g_other_weapons); a++) if (get_user_weapon(attacker) == g_other_weapons[a]) return
new weapon = fm_get_weapon_ent(attacker, get_user_weapon(attacker))
for (new a = 0; a < sizeof (g_weapons); a++)
{
if (get_user_weapon(attacker) == g_weapons[a])
{
new ammo = get_weapon_maxclip(get_user_weapon(attacker))
if (ammo)
{
client_cmd(attacker, "spk ^"items/9mmclip1.wav^"")
cs_set_weapon_ammo(weapon, ammo)
}
return
}
}
}
else set_user_health(attacker, get_user_health(attacker) + vip_benefits[HP_KILL]);
cs_set_user_money(attacker, clamp(get_user_health(attacker) + vip_benefits[MONEY_KILL], 0, 16000));
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, attacker)
write_short(1<<12)
write_short(1<<12)
write_short(0x0000)
write_byte(30)
write_byte(144)
write_byte(255)
write_byte(90)
message_end()
}
}
public fw_PlayerTakeDamage(victim, inflictor, attacker, Float:fDamage, iDamageType)
{
if(iDamageType & DMG_GENERIC || victim == attacker || !is_user_alive(victim))
return HAM_IGNORED;
if(is_user_vip(attacker) && is_user_alive(attacker))
{
fDamage = (vip_benefits[DAMAGE] / 100) * fDamage + fDamage;
SetHamParamFloat(4, fDamage);
return HAM_HANDLED;
}
return HAM_IGNORED;
}
public fw_ResetMaxSpeed_Post(id)
{
if(!is_user_alive(id))
return HAM_HANDLED;
if(is_user_vip(id))
{
new Float:fMaxSpeed = float(vip_benefits[SPEED]);
set_user_maxspeed(id, fMaxSpeed);
new command[128];
formatex(command, charsmax(command), "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", fMaxSpeed, fMaxSpeed, fMaxSpeed);
client_cmd(id, command);
}
return HAM_IGNORED;
}
public fw_PlayerSpawnPost(id)
{
if(!is_user_alive(id))
return HAM_IGNORED;
if(is_user_vip(id))
{
set_user_health(id, vip_benefits[HEALTH]);
set_user_armor(id, vip_benefits[ARMOR]);
cs_set_user_money(id, clamp(vip_benefits[START_MONEY], 0, 16000));
if(active>=2) MeniuArme(id)
}
return HAM_IGNORED;
}
public MeniuArme(id)
{
new menu = menu_create( "Equipment", "menu_handler" )
menu_additem( menu, "AWP + DEAGLE + Set Grenade", "1" )
menu_additem( menu, "AK47 + DEAGLE + Set Grenade", "2" )
menu_additem( menu, "M4A1 + DEAGLE + Set Grenade la ct + defuse KIT", "3" )
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
menu_display( id, menu, 0 )
}
public menu_handler( id, Menu, Item )
{
if( Item < 0 || !is_user_alive(id) ) return 0;
new Key[ 3 ],Access, CallBack;
menu_item_getinfo( Menu, Item, Access, Key, 2, _, _, CallBack );
new isKey = str_to_num( Key );
switch( isKey )
{
case 1:
{
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_awp")
cs_set_user_bpammo(id, CSW_AWP, 30)
}
case 2:
{
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
}
case 3:
{
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
if(cs_get_user_team(id)==CS_TEAM_CT) give_item(id, "item_thighpack");
}
}
menu_destroy(Menu)
return PLUGIN_HANDLED
}
public print_info(id) show_motd(id,"addons/amxmodx/configs/vipinfo.html","VIP INFO")
public print_list( user )
{
new adminnames[ 33 ][ 32 ];
new message[ 256 ];
new id, count, x, len;
for( id = 1; id <= get_maxplayers( ); id++ )
{
if( is_user_connected( id ) )
{
if( is_user_vip(id) )
{
get_user_name( id, adminnames[ count ++ ], 31 );
}
}
}
len = formatex( message, 255, "^1[^3VIPS^1]^4 VIPs ONLINE^1: " );
if( count > 0 )
{
for( x = 0; x < count; x++ )
{
len += formatex( message[ len ], 255 - len, "^1[^3 %s^1 ]^4 %s ", adminnames[ x ], x < ( count - 1 ) ? " | " : "" );
if( len > 96 )
{
len = formatex( message, 255, "" );
print_message( user, message );
}
}
print_message( user, message );
}
else
{
len += formatex( message[ len ], 255 - len, "Nu este nici un^3 VIP^1 Conectat." );
print_message( user, message );
}
}
print_message( id, msg[ ] )
{
message_begin( MSG_ONE, get_user_msgid( "SayText" ), { 0, 0, 0 }, id );
write_byte( id );
write_string( msg );
message_end( );
}
public on_damage(id)
{
if(get_pcvar_num(g_type)==1 )
{
static attacker; attacker = get_user_attacker(id)
static damage; damage = read_data(2)
if(get_pcvar_num(g_recieved)==1)
{
set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
ShowSyncHudMsg(id, g_hudmsg2, "%i^n", damage)
}
if(is_user_connected(attacker))
{
if( is_user_vip(attacker) )
{
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
ShowSyncHudMsg(attacker, g_hudmsg1, "%i^n", damage)
}
}
}
}
get_weapon_maxclip(wpnid = 0)
{
for (new a = 0; a < sizeof (g_weapons); a++)
if (wpnid == g_weapons[a])
return g_max_clip[a]
return false
}
fm_get_weapon_ent(id, wpnid = 0)
{
new name[32]
if(wpnid)
get_weaponname(wpnid, name, 31)
if (!equal(name, "weapon_", 7))
format(name, sizeof (name) - 1, "weapon_%s", name)
return fm_find_ent_by_owner(get_maxplayers(), name, id)
}
fm_find_ent_by_owner(id, const classname[], owner, jghgtype = 0)
{
new strtype[16] = "classname"
new ent = id
switch (jghgtype)
{
case 1: strtype = "target"
case 2: strtype = "targetname"
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner)
{
}
return ent
}[/code]