hlmod.hu
https://hlmod.hu/

Piac
https://hlmod.hu/viewtopic.php?f=29&t=20460
Oldal: 2 / 2

Szerző:  DeR0iD [ 2015.04.27. 18:27 ]
Hozzászólás témája:  Re: Piac

És itt hol a piac?
Trade van ami kicsit se hasonlít az enyémhez csak anyiban, hogy kereskedés

Szerző:  NuD[!]e [ 2015.04.27. 19:57 ]
Hozzászólás témája:  Re: Piac

Ez lenne aza nagy piac :ssssss


SMA Forráskód: [ Mindet kijelol ]
  1. public main_charsi_buy_menu(id)
  2. {
  3. new szInfo[60];
  4. formatex(szInfo, 59, "Arany \d[ \y%d \d]", g_Coins[id][g_CurrentChar[id]])
  5.  
  6. new menu = menu_create(szInfo , "charsi_buy_menu");
  7.  
  8. new szTempid[32];
  9.  
  10. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  11. {
  12. num_to_str(item_id, szTempid, 31);
  13.  
  14. new szItems[60];
  15. formatex(szItems, 59, "%s \d( \y%d \d)", item_name[item_id], item_data[item_id][CHAR_COST])
  16.  
  17. menu_additem(menu, szItems, szTempid, 0);
  18.  
  19. }
  20.  
  21. menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
  22. menu_display(id , menu , 0);
  23. }
  24. public charsi_buy_menu(id , menu , item)
  25. {
  26. if ( !native_get_p_near_charsi(id) )
  27. return PLUGIN_HANDLED;
  28.  
  29. if(item == MENU_EXIT)
  30. {
  31. menu_destroy(menu);
  32. return PLUGIN_HANDLED;
  33. }
  34. new data[6], iName[64];
  35. new access, callback;
  36. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  37.  
  38. new item_id = str_to_num(data);
  39.  
  40. if ( !is_user_connected(id) || Get_Player_Items(id) >= MAX_PLAYER_ITEMS )
  41. {
  42. client_printcolor(id, "Elérted a maximális tárgyakat. Nem vásárolhatsz többet!")
  43.  
  44. return PLUGIN_HANDLED;
  45. }
  46.  
  47. if ( g_Coins[id][g_CurrentChar[id]] >= item_data[item_id][CHAR_COST] )
  48. {
  49. client_printcolor(id, "/yTárgy /g%s /ymegvéve!", item_name[item_id] );
  50.  
  51. Set_Player_Coins(id, g_Coins[id][g_CurrentChar[id]] - item_data[item_id][CHAR_COST]);
  52.  
  53. g_iPlayerItem[id][g_CurrentChar[id]][item_id]++;
  54.  
  55. if ( item_data[item_id][CHAR_TYPE] == TYPE_BOLTS )
  56. {
  57. g_iPlayerItemBolts[id][g_CurrentChar[id]][item_id] = get_pcvar_num(d2_bolts_value);
  58. }
  59.  
  60. if ( g_iPlayerItem[id][g_CurrentChar[id]][item_id] <= 1 )
  61. {
  62. g_iPlayerItemWorn[id][g_CurrentChar[id]][item_id] = ITEM_NOT_WORN;
  63. }
  64.  
  65. g_iPlayerItemRepair[id][g_CurrentChar[id]][item_id] = item_data[item_id][CHAR_DURABILITY];
  66. }
  67. else
  68. {
  69. client_printcolor(id, "/yNincs elég eranyad! Aranyaid száma:/g%d/y, Tárgy ára:/g%d", g_Coins[id][g_CurrentChar[id]], item_data[item_id][CHAR_COST])
  70. }
  71.  
  72. main_charsi_menu(id);
  73.  
  74. menu_destroy(menu);
  75. return PLUGIN_HANDLED;
  76. }
  77. public main_charsi_sell_menu(id)
  78. {
  79. new szInfo[60];
  80. formatex(szInfo, 59, "Gold \d[ \y%d \d]", g_Coins[id][g_CurrentChar[id]])
  81.  
  82. new menu = menu_create(szInfo , "charsi_sell_menu");
  83.  
  84. new szTempid[32];
  85.  
  86. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  87. {
  88. if ( g_iPlayerItem[id][g_CurrentChar[id]][item_id] > 0 )
  89. {
  90. new szItems[60];
  91. formatex(szItems, 59, "%s \d( \y%d \d) - \r%d", item_name[item_id], item_data[item_id][CHAR_COST] * (g_iPlayerItemRepair[id][g_CurrentChar[id]][item_id] + 1) / (item_data[item_id][CHAR_DURABILITY] + 1) / 2 ,
  92. g_iPlayerItem[id][g_CurrentChar[id]][item_id])
  93.  
  94. num_to_str(item_id, szTempid, 31);
  95.  
  96. menu_additem(menu, szItems, szTempid, 0);
  97. }
  98.  
  99. }
  100.  
  101. menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
  102. menu_display(id , menu , 0);
  103. }
  104. public charsi_sell_menu(id , menu , item)
  105. {
  106. if ( !native_get_p_near_charsi(id) )
  107. return PLUGIN_HANDLED;
  108.  
  109. if(item == MENU_EXIT)
  110. {
  111. menu_destroy(menu);
  112. return PLUGIN_HANDLED;
  113. }
  114. new data[6], iName[64];
  115. new access, callback;
  116. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  117.  
  118. new item_id = str_to_num(data);
  119.  
  120. if ( !is_user_connected(id) || Get_Player_Items(id) <= 0 )
  121. {
  122. client_printcolor(id, "Nem tudsz eladni tárgyat, mert nincs tárgyad!")
  123. return PLUGIN_HANDLED;
  124. }
  125.  
  126. new item_s_cost = item_data[item_id][CHAR_COST] * (g_iPlayerItemRepair[id][g_CurrentChar[id]][item_id] + 1) / (item_data[item_id][CHAR_DURABILITY] + 1) / 2;
  127.  
  128. if ( g_Coins[id][g_CurrentChar[id]] < MAX_PLAYER_MONEY[g_PlayerLevel[id][g_CurrentChar[id]]] && g_iPlayerItem[id][g_CurrentChar[id]][item_id] > 0 )
  129. {
  130. client_printcolor(id, "/yTárgy /g%s /yeladva!", item_name[item_id])
  131.  
  132. Set_Player_Coins(id, g_Coins[id][g_CurrentChar[id]] + item_s_cost );
  133.  
  134. g_iPlayerItem[id][g_CurrentChar[id]][item_id]--;
  135.  
  136. if ( g_iPlayerItem[id][g_CurrentChar[id]][item_id] < 1 && g_iPlayerItemWorn[id][g_CurrentChar[id]][item_id] )
  137. {
  138. g_iPlayerItemWorn[id][g_CurrentChar[id]][item_id] = ITEM_NOT_WORN;
  139.  
  140. ExecuteForward( g_iItemTook, g_iReturn, id, item_id);
  141. }
  142. }
  143.  
  144. main_charsi_menu(id)
  145.  
  146. menu_destroy(menu);
  147. return PLUGIN_HANDLED;
  148. }

Szerző:  DeR0iD [ 2015.04.27. 20:00 ]
Hozzászólás témája:  Re: Piac

Hát én teljesen máshogy oldottam meg :D

Szerző:  NuD[!]e [ 2015.04.27. 20:14 ]
Hozzászólás témája:  Re: Piac

Hogy? XDDDDDDDDDDDDD :lol: :lol:

Szerző:  LostLegend [ 2015.04.27. 20:15 ]
Hozzászólás témája:  Re: Piac

Ez nem privátüzenet se chat szóba ;)

Szerző:  NuD[!]e [ 2015.04.27. 20:17 ]
Hozzászólás témája:  Re: Piac

Megértettem. :)








nyali lv 10000

Szerző:  DeR0iD [ 2015.04.27. 20:17 ]
Hozzászólás témája:  Re: Piac

ez csak akkor működik ha a tömbön van egy index ami ugye több értéket tud felvenni/tárolni úgy hogy állítgatod ( 0, 1 jelen esetben) -> targy[2][33]
én nem csináltam neki +1 indexet

Oldal: 2 / 2 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/