- #include <amxmodx> 
- #include <amxmisc> 
- #include <dhudmessage> 
- #include <fun> 
-   
- new const PLUGIN[] = "VIPSyStem"; 
- new const VERSION[] = "1.0"; 
- new const AUTHOR[] = "Pista"; 
-   
- new const PREFIX[] = "Information"; 
-   
- new g_VIP[33], Gold[33] 
-   
- new g_month[33], g_day[33], g_year[33] 
-   
- new GoldKill, GoldKillHs; 
-   
- new const TEXT[][] = { 
-     { "\wVIP\y SyStem\d Made By:\r Pista" }, 
-     { "\wWhat can the VIP?" } 
- } 
-   
- public plugin_init() { 
-     register_plugin(PLUGIN, VERSION, AUTHOR) 
-      
-     register_clcmd("say /vip", "ShowMenu") 
-     register_event("DeathMsg", "Death", "a") 
-     register_event("CurWeapon", "KnifeWeapon", "be", "1=1") 
-      
-     register_concmd("give_gold", "GoldGive", ADMIN_CFG, "<username, #userid, authid | @all> <Gold>") 
-     register_concmd("remove_gold", "GoldRemove", ADMIN_CFG, "<username, #userid, authid | @all> <Gold>") 
-      
-     register_cvar("SmoothKills", "2"); 
-     GoldKill = get_cvar_num("SmoothKills"); 
-      
-     register_cvar("HsKills", "4"); 
-     GoldKillHs = get_cvar_num("HsKills") 
-      
-     set_task(60.0, "Message",_,_,_, "b") 
- } 
- public ShowMenu(id) { 
-     new szText[512], menu; 
-      
-     format(szText, charsmax(szText), "%s^n\yGold:\r %d", TEXT[0], Gold[id]) 
-     menu = menu_create(szText, "ShowMenuh") 
-      
-     static month[5], day[5], year[7] 
-     format_time(month, sizeof(month) - 1, "%m") 
-     format_time(day, sizeof(day) - 1, "%d") 
-     format_time(year, sizeof(year) - 1, "%Y") 
-      
-     new current_month = str_to_num(month) 
-     new current_day = str_to_num(day) 
-     new current_year = str_to_num(year) 
-      
-     if(g_VIP[id] == 1 && g_year[id] == current_year && g_month[id] == current_month && g_day[id]-current_day < 4) { 
-         format(szText, charsmax(szText), "\wVIP\y [BUY]^n\d         Expire:\r %d.%d.%d^n", g_year[id], g_month[id], g_day[id]) 
-         menu_additem(menu, szText, "1") 
-     } 
-     else if(g_VIP[id] == 1 && g_year[id] == current_year && g_month[id] == current_month && g_day[id]-current_day >= 3) { 
-         format(szText, charsmax(szText), "\wVIP\y [BUY]^n\d         Expire:\r %d.%d.%d^n", g_year[id], g_month[id], g_day[id]) 
-         menu_additem(menu, szText, "1") 
-     } 
-     else if(g_VIP[id] != 1 && g_year[id] == current_year && g_month[id] == current_month && g_day[id]-current_day < 4) { 
-         format(szText, charsmax(szText), "\wVIP\y [BUY]^n\d         Expire:\r %d.%d.%d^n", g_year[id], g_month[id], g_day[id]) 
-         menu_additem(menu, szText, "1") 
-     } 
-     else if(g_VIP[id] == 0) { 
-     menu_additem(menu, "\wVIP\y [BUY]\r 100.000 Gold\d 31 days^n", "1") 
-     } 
-     else { 
-         format(szText, charsmax(szText), "\wVIP\y [BUY]^n\d         Expire:\r %d.%d.%d^n", g_year[id], g_month[id], g_day[id]) 
-         menu_additem(menu, szText, "1") 
-     } 
-     format(szText, charsmax(szText), "%s", TEXT[1]) 
-     menu_additem(menu, szText, "2") 
-      
-     menu_display(id, menu) 
- } 
- public ShowMenuh(id, menu, item) { 
-     if(item == MENU_EXIT) { 
-         menu_destroy(menu) 
-         return PLUGIN_HANDLED 
-     } 
-     new data[6], szName[64], access, callback 
-     menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback); 
-      
-     new key = str_to_num(data) 
-      
-     switch(key) { 
-         case 1: { 
-             if(g_VIP[id] != 1) { 
-                 if(Gold[id] >= 100000) { 
-                     g_VIP[id] = 1 
-                     Gold[id] -= 100000 
-                     print_color(id, "!g[%s]!y Successful Buying!", PREFIX) 
-                     g_day[id] = 31 
-                 } 
-                 else { 
-                     print_color(id, "!g[%s]!y I'm sorry, no enough Gold!", PREFIX) 
-                     ShowMenu(id) 
-                 } 
-             } 
-             else { 
-                 print_color(id, "!g[%s]!y Already purchased!", PREFIX) 
-                 ShowMenu(id) 
-             } 
-         } 
-         case 2: show_motd(id,"addons/amxmodx/configs/vips.txt"); 
-     } 
-     menu_destroy(menu) 
-     return PLUGIN_HANDLED 
- } 
- public Death() { 
-     new Killer = read_data(1) 
-     new Victim = read_data(2) 
-      
-     if(Killer != Victim && get_user_team(Killer) != get_user_team(Victim) && is_user_connected(Killer)) { 
-         if(read_data(3)) { 
-             Gold[Killer] += GoldKillHs; 
-             set_dhudmessage(0, 170, 255, -1.0, 0.16, 0, 6.0, 2.0) 
-             show_dhudmessage(Killer, "+%d Gold HS!", GoldKillHs) 
-         } 
-         else if(GoldKill != 0) { 
-             Gold[Killer] += GoldKill; 
-             set_dhudmessage(0, 170, 255, -1.0, 0.16, 0, 6.0, 2.0) 
-             show_dhudmessage(Killer, "+%d Gold!", GoldKill) 
-         } 
-     } 
- } 
- public KnifeWeapon(id) { 
-     new Weapon = get_user_weapon(id) 
-      
-     if(g_VIP[id] == 1 && Weapon == CSW_KNIFE) { 
-         set_task(1.0, "HPGive", id) 
-     } 
- } 
- public HPGive(id) { 
-     if(get_user_health(id) < 110) { 
-         set_task(1.0, "HPGive", id) 
-         set_user_health(id, get_user_health(id) + 1) 
-     } 
-     else { 
-         set_hudmessage(0, 85, 255, -1.0, 0.25, 2, 6.0, 6.0) 
-         show_hudmessage(id, "You've reached the max health!") 
-          
-         return PLUGIN_HANDLED 
-     } 
-     return PLUGIN_CONTINUE 
- } 
- public client_putinserver(id) { 
-     set_task(1.0, "VIPLoad", id) 
- } 
- public VIPLoad(id) { 
-     static month[5], day[5], year[7] 
-     format_time(month, sizeof(month) - 1, "%m") 
-     format_time(day, sizeof(day) - 1, "%d") 
-     format_time(year, sizeof(year) - 1, "%Y") 
-      
-     new current_month = str_to_num(month) 
-     new current_day = str_to_num(day) 
-     new current_year = str_to_num(year) 
-      
-     if(g_VIP[id] == 1 && g_year[id] < current_year || g_month[id] == current_month && g_day[id] < current_day || g_year[id] == current_year && g_month[id] == current_month && g_day[id] < current_day) { 
-         print_color(id, "!g[%s]!y The expiration of the vip!", PREFIX) 
-         g_VIP[id] = 0 
-         ShowMenu(id) 
-     } 
- } 
- public Message() { 
-     print_color(0, "!g[%s]!y If VIP you would use!g /vip!y command!!y VIP SySteam Made by:!t Pista", PREFIX) 
- } 
- public GoldGive(iPlayer, level, cid) { 
-     if(!cmd_access(iPlayer, level, cid, 3)) return PLUGIN_HANDLED; 
-   
-     new arg[32] 
-     read_argv(1, arg, 31)  
-   
-     new GiveGold[32] 
-     read_argv(2, GiveGold, charsmax(GiveGold)) 
-   
-     new GoldGive = str_to_num(GiveGold) 
-   
-     new AdminName[32] 
-     new TargetName[32] 
-     get_user_name(iPlayer, AdminName, charsmax (AdminName)) 
-   
-     if(arg[0]=='@') { 
-         if(equali(arg[1],"All") || equali(arg[1],"ALL")) { 
-             new players[32], totalplayers, All 
-             get_players(players, totalplayers) 
-   
-             for(new i = 0; i <totalplayers; i++) { 
-                 All = players[i] 
-                 Gold[All] += GoldGive 
-             } 
-         } 
-         else if(equali(arg[1],"T") || equali(arg[1],"t")) { 
-             new players[32], totalplayers, T 
-             get_players(players, totalplayers) 
-   
-             for(new i = 0; i <totalplayers; i++) { 
-                 if(get_user_team(players[i]) == 1) { 
-                     T = players[i] 
-                     Gold[T] += GoldGive 
-                 } 
-             } 
-         } 
-         else if(equali(arg[1],"CT") || equali(arg[1],"ct")) { 
-             new players[32], totalplayers, CT 
-             get_players( players, totalplayers ) 
-   
-             for(new i = 0; i <totalplayers; i++) { 
-                 if(get_user_team(players[i]) == 2) { 
-                     CT = players[i] 
-                     Gold[CT] += GoldGive 
-                 } 
-             } 
-         } 
-     } 
-     else { 
-         new iTarget = cmd_target(iPlayer, arg, 3) 
-         get_user_name(iTarget, TargetName, charsmax (TargetName)) 
-   
-         if(iTarget) { 
-             Gold[iTarget] += GoldGive 
-         } 
-     } 
-     return PLUGIN_HANDLED 
- } 
- public GoldRemove(iPlayer, level, cid) { 
-     if(!cmd_access(iPlayer, level, cid, 3)) return PLUGIN_HANDLED; 
-   
-     new arg[32] 
-     read_argv(1, arg, 31)  
-   
-     new GiveGold[32] 
-     read_argv(2, GiveGold, charsmax(GiveGold)) 
-   
-     new GoldGive = str_to_num(GiveGold) 
-   
-     new AdminName[32] 
-     new TargetName[32] 
-     get_user_name(iPlayer, AdminName, charsmax (AdminName)) 
-   
-     if(arg[0]=='@') { 
-         if(equali(arg[1],"All") || equali(arg[1],"ALL")) { 
-             new players[32], totalplayers, All 
-             get_players(players, totalplayers) 
-   
-             for(new i = 0; i <totalplayers; i++) { 
-                 All = players[i] 
-                 Gold[All] -= GoldGive 
-             } 
-         } 
-         else if(equali(arg[1],"T") || equali(arg[1],"t")) { 
-             new players[32], totalplayers, T 
-             get_players(players, totalplayers) 
-   
-             for(new i = 0; i <totalplayers; i++) { 
-                 if(get_user_team(players[i]) == 1) { 
-                     T = players[i] 
-                     Gold[T] -= GoldGive 
-                 } 
-             } 
-         } 
-         else if(equali(arg[1],"CT") || equali(arg[1],"ct")) { 
-             new players[32], totalplayers, CT 
-             get_players( players, totalplayers ) 
-   
-             for(new i = 0; i <totalplayers; i++) { 
-                 if(get_user_team(players[i]) == 2) { 
-                     CT = players[i] 
-                     Gold[CT] -= GoldGive 
-                 } 
-             } 
-         } 
-     } 
-     else { 
-         new iTarget = cmd_target(iPlayer, arg, 3) 
-         get_user_name(iTarget, TargetName, charsmax (TargetName)) 
-   
-         if(iTarget) { 
-             Gold[iTarget] -= GoldGive 
-         } 
-     } 
-     return PLUGIN_HANDLED 
- } 
- stock print_color(const id, const input[], any:...) { 
-         new count = 1, players[32] 
-         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")       
-   
-         if(id)players[0] = id; else get_players(players, count, "ch")  
-     { 
-                 for(new i = 0; i <count; i++)  
-         { 
-                         if (is_user_connected(players[i]))  
-             { 
-                                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]) 
-                                 write_byte(players[i]) 
-                                 write_string(msg) 
-                                 message_end() 
-                         } 
-                 } 
-         } 
-         return PLUGIN_HANDLED 
- }