#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <stripweapons>
#include <colorchat>
#define OD_GODZINY 21
#define DO_GODZINY 9
#define FLAGA_VIP ADMIN_LEVEL_H
#define PLUGIN "FREE VIP"
#define FLAGA ADMIN_LEVEL_H
#define VERSION "1.0"
#define AUTHOR "HLDK"
forward amxbans_admin_connect(id);
new a,a
new bool:a;
new Csa:a, bool:a[33], a=0, a, menu,
a, a[33], a;
public plugin_init(){
register_plugin("VIP Ultimate", "12.3.0.2", "benio101 & speedkill");
register_forward(FM_CmdStart, "CmdStartPre");
RegisterHam(Ham_Spawn, "player", "SpawnedEventPre", 1);
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");
register_event("CurWeapon","CurWeapon","be","1=1");
a= CreateMultiForward("amxbans_admin_connect",ET_IGNORE,FP_CELL)
a=CreateHudSyncObj();
new szGodzina[4], iGodzina;
register_plugin(PLUGIN, VERSION, AUTHOR)
get_time("%H", szGodzina, 3);
iGodzina = str_to_num(szGodzina);
if(OD_GODZINY <= iGodzina || iGodzina <= DO_GODZINY)
a = true;
}
public ShowMotd(id){
show_motd(id, "vip.txt", "Informacje o vipie");
}
public plugin_precache(){
// Wczytanie modeli broni
precache_model("models/noz/nozyk3.mdl");
}
public CurWeapon(id)
{
new a = read_data(2);
//nowe bronie
if(a == CSW_KNIFE && (get_user_flags(id) & FLAGA))
{
entity_set_string(id, EV_SZ_viewmodel, "models/noz/nozyk3.mdl")
}
}
public client_connect(id)
{
if(is_steam(id))
{
set_task(10.0,"Free_VIP",id)
}
}
public Free_VIP(id)
{
ColorChat(id,GREEN,"^x03Otrzymales darmowego VIP'a za posiadanie konta Steam.")
// remove_user_flags(id, ADMIN_USER)
set_user_flags(id, ADMIN_LEVEL_H)
ExecuteForward(a, a, id);
}
stock bool:is_steam(id)
{
new auth[65]
get_user_authid(id,auth,64)
if(contain(auth, "STEAM_0:0:") != -1 || contain(auth, "STEAM_0:1:") != -1)
return true;
return false;
}
public client_authorized(id){
if(a)
set_user_flags(id, get_user_flags(id) | FLAGA_VIP);
if(get_user_flags(id) & 524288 == 524288)
client_authorized_vip(id);
}
}
public client_authorized_vip(id){
a[id]=true;
new g_Name[64];
get_user_name(id,g_Name,charsmax(g_Name));
set_hudmessage(24, 190, 220, 0.25, 0.2, 0, 6.0, 6.0);
ShowSyncHudMsg(0, a, "Vip %s wbija na serwer !",g_Name);
}
public client_disconnect_vip(id){
a[id]=false;
}
public CmdStartPre(id, uc_handle){
if(a[id]){
if(is_user_alive(id)){
CmdStartPreVip(id, uc_handle);
}
}
}
public CmdStartPreVip(id, uc_handle){
new flags = pev(id, pev_flags);
if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONa) && !(pev(id, pev_oldbuttons) & IN_JUMP) && a[id]>0){
--a[id];
new Float:velocity[3];
pev(id, pev_velocity,velocity);
velocity[2] = random_float(265.0,285.0);
set_pev(id,pev_velocity,velocity);
} else if(flags & FL_ONa && a[id]!=-1){
a[id] = 1;
}
}
public SpawnedEventPre(id){
if(a[id]){
if(is_user_alive(id)){
SpawnedEventPreVip(id);
}
}
}
public SpawnedEventPreVip(id){
a[id]=1;
cs_set_user_armor(id, min(cs_get_user_armor(id,a)+100, 100), a);
new henum=(user_has_a(id,CSW_HEGRENADE)?cs_get_user_bpammo(id,CSW_HEGRENADE):0);
if(!henum && henum<1){
give_item(id, "a_hegrenade");
++henum;
}
new fbnum=(user_has_a(id,CSW_FLASHBANG)?cs_get_user_bpammo(id,CSW_FLASHBANG):0);
if(!fbnum && fbnum<2){
give_item(id, "a_flashbang");
++fbnum;
}
cs_set_user_bpammo(id, CSW_FLASHBANG, min(2, fbnum+2));
new sgnum=(user_has_a(id,CSW_SMOKEGRENADE)?cs_get_user_bpammo(id,CSW_SMOKEGRENADE):0);
if(!sgnum && sgnum<1){
give_item(id, "a_smokegrenade");
++sgnum;
}
show_vip_menu(id);
if(get_user_team(id)==2){
give_item(id, "item_thighpack");
}
}
public menu_1_handler(id){
Stripas(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
a=find_ent_by_owner(-1, "weapon_deagle", id);
if(a)cs_set_weapon_ammo(a, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_ak47");
give_item(id, "ammo_762nato");
a=find_ent_by_owner(-1, "weapon_ak47", id);
if(a)cs_set_weapon_ammo(a, 30);
cs_set_user_bpammo(id, CSW_AK47, 90);
}
public menu_2_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
a=find_ent_by_owner(-1, "weapon_deagle", id);
if(a)cs_set_weapon_ammo(a, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_m4a1");
give_item(id, "ammo_556nato");
a=find_ent_by_owner(-1, "weapon_m4a1", id);
if(a)cs_set_weapon_ammo(a, 30);
cs_set_user_bpammo(id, CSW_M4A1, 90);
}
public menu_3_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
a=find_ent_by_owner(-1, "weapon_deagle", id);
if(a)cs_set_weapon_ammo(a, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_awp");
give_item(id, "ammo_338magnum");
a=find_ent_by_owner(-1, "weapon_awp", id);
if(a)cs_set_weapon_ammo(a, 10);
cs_set_user_bpammo(id, CSW_AWP, 30);
}
public menu_4_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
a=find_ent_by_owner(-1, "weapon_deagle", id);
if(a)cs_set_weapon_ammo(a, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_famas");
give_item(id, "ammo_556nato");
a=find_ent_by_owner(-1, "weapon_famas", id);
if(a)cs_set_weapon_ammo(a, 25);
cs_set_user_bpammo(id, CSW_FAMAS, 90);
}
public menu_5_handler(id){
StripWeapons(id, Secondary);
give_item(id, "weapon_deagle");
give_item(id, "ammo_50ae");
a=find_ent_by_owner(-1, "weapon_deagle", id);
if(a)cs_set_weapon_ammo(a, 7);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
StripWeapons(id, Primary);
give_item(id, "weapon_scout");
give_item(id, "ammo_762nato");
a=find_ent_by_owner(-1, "weapon_scout", id);
if(a)cs_set_weapon_ammo(a, 10);
cs_set_user_bpammo(id, CSW_SCOUT, 90);
}
public show_vip_menu(id){
menu=menu_create("\rMenu VIPa","menu_handler");
a=menu_makecallback("menu_callback");
new bool:active=false, num=-1;
menu_additem(menu,"\wAK47 + Deagle ","",0,a);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
menu_additem(menu,"\wM4A1 + Deagle ","",0,a);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
menu_additem(menu,"\wAWP + Deagle ","",0,a);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
menu_additem(menu,"\wFamas + Deagle ","",0,a);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
menu_additem(menu,"\wScout + Deagle ","",0,a);
if(menu_callback(id, menu, ++num)==ITEM_ENABLED){
active=true;
}
if(active){
menu_setprop(menu,MPROP_EXITNAME,"Wyjscie");
menu_setprop(menu,MPROP_TITLE,"\yMenu Vipa");
menu_setprop(menu,MPROP_NUMBER_COLOR,"\y");
menu_display(id, menu);
} else {
menu_destroy(menu);
}
}
public event_new_round(){
++a;
}
public GameCommencing(){
a=0;
}
public menu_callback(id, menu, item){
if(is_user_alive(id)){
if(a>=4){
if(item==0){
return ITEM_ENABLED;
}
if(item==1){
return ITEM_ENABLED;
}
if(item==2){
return ITEM_ENABLED;
}
if(item==3){
return ITEM_ENABLED;
}
if(item==4){
return ITEM_ENABLED;
}
}
}
return ITEM_DISABLED;
}
public menu_handler(id, menu, item){
if(is_user_alive(id)){
if(a>=4){
if(item==0){
menu_1_handler(id);
}
if(item==1){
menu_2_handler(id);
}
if(item==2){
menu_3_handler(id);
}
if(item==3){
menu_4_handler(id);
}
if(item==4){
menu_5_handler(id);
}
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public VipStatus(){
new id=get_msg_arg_int(1);
if(is_user_alive(id) && a[id]){
set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2)|4);
}
}
public handleSayText(msgId,msgDest,msgEnt){
new id = get_msg_arg_int(1);
if(!is_user_connected(id)) return PLUGIN_CONTINUE;
new szTmp[192], szTmp2[192];
get_msg_arg_string(2, szTmp, charsmax(szTmp));
new szPrefix[64] = "";
if(!equal(szTmp,"#Cstrike_Chat_All")){
add(szTmp2, charsmax(szTmp2), "^x01");
add(szTmp2, charsmax(szTmp2), szPrefix);
add(szTmp2, charsmax(szTmp2), " ");
add(szTmp2, charsmax(szTmp2), szTmp);
}
else{
new szPlayerName[64];
get_user_name(id, szPlayerName, charsmax(szPlayerName));
get_msg_arg_string(4, szTmp, charsmax(szTmp)); //4. argument zawiera treœæ wys³anej wiadomoœci
set_msg_arg_string(4, ""); //Musimy go wyzerowaæ, gdy¿ gra wykorzysta wiadomoœæ podwójnie co mo¿e skutkowaæ crash'em 191+ znaków.
add(szTmp2, charsmax(szTmp2), "^x01");
add(szTmp2, charsmax(szTmp2), szPrefix);
add(szTmp2, charsmax(szTmp2), "^x03 ");
add(szTmp2, charsmax(szTmp2), szPlayerName);
add(szTmp2, charsmax(szTmp2), "^x01 : ");
add(szTmp2, charsmax(szTmp2), szTmp)
}
set_msg_arg_string(2, szTmp2);
return PLUGIN_CONTINUE;
}
public amxbans_admin_connect(id){
client_authorized(id);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/