#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <stripweapons>
#define DMG_HE (1<<24)
#define IsPlayer(%1) (1<=%1<=maxPlayers)
new CsArmorType:armortype, bool:g_Vip[33], gRound=0, ioid, maxPlayers,
menu, menu_callback_handler, weapon_id;
public plugin_init(){
register_plugin("VIP Ultimate", "12.3.0.2", "benio101 & speedkill");
RegisterHam(Ham_Spawn, "player", "SpawnedEventPre", 1);
RegisterHam(Ham_TakeDamage, "player", "takeDamage", 0);
register_event("DeathMsg", "DeathMsg", "a");
register_event("HLTV", "event_new_round", "a", "1=0", "2=0");
register_logevent("GameCommencing", 2, "1=Game_Commencing");
register_message(get_user_msgid("ScoreAttrib"), "VipStatus");
register_clcmd("say /vip", "ShowMotd");
register_message(get_user_msgid("SayText"),"handleSayText");
}
public client_authorized(id , const authid[]){
if(get_user_flags(id) & 524288){
client_authorized_vip(id);
}
}
public client_authorized_vip(id){
g_Vip[id]=true;
}
public client_disconnected(id){
if(g_Vip[id]){
client_disconnect_vip(id);
}
}
public client_disconnect_vip(id){
g_Vip[id]=false;
}
public SpawnedEventPre(id){
if(g_Vip[id]){
if(is_user_alive(id)){
SpawnedEventPreVip(id);
}
}
}
public SpawnedEventPreVip(id){
cs_set_user_armor(id, min(cs_get_user_armor(id,armortype)+100, 100), CS_ARMOR_VESTHELM);
new henum=(user_has_weapon(id,CSW_HEGRENADE)?cs_get_user_bpammo(id,CSW_HEGRENADE):0);
give_item(id, "weapon_hegrenade");
++henum;
new fbnum=(user_has_weapon(id,CSW_FLASHBANG)?cs_get_user_bpammo(id,CSW_FLASHBANG):0);
give_item(id, "weapon_flashbang");
++fbnum;
cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
new sgnum=(user_has_weapon(id,CSW_SMOKEGRENADE)?cs_get_user_bpammo(id,CSW_SMOKEGRENADE):0);
give_item(id, "weapon_smokegrenade");
++sgnum;
if(gRound>=2){
show_vip_menu(id);
set_task(15.0, "close_menu", id + 3432)
}
if(get_user_team(id)==2){
give_item(id, "item_thighpack");
}
}
public menu_1_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_famas");
give_item(id, "ammo_556nato");
weapon_id=find_ent_by_owner(-1, "weapon_famas", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 25);
cs_set_user_bpammo(id, CSW_FAMAS, 90);
}
public menu_2_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_ak47");
give_item(id, "ammo_762nato");
weapon_id=find_ent_by_owner(-1, "weapon_ak47", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 30);
cs_set_user_bpammo(id, CSW_AK47, 90);
}
public menu_3_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_m4a1");
give_item(id, "ammo_556nato");
weapon_id=find_ent_by_owner(-1, "weapon_m4a1", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 30);
cs_set_user_bpammo(id, CSW_M4A1, 90);
}
public menu_4_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
weapon_id=find_ent_by_owner(-1, "weapon_deagle", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_awp");
give_item(id, "ammo_338magnum");
weapon_id=find_ent_by_owner(-1, "weapon_awp", id);
if(weapon_id)cs_set_weapon_ammo(weapon_id, 10);
cs_set_user_bpammo(id, CSW_AWP, 30);
}
public plugin_cfg(){
maxPlayers=get_maxplayers();
}
public takeDamage(this, idinflictor, idattacker, Float:damage, damagebits){
if(((IsPlayer(idattacker) && is_user_connected(idattacker) && g_Vip[idattacker] && (ioid=idattacker)) ||
(ioid=pev(idinflictor, pev_owner) && IsPlayer(ioid) && is_user_connected(ioid) && g_Vip[ioid]))){
if(damagebits & DMG_HE){
damage+=35;
}
}
}
public DeathMsg(){
new killer=read_data(1);
new victim=read_data(2);
if(is_user_alive(killer) && g_Vip[killer] && get_user_team(killer) != get_user_team(victim)){
DeathMsgVip(killer,victim,read_data(3));
}
}
public DeathMsgVip(kid,vid,hs){
set_user_health(kid, min(get_user_health(kid)+(hs?10:5),100));
client_print(kid, print_center, "+ %d HP %s", hs?10:5, hs?"za zabicie HeadShoot'em!":"za zabicie!");
}
public show_vip_menu(id){
menu=menu_create("\rMenu VIPa","menu_handler");
menu_callback_handler=menu_makecallback("menu_callback");
new bool:active=false, num=-1;
menu_additem(menu,"\wWez \yFamas + deagle","",0,menu_callback_handler);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
menu_additem(menu,"\wWez \yAK-47 + deagle","",0,menu_callback_handler);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
menu_additem(menu,"\wWez \yM4A1 + deagle","",0,menu_callback_handler);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
menu_additem(menu,"\wWez \yZestaw snajpera","",0,menu_callback_handler);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
if(active){
menu_setprop(menu,MPROP_EXITNAME,"Wyjdz");
menu_setprop(menu,MPROP_TITLE,"\dVIP MENU^n\rKtory zestaw wybierasz? \d( 15 sek. )");
menu_setprop(menu,MPROP_NUMBER_COLOR,"\r");
menu_display(id, menu);
} else {
menu_destroy(menu);
}
}
public event_new_round(){
++gRound;
}
public GameCommencing(){
gRound=0;
}
public menu_callback(id, menu, item){
if(is_user_alive(id)){
if(gRound>=2){
if(item==0){
return ITEM_ENABLED;
}
if(item==1){
return ITEM_ENABLED;
}
if(item==2){
return ITEM_ENABLED;
}
}
if(gRound>=3){
if(item==3){
return ITEM_ENABLED;
}
}
}
return ITEM_DISABLED;
}
public menu_handler(id, menu, item){
if(is_user_alive(id)){
if(gRound>=2){
if(item==0){
menu_1_handler(id);
}
if(item==1){
menu_2_handler(id);
}
if(item==2){
menu_3_handler(id);
}
}
if(gRound>=3){
if(item==3){
menu_4_handler(id);
}
}
}
if(task_exists(id+3432))
remove_task(id+3432)
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public close_menu(task_id){
new id = task_id - 3432
show_menu(id, 0, "^n", 1);
client_print_color(id, print_team_default, "^1[^4VIP MENU^1] Minelo 15 sekund. Menu VIPa zostalo zamkniete!");
}
public VipStatus(){
new id=get_msg_arg_int(1);
if(is_user_alive(id) && g_Vip[id]){
set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2)|4);
}
}
public ShowMotd(id){
show_motd(id, "vip.txt", "VIP");
}
public handleSayText(msgId,msgDest,msgEnt){
new id = get_msg_arg_int(1);
if(is_user_connected(id) && g_Vip[id]){
new szTmp[256],szTmp2[256];
get_msg_arg_string(2,szTmp, charsmax(szTmp))
new szPrefix[64] = "^1[^4VIP^1]";
if(!equal(szTmp,"#Cstrike_Chat_All")){
add(szTmp2,charsmax(szTmp2),szPrefix);
add(szTmp2,charsmax(szTmp2)," ");
add(szTmp2,charsmax(szTmp2),szTmp);
}
else{
add(szTmp2,charsmax(szTmp2),szPrefix);
add(szTmp2,charsmax(szTmp2)," ^3%s1 ^1: %s2");
}
set_msg_arg_string(2,szTmp2);
}
return PLUGIN_CONTINUE;
}