Advertisement
GaMeRFoReVeR

Shop Ognjen7

Sep 30th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.54 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <cstrike>
  5. #include <colorchat>
  6. #include <fun>
  7.  
  8. #define PLUGIN "Plugin"
  9. #define VERSION "v1.0"
  10. #define AUTHOR "GaMeR FoReVeR"
  11.  
  12. new const ShopItems[][] =
  13. {
  14.     "Respawn\y 15000$\d - Opet ces da ozivis",
  15.     "+15hp \y14500$ \d- Dodaje ti 15hp",
  16.     "+500 EXP \y16000$ \d- Dodaje ti 500 Experience"
  17. };
  18.  
  19. new const cmdShop[][][] =
  20. {
  21.     // Komanda      Funkcija
  22.     {"say /shop",       "ShopMenu"},
  23.     {"say_team /shop""ShopMenu"}
  24. };
  25.  
  26. new gMenu;
  27.  
  28. public plugin_init()
  29. {
  30.     register_plugin(PLUGIN, VERSION, AUTHOR);
  31.    
  32.     for(new i; i < sizeof cmdShop; i++)
  33.         register_clcmd(cmdShop[i][0], cmdShop[i][1]);
  34. }
  35.  
  36. public ShopMenu(id)
  37. {
  38.     if(!is_user_connected(id) || is_user_bot(id))
  39.         return PLUGIN_HANDLED;
  40.    
  41.     new title[64];
  42.     formatex(title, charsmax(title), "Knife Shop \d%s", VERSION);
  43.     gMenu = menu_create(title, "ShopMenuH");
  44.     for(new i = 1; i < sizeof ShopItems; i++)
  45.         menu_additem(gMenu, ShopItems[i][0]);
  46.    
  47.     menu_display(id, gMenu);
  48.    
  49.     return PLUGIN_CONTINUE;
  50. }
  51.  
  52. public ShopMenuH(id, menu, item)
  53. {
  54.     if(!is_user_connected(id) || is_user_bot(id))
  55.         return PLUGIN_HANDLED;
  56.    
  57.     if(item == MENU_EXIT)
  58.     {
  59.         menu_destroy(gMenu);
  60.         return PLUGIN_HANDLED;
  61.     }
  62.    
  63.     new lPrice;
  64.     new user_money = cs_get_user_money(id);
  65.     switch(item)
  66.     {
  67.         case 0:
  68.         {
  69.             lPrice = 15000;
  70.             if(is_user_alive(id))
  71.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Moras biti mrtav !");
  72.             else if(user_money < lPrice)
  73.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Nemas dovoljno novca.");
  74.             else
  75.             {
  76.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Kupio si^4 Respawn.");
  77.                 cs_set_user_money(id, user_money-lPrice);
  78.                
  79.                 cs_user_spawn(id);
  80.             }
  81.         }
  82.         case 1:
  83.         {
  84.             lPrice = 15000;
  85.             if(!is_user_alive(id))
  86.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Moras biti ziv !");
  87.             else if(user_money < lPrice)
  88.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Nemas dovoljno novca.");
  89.             else
  90.             {
  91.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Kupio si^4 +15 HP.");
  92.                 cs_set_user_money(id, user_money-lPrice);
  93.                
  94.                 set_user_health(id, get_user_health(id)+15);
  95.             }
  96.         }
  97.         case 2:
  98.         {
  99.             lPrice = 15000;
  100.             if(!is_user_alive(id))
  101.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Moras biti ziv !");
  102.             else if(user_money < lPrice)
  103.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Nemas dovoljno novca.");
  104.             else
  105.             {
  106.                 ColorChat(id, NORMAL, "^4[Knife Shop]^1 Kupio si^4 +500 EXP.");
  107.                 cs_set_user_money(id, user_money-lPrice);
  108.                
  109.                 // OVDE NAPISI KAKO SE DOBIJA XP
  110.             }
  111.         }
  112.     }
  113.     return PLUGIN_CONTINUE;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement