MegastoRM

vip_shop.sma

Apr 28th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.82 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta_util>
  3. #include <hamsandwich>
  4.  
  5. #define OFFSET_CLIPAMMO        51
  6. #define OFFSET_LINUX_WEAPONS    4
  7. #define set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)
  8.  
  9. #define m_pActiveItem 373
  10.  
  11. native cs_get_user_money(index);
  12. native cs_set_user_money(index, money, flash = 1);
  13.  
  14. new const item[][] = {
  15.     "None",
  16.     "Health & Armor",
  17.     "No Clip \d(10s)",
  18.     "Invisibility \d(40s)",
  19.     "Speed",
  20.     "Deagle \d(4 metka)",
  21.     "AWP \d(3 metka)",
  22.     "M4A1 \d(5 metkova)"
  23. }
  24.  
  25. new const price[] = {
  26.     0,
  27.     3000,
  28.     10000,
  29.     8000,
  30.     9000,
  31.     10000,
  32.     16000,
  33.     14000
  34. }
  35.  
  36. public plugin_init() {
  37.     register_plugin("Shop", "1.0", "SN1P3R");
  38.     register_clcmd("say /vipshop", "Shop");
  39.     register_clcmd("say_team /vipshop", "Shop");
  40. }
  41.  
  42. public Shop(id) {
  43.     if(!get_user_flags(id) && ADMIN_LEVEL_C) {
  44.         client_print(id, print_chat, "Ti Nisi VIP!")
  45.         return PLUGIN_CONTINUE;
  46.     }
  47.     new szTmp[64];
  48.     new menu = menu_create("\rChose Item:\y", "ShopHandle");
  49.     for(new i = 1; i < sizeof item; i++) {
  50.         formatex(szTmp, charsmax(szTmp), "\y%s\r[\y$%i\r]", item[i], price[i]);
  51.         menu_additem(menu, szTmp);
  52.     }
  53.     menu_setprop(menu, MPROP_NEXTNAME, "\yJos");
  54.     menu_setprop(menu, MPROP_BACKNAME, "\yManje");
  55.     menu_setprop(menu, MPROP_EXITNAME, "\yIzadji");
  56.     menu_display(id, menu);
  57.     return PLUGIN_CONTINUE;
  58. }
  59.  
  60. public ShopHandle(id, menu, item) {
  61.     if(item == MENU_EXIT || !is_user_alive(id)) {
  62.         menu_destroy(menu);
  63.         return PLUGIN_CONTINUE;
  64.     }
  65.     item ++;
  66.     new player_money = cs_get_user_money(id);  
  67.     if(price[item] > player_money) {
  68.         client_print(id, print_chat, "Nemate dovoljno para!");
  69.         Shop(id);
  70.         return PLUGIN_CONTINUE;
  71.     }
  72.     switch(item) {
  73.         case 1: {
  74.             fm_set_user_health(id, 100);
  75.             fm_set_user_armor(id, 100);
  76.         }
  77.         case 2: {
  78.             fm_set_user_noclip(id, 1);
  79.             set_task(10.0, "TurnOffNoClip", id);
  80.         }
  81.         case 3: {
  82.             fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 5);
  83.             set_task(40.0, "TurnOnVisibility", id);
  84.         }
  85.         case 4: fm_set_user_maxspeed(id, 500.0);
  86.             case 5: {
  87.             fm_give_item(id, "weapon_deagle");
  88.             fm_set_user_clip(id, 4);
  89.         }
  90.         case 6: {
  91.             fm_give_item(id, "weapon_awp");
  92.             fm_set_user_clip(id, 3);
  93.         }
  94.         case 7: {
  95.             fm_give_item(id, "weapon_m4a1");
  96.             fm_set_user_clip(id, 5);
  97.         }
  98.     }
  99.     cs_set_user_money(id, player_money-price[item]);
  100.     return PLUGIN_CONTINUE;
  101. }
  102.  
  103. public TurnOffNoClip(id) {
  104.     if(is_user_connected(id)) { // Nisam siguran da li igrac mora biti i ziv
  105.         fm_set_user_noclip(id, 0);
  106.     }
  107. }
  108.  
  109. public TurnOnVisibility(id) {
  110.     if(is_user_connected(id) && is_user_alive(id)) {
  111.         fm_set_user_rendering(id);
  112.     }
  113. }
  114.  
  115. stock fm_set_user_clip(id, ammo) {
  116.     set_weapon_ammo(get_pdata_cbase(id, m_pActiveItem), ammo)
  117. }
Advertisement
Add Comment
Please, Sign In to add comment