Approved Coins Exchanger

Gameplay Addons
Post Reply
neverminddw
Member
Member
Posts: 17
Joined: 2 Years Ago
Has thanked: 0
Been thanked: 2 times
Contact:

Coins Exchanger

#1

Post by neverminddw » 2 Months Ago

I'll leave the modifications of the post to administrators of the forum.

Description: This plugin gives three options:
1.) Exchanging 10k coins to 1 Level;
2.) Exchanging 50k coins to 5 Levels;
3.) Exchanging 100k coins to 10 Levels.

Cvars:

Prices
ze_first_price "10000" // default (set's the price of the 1st option.)
ze_second_price "50000" // default (set's the price of the 2nd option.)
ze_third_price "100000" // default (set's the price of the 3rd option.)

Level Increments
ze_first_increase "1" // default (set's +1 Level when you choose first option in menu.)
ze_second_increase "5" // default (set's +5 Levels when you choose second option in menu.)
ze_third_increase "10" // default (set's +10 Levels when you choose third option in menu.)

Code:
  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. /* native ze_save_levels(id) // enable if you connect the native with SaveLevels(id) in level_system plugin */
  5.  
  6. new cmenu
  7.  
  8. new cost1, cost5, cost10, inc1, inc2, inc3
  9.  
  10. public plugin_init() {
  11.     register_plugin("ZE Exchanger", "1.0", "Nevermind")
  12.    
  13.     register_clcmd("say /exchange", "Exchanger")
  14.     register_clcmd("say_team /exchange", "Exchanger")
  15.    
  16.     register_dictionary("ze_exchanger.txt")
  17.    
  18.     cost1 = register_cvar("ze_first_price", "10000") // first option price
  19.     cost5 = register_cvar("ze_second_price", "50000") // seconds option price
  20.     cost10 = register_cvar("ze_third_price", "100000") // third option price
  21.    
  22.     inc1 = register_cvar("ze_first_increase", "1") // first option level increase
  23.     inc2 = register_cvar("ze_second_increase", "5") // seconds option level increase
  24.     inc3 = register_cvar("ze_third_increase", "10") // third option level increase
  25. }
  26.  
  27. public plugin_natives()
  28. {
  29.     register_native("ze_exchanger", "native_ze_exchanger", 1)
  30. }
  31.  
  32. public Exchanger(id)
  33. {
  34.     if (!is_user_connected(id) || !is_user_alive(id))
  35.     return
  36.    
  37.     cmenu = menu_create("\w[\rZE\w] \rCoins Exchanger", "cmenuHandler")
  38.    
  39.     menu_additem(cmenu, "\wExchange \y[10000 Coins] \wto \r1 Level", "")
  40.     menu_additem(cmenu, "\wExchange \y[50000 Coins] \wto \r5 Levels", "")
  41.     menu_additem(cmenu, "\wExchange \y[100000 Coins] \wto \r10 Levels", "")
  42.     menu_display(id, cmenu, 0)
  43. }
  44.  
  45. public cmenuHandler(id, exitmenu, chose)
  46. {
  47.     if (!is_user_connected(id) || !is_user_alive(id))
  48.     return PLUGIN_HANDLED
  49.    
  50.     if (chose == MENU_EXIT)
  51.     {
  52.         menu_destroy(exitmenu)
  53.         return PLUGIN_HANDLED
  54.     }
  55.    
  56.     switch(chose)
  57.     {
  58.         case 0:
  59.         {
  60.             if (ze_get_escape_coins(id) < get_pcvar_num(cost1))
  61.             {
  62.                 ze_colored_print(id, "%L", LANG_PLAYER, "NOT_ENOUGH_COINS")
  63.             }
  64.             else
  65.             {
  66.                 ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(cost1))
  67.                 ze_set_user_level(id, ze_get_user_level(id) + get_pcvar_num(inc1))
  68.                 ze_colored_print(id, "%L", LANG_PLAYER, "EXCHANGE_ONE")
  69.                 //ze_save_levels(id)
  70.             }
  71.         }
  72.         case 1:
  73.         {
  74.             if (ze_get_escape_coins(id) < get_pcvar_num(cost5))
  75.             {
  76.                 ze_colored_print(id, "%L", LANG_PLAYER, "NOT_ENOUGH_COINS")
  77.             }
  78.             else
  79.             {
  80.                 ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(cost5))
  81.                 ze_set_user_level(id, ze_get_user_level(id) + get_pcvar_num(inc2))
  82.                 ze_colored_print(id, "%L", LANG_PLAYER, "EXCHANGE_FIVE")
  83.                 //ze_save_levels(id)
  84.             }
  85.         }
  86.         case 2:
  87.         {
  88.             if (ze_get_escape_coins(id) < get_pcvar_num(cost10))
  89.             {
  90.                 ze_colored_print(id, "%L", LANG_PLAYER, "NOT_ENOUGH_COINS")
  91.             }
  92.             else
  93.             {
  94.                 ze_set_escape_coins(id, ze_get_escape_coins(id) - get_pcvar_num(cost10))
  95.                 ze_set_user_level(id, ze_get_user_level(id) + get_pcvar_num(inc3))
  96.                 ze_colored_print(id, "%L", LANG_PLAYER, "EXCHANGE_TEN")
  97.                 //ze_save_levels(id)
  98.             }
  99.         }
  100.     }
  101.    
  102.     return PLUGIN_HANDLED
  103. }
  104.  
  105. /*public native_ze_exchanger(id)
  106. {
  107.     if (!is_user_connected(id) || !is_user_alive(id))
  108.         return
  109.    
  110.     Exchanger(id)
  111. }*/


Download: http://www.mediafire.com/file/al6s2kyb4 ... r.rar/file
These users thanked the author neverminddw for the post:
Jack GamePlay (2 Months Ago)

User avatar
th3_king
VIP
VIP
Egypt
Posts: 35
Joined: 2 Years Ago
Location: Egypt
Has thanked: 10 times
Been thanked: 2 times
Age: 17
Contact:

#2

Post by th3_king » 2 Months Ago

Hello,
There is something similar to this →
  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. new g_iItems[3]
  5.  
  6. public plugin_init()
  7. {
  8.     register_plugin("[ZE] Extra: Buy XP", "1.0", "Jack GamePlay")
  9.     g_iItems[0] = ze_register_item("1000 EC -> 700 XP", 1000, 0)
  10.     g_iItems[1] = ze_register_item("5000 EC -> 4000 XP", 5000, 0)
  11.     g_iItems[2] = ze_register_item("10000 EC -> 9000 XP", 10000, 0)
  12. }
  13.  
  14. public ze_select_item_pre(id, itemid)
  15. {
  16.     if (itemid != g_iItems[0] || itemid != g_iItems[1] || itemid != g_iItems[2])
  17.         return ZE_ITEM_AVAILABLE
  18.  
  19.     return ZE_ITEM_AVAILABLE
  20. }
  21.  
  22. public ze_select_item_post(id, itemid)
  23. {
  24.     if (itemid == g_iItems[0])
  25.     {
  26.         ze_set_user_xp(id, ze_get_user_xp(id) + 700)
  27.     }
  28.     else if (itemid == g_iItems[1])
  29.     {
  30.         ze_set_user_xp(id, ze_get_user_xp(id) + 4000)
  31.     }
  32.     else if (itemid == g_iItems[2])
  33.     {
  34.         ze_set_user_xp(id, ze_get_user_xp(id) + 9000)
  35.     }
  36. }
Here: Buy XP
:)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests