Русское сообщество по скриптингу

Плагин /donate

Поиск плагинов для AMX Mod X.

Модератор: Leonidddd

Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела "Болтовня".
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.

В данном разделе форума разрешено создавать темы, касающиеся только поиску плагинов для AMX Mod X.

Плагин /donate

Сообщение german1997 » 23 янв 2014, 19:15

Суть плагина в том что передавать игроку деньги,искал много но там либо кривые,либо исходник с Error прошу помочь нужно именно меню передачи денег игроку

Добавлено спустя 13 минут 2 секунды:
Ещё желательно что бы было адм-меню что бы можно было дать деньги или забрать
Аватара пользователя
german1997
 
Сообщения: 157
Зарегистрирован: 17 июл 2013, 05:27
Благодарил (а): 11 раз.
Поблагодарили: 0 раз.
Опыт программирования: Около 3 месяцев
Языки программирования: Counter-Strike 1.6

Re: Плагин /donate

Сообщение Vaillante » 23 янв 2014, 19:49

german1997 писал(а):Суть плагина в том что передавать игроку деньги,искал много но там либо кривые,либо исходник с Error прошу помочь нужно именно меню передачи денег игроку

Добавлено спустя 13 минут 2 секунды:
Ещё желательно что бы было адм-меню что бы можно было дать деньги или забрать

Напишу за 5* рублей:D
Аватара пользователя
Vaillante
 
Сообщения: 493
Зарегистрирован: 28 окт 2013, 14:56
Откуда: ты?
Благодарил (а): 131 раз.
Поблагодарили: 90 раз.
Опыт программирования: Около 3 месяцев
Языки программирования: Counter-Strike 1.6

Re: Плагин /donate

Сообщение german1997 » 23 янв 2014, 20:11

Bustazz писал(а):
german1997 писал(а):Суть плагина в том что передавать игроку деньги,искал много но там либо кривые,либо исходник с Error прошу помочь нужно именно меню передачи денег игроку

Добавлено спустя 13 минут 2 секунды:
Ещё желательно что бы было адм-меню что бы можно было дать деньги или забрать

Напишу за 5* рублей:D

хватит орать :D, мне срочно нужен(
Аватара пользователя
german1997
 
Сообщения: 157
Зарегистрирован: 17 июл 2013, 05:27
Благодарил (а): 11 раз.
Поблагодарили: 0 раз.
Опыт программирования: Около 3 месяцев
Языки программирования: Counter-Strike 1.6

Re: Плагин /donate

Сообщение Vaillante » 23 янв 2014, 20:49

[pawn]
  1. #include <amxmodx>

  2. #include <cstrike>

  3. #include <colorchat>

  4.  

  5. public plugin_init()

  6. {

  7.         register_plugin("Donate", "1.0", "[email protected]");

  8.         register_clcmd("say /donate", "ShowMenu", _, "Передача денег между игроками");

  9.         register_clcmd("amx_donate", "donateAction");

  10.         register_clcmd("amx_donateremove", "removeAction");

  11.         register_clcmd("amx_donategive", "giveAction");

  12. }

  13.  

  14. public ShowMenu(id)

  15. {

  16.         if(get_user_flags(id) & ADMIN_MENU)

  17.         {

  18.                 new menu = menu_create("Передать денег игроку", "ShowMenuHandler");

  19.                

  20.                 menu_additem(menu, "Передать", "", 0); // case 0

  21.                 menu_additem(menu, "Дать", "", ADMIN_MENU); // case 1

  22.                 menu_additem(menu, "Забрать", "", ADMIN_MENU); // case 2

  23.                

  24.                 menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

  25.                 menu_setprop(menu, MPROP_EXITNAME, "Выход");

  26.                

  27.                 menu_display(id, menu, 0);

  28.         }

  29.         else

  30.         {

  31.                 donateMenu(id)

  32.         }

  33.         return PLUGIN_HANDLED;

  34. }

  35.  

  36. public ShowMenuHandler(id, menu, item)

  37. {

  38.         if(item == MENU_EXIT)

  39.         {

  40.                 menu_cancel(id);

  41.                 return PLUGIN_HANDLED;

  42.         }

  43.         new command[6], name[64], access, callback;

  44.        

  45.         menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

  46.        

  47.         switch(item)

  48.         {

  49.         case 0: {

  50.                         donateMenu(id)

  51.                 }

  52.         case 1: {

  53.                         selectPlayerFromGive(id)

  54.                 }

  55.         case 2: {

  56.                         selectPlayerFromRemove(id)

  57.                 }

  58.         }

  59.        

  60.         menu_destroy(menu);

  61.         return PLUGIN_HANDLED

  62. }

  63. public donateMenu(id)

  64. {

  65.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  66.  

  67.         new s_Players[32], i_Num, i_Player

  68.  

  69.         new s_Name[32], s_Player[10]

  70.  

  71.         get_players(s_Players, i_Num)

  72.         for (new i; i < i_Num; i++)

  73.         {

  74.                 i_Player = s_Players[i]

  75.  

  76.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  77.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  78.  

  79.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  80.  

  81.         }

  82.  

  83.         menu_display(id, i_Menu, 0)

  84.         return PLUGIN_HANDLED

  85. }

  86.  

  87. public donateMenuHandler(id, menu, item)

  88. {

  89.         if (item == MENU_EXIT)

  90.         {

  91.                 menu_destroy(menu)

  92.                 return PLUGIN_HANDLED

  93.         }

  94.  

  95.         new s_Data[6], s_Name[64], i_Access, i_Callback

  96.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  97.  

  98.         new i_Player = str_to_num(s_Data)

  99.  

  100.         client_cmd(id, "messagemode ^"amx_donate %i^"", i_Player);

  101.  

  102.         menu_destroy(menu)

  103.         return PLUGIN_HANDLED

  104. }

  105. public donateAction(id)

  106. {

  107.         new param[10]

  108.         read_argv(2, param, charsmax(param))

  109.         for (new x; x < strlen(param); x++)

  110.         {

  111.                 if(!isdigit(param[x]))

  112.                 {

  113.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  114.                         return PLUGIN_HANDLED

  115.                 }

  116.         }

  117.         new amount = str_to_num(param);

  118.         if (amount < 1)

  119.         {

  120.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  121.                 return PLUGIN_HANDLED

  122.         }

  123.         if (amount > 99999)

  124.         {

  125.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  126.                 return PLUGIN_HANDLED

  127.         }

  128.         read_argv(1, param, charsmax(param))

  129.         new i_Player = str_to_num(param)

  130.         new money       =       cs_get_user_money(i_Player)

  131.         new my_money    =       cs_get_user_money(id)

  132.         cs_set_user_money(i_Player, money + amount)

  133.         cs_set_user_money(id, my_money - amount)

  134.         new names[2][32]

  135.         get_user_name(id, names[0], 31)

  136.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Игрок ^4 %s^1 передал вам ^4 %s $", names[0], amount)

  137.        

  138.         return PLUGIN_HANDLED

  139. }

  140. /*** Дать ***/

  141. public selectPlayerFromGive(id)

  142. {

  143.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  144.  

  145.         new s_Players[32], i_Num, i_Player

  146.  

  147.         new s_Name[32], s_Player[10]

  148.  

  149.         get_players(s_Players, i_Num)

  150.         for (new i; i < i_Num; i++)

  151.         {

  152.                 i_Player = s_Players[i]

  153.  

  154.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  155.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  156.  

  157.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  158.  

  159.         }

  160.  

  161.         menu_display(id, i_Menu, 0)

  162.         return PLUGIN_HANDLED

  163. }

  164.  

  165. public selectPlayerFromGiveHandler(id, menu, item)

  166. {

  167.         if (item == MENU_EXIT)

  168.         {

  169.                 menu_destroy(menu)

  170.                 return PLUGIN_HANDLED

  171.         }

  172.  

  173.         new s_Data[6], s_Name[64], i_Access, i_Callback

  174.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  175.  

  176.         new i_Player = str_to_num(s_Data)

  177.  

  178.         client_cmd(id, "messagemode ^"amx_donategive %i^"", i_Player);

  179.  

  180.         menu_destroy(menu)

  181.         return PLUGIN_HANDLED

  182. }

  183. public giveAction(id)

  184. {

  185.         new param[10]

  186.         read_argv(2, param, charsmax(param))

  187.         for (new x; x < strlen(param); x++)

  188.         {

  189.                 if(!isdigit(param[x]))

  190.                 {

  191.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  192.                         return PLUGIN_HANDLED

  193.                 }

  194.         }

  195.         new amount = str_to_num(param);

  196.         if (amount < 1)

  197.         {

  198.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  199.                 return PLUGIN_HANDLED

  200.         }

  201.         if (amount > 99999)

  202.         {

  203.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  204.                 return PLUGIN_HANDLED

  205.         }

  206.         read_argv(1, param, charsmax(param))

  207.         new i_Player = str_to_num(param)

  208.         new money       =       cs_get_user_money(i_Player)

  209.         cs_set_user_money(i_Player, money + amount)

  210.         new names[2][32]

  211.         get_user_name(id, names[0], 31)

  212.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Админ ^4 %s^1 дал вам ^4 %s $", names[0], amount)

  213.        

  214.         return PLUGIN_HANDLED

  215. }

  216. /*** Забрать ***/

  217. public selectPlayerFromRemove(id)

  218. {

  219.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  220.  

  221.         new s_Players[32], i_Num, i_Player

  222.  

  223.         new s_Name[32], s_Player[10]

  224.  

  225.         get_players(s_Players, i_Num)

  226.         for (new i; i < i_Num; i++)

  227.         {

  228.                 i_Player = s_Players[i]

  229.  

  230.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  231.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  232.  

  233.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  234.  

  235.         }

  236.  

  237.         menu_display(id, i_Menu, 0)

  238.         return PLUGIN_HANDLED

  239. }

  240.  

  241. public selectPlayerFromRemoveHandler(id, menu, item)

  242. {

  243.         if (item == MENU_EXIT)

  244.         {

  245.                 menu_destroy(menu)

  246.                 return PLUGIN_HANDLED

  247.         }

  248.  

  249.         new s_Data[6], s_Name[64], i_Access, i_Callback

  250.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  251.  

  252.         new i_Player = str_to_num(s_Data)

  253.  

  254.         client_cmd(id, "messagemode ^"amx_donateremove %i^"", i_Player);

  255.  

  256.         menu_destroy(menu)

  257.         return PLUGIN_HANDLED

  258. }

  259. public removeAction(id)

  260. {

  261.         new param[10]

  262.         read_argv(2, param, charsmax(param))

  263.         for (new x; x < strlen(param); x++)

  264.         {

  265.                 if(!isdigit(param[x]))

  266.                 {

  267.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  268.                         return PLUGIN_HANDLED

  269.                 }

  270.         }

  271.         new amount = str_to_num(param);

  272.         if (amount < 1)

  273.         {

  274.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  275.                 return PLUGIN_HANDLED

  276.         }

  277.         if (amount > 99999)

  278.         {

  279.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  280.                 return PLUGIN_HANDLED

  281.         }

  282.         read_argv(1, param, charsmax(param))

  283.         new i_Player = str_to_num(param)

  284.         new money       =       cs_get_user_money(i_Player)

  285.         cs_set_user_money(i_Player, money - amount)

  286.         new names[2][32]

  287.         get_user_name(id, names[0], 31)

  288.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Админ ^4 %s^1 забрал у вас ^4 %s $", names[0], amount)

  289.        

  290.         return PLUGIN_HANDLED

  291. }
[/pawn]
Аватара пользователя
Vaillante
 
Сообщения: 493
Зарегистрирован: 28 окт 2013, 14:56
Откуда: ты?
Благодарил (а): 131 раз.
Поблагодарили: 90 раз.
Опыт программирования: Около 3 месяцев
Языки программирования: Counter-Strike 1.6

Re: Плагин /donate

Сообщение german1997 » 23 янв 2014, 22:18

Bustazz писал(а):[pawn]
  1. #include <amxmodx>

  2. #include <cstrike>

  3. #include <colorchat>

  4.  

  5. public plugin_init()

  6. {

  7.         register_plugin("Donate", "1.0", "[email protected]");

  8.         register_clcmd("say /donate", "ShowMenu", _, "Передача денег между игроками");

  9.         register_clcmd("amx_donate", "donateAction");

  10.         register_clcmd("amx_donateremove", "removeAction");

  11.         register_clcmd("amx_donategive", "giveAction");

  12. }

  13.  

  14. public ShowMenu(id)

  15. {

  16.         if(get_user_flags(id) & ADMIN_MENU)

  17.         {

  18.                 new menu = menu_create("Передать денег игроку", "ShowMenuHandler");

  19.                

  20.                 menu_additem(menu, "Передать", "", 0); // case 0

  21.                 menu_additem(menu, "Дать", "", ADMIN_MENU); // case 1

  22.                 menu_additem(menu, "Забрать", "", ADMIN_MENU); // case 2

  23.                

  24.                 menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

  25.                 menu_setprop(menu, MPROP_EXITNAME, "Выход");

  26.                

  27.                 menu_display(id, menu, 0);

  28.         }

  29.         else

  30.         {

  31.                 donateMenu(id)

  32.         }

  33.         return PLUGIN_HANDLED;

  34. }

  35.  

  36. public ShowMenuHandler(id, menu, item)

  37. {

  38.         if(item == MENU_EXIT)

  39.         {

  40.                 menu_cancel(id);

  41.                 return PLUGIN_HANDLED;

  42.         }

  43.         new command[6], name[64], access, callback;

  44.        

  45.         menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

  46.        

  47.         switch(item)

  48.         {

  49.         case 0: {

  50.                         donateMenu(id)

  51.                 }

  52.         case 1: {

  53.                         selectPlayerFromGive(id)

  54.                 }

  55.         case 2: {

  56.                         selectPlayerFromRemove(id)

  57.                 }

  58.         }

  59.        

  60.         menu_destroy(menu);

  61.         return PLUGIN_HANDLED

  62. }

  63. public donateMenu(id)

  64. {

  65.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  66.  

  67.         new s_Players[32], i_Num, i_Player

  68.  

  69.         new s_Name[32], s_Player[10]

  70.  

  71.         get_players(s_Players, i_Num)

  72.         for (new i; i < i_Num; i++)

  73.         {

  74.                 i_Player = s_Players[i]

  75.  

  76.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  77.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  78.  

  79.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  80.  

  81.         }

  82.  

  83.         menu_display(id, i_Menu, 0)

  84.         return PLUGIN_HANDLED

  85. }

  86.  

  87. public donateMenuHandler(id, menu, item)

  88. {

  89.         if (item == MENU_EXIT)

  90.         {

  91.                 menu_destroy(menu)

  92.                 return PLUGIN_HANDLED

  93.         }

  94.  

  95.         new s_Data[6], s_Name[64], i_Access, i_Callback

  96.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  97.  

  98.         new i_Player = str_to_num(s_Data)

  99.  

  100.         client_cmd(id, "messagemode ^"amx_donate %i^"", i_Player);

  101.  

  102.         menu_destroy(menu)

  103.         return PLUGIN_HANDLED

  104. }

  105. public donateAction(id)

  106. {

  107.         new param[10]

  108.         read_argv(2, param, charsmax(param))

  109.         for (new x; x < strlen(param); x++)

  110.         {

  111.                 if(!isdigit(param[x]))

  112.                 {

  113.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  114.                         return PLUGIN_HANDLED

  115.                 }

  116.         }

  117.         new amount = str_to_num(param);

  118.         if (amount < 1)

  119.         {

  120.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  121.                 return PLUGIN_HANDLED

  122.         }

  123.         if (amount > 99999)

  124.         {

  125.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  126.                 return PLUGIN_HANDLED

  127.         }

  128.         read_argv(1, param, charsmax(param))

  129.         new i_Player = str_to_num(param)

  130.         new money       =       cs_get_user_money(i_Player)

  131.         new my_money    =       cs_get_user_money(id)

  132.         cs_set_user_money(i_Player, money + amount)

  133.         cs_set_user_money(id, my_money - amount)

  134.         new names[2][32]

  135.         get_user_name(id, names[0], 31)

  136.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Игрок ^4 %s^1 передал вам ^4 %s $", names[0], amount)

  137.        

  138.         return PLUGIN_HANDLED

  139. }

  140. /*** Дать ***/

  141. public selectPlayerFromGive(id)

  142. {

  143.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  144.  

  145.         new s_Players[32], i_Num, i_Player

  146.  

  147.         new s_Name[32], s_Player[10]

  148.  

  149.         get_players(s_Players, i_Num)

  150.         for (new i; i < i_Num; i++)

  151.         {

  152.                 i_Player = s_Players[i]

  153.  

  154.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  155.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  156.  

  157.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  158.  

  159.         }

  160.  

  161.         menu_display(id, i_Menu, 0)

  162.         return PLUGIN_HANDLED

  163. }

  164.  

  165. public selectPlayerFromGiveHandler(id, menu, item)

  166. {

  167.         if (item == MENU_EXIT)

  168.         {

  169.                 menu_destroy(menu)

  170.                 return PLUGIN_HANDLED

  171.         }

  172.  

  173.         new s_Data[6], s_Name[64], i_Access, i_Callback

  174.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  175.  

  176.         new i_Player = str_to_num(s_Data)

  177.  

  178.         client_cmd(id, "messagemode ^"amx_donategive %i^"", i_Player);

  179.  

  180.         menu_destroy(menu)

  181.         return PLUGIN_HANDLED

  182. }

  183. public giveAction(id)

  184. {

  185.         new param[10]

  186.         read_argv(2, param, charsmax(param))

  187.         for (new x; x < strlen(param); x++)

  188.         {

  189.                 if(!isdigit(param[x]))

  190.                 {

  191.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  192.                         return PLUGIN_HANDLED

  193.                 }

  194.         }

  195.         new amount = str_to_num(param);

  196.         if (amount < 1)

  197.         {

  198.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  199.                 return PLUGIN_HANDLED

  200.         }

  201.         if (amount > 99999)

  202.         {

  203.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  204.                 return PLUGIN_HANDLED

  205.         }

  206.         read_argv(1, param, charsmax(param))

  207.         new i_Player = str_to_num(param)

  208.         new money       =       cs_get_user_money(i_Player)

  209.         cs_set_user_money(i_Player, money + amount)

  210.         new names[2][32]

  211.         get_user_name(id, names[0], 31)

  212.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Админ ^4 %s^1 дал вам ^4 %s $", names[0], amount)

  213.        

  214.         return PLUGIN_HANDLED

  215. }

  216. /*** Забрать ***/

  217. public selectPlayerFromRemove(id)

  218. {

  219.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  220.  

  221.         new s_Players[32], i_Num, i_Player

  222.  

  223.         new s_Name[32], s_Player[10]

  224.  

  225.         get_players(s_Players, i_Num)

  226.         for (new i; i < i_Num; i++)

  227.         {

  228.                 i_Player = s_Players[i]

  229.  

  230.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  231.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  232.  

  233.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  234.  

  235.         }

  236.  

  237.         menu_display(id, i_Menu, 0)

  238.         return PLUGIN_HANDLED

  239. }

  240.  

  241. public selectPlayerFromRemoveHandler(id, menu, item)

  242. {

  243.         if (item == MENU_EXIT)

  244.         {

  245.                 menu_destroy(menu)

  246.                 return PLUGIN_HANDLED

  247.         }

  248.  

  249.         new s_Data[6], s_Name[64], i_Access, i_Callback

  250.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  251.  

  252.         new i_Player = str_to_num(s_Data)

  253.  

  254.         client_cmd(id, "messagemode ^"amx_donateremove %i^"", i_Player);

  255.  

  256.         menu_destroy(menu)

  257.         return PLUGIN_HANDLED

  258. }

  259. public removeAction(id)

  260. {

  261.         new param[10]

  262.         read_argv(2, param, charsmax(param))

  263.         for (new x; x < strlen(param); x++)

  264.         {

  265.                 if(!isdigit(param[x]))

  266.                 {

  267.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  268.                         return PLUGIN_HANDLED

  269.                 }

  270.         }

  271.         new amount = str_to_num(param);

  272.         if (amount < 1)

  273.         {

  274.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  275.                 return PLUGIN_HANDLED

  276.         }

  277.         if (amount > 99999)

  278.         {

  279.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  280.                 return PLUGIN_HANDLED

  281.         }

  282.         read_argv(1, param, charsmax(param))

  283.         new i_Player = str_to_num(param)

  284.         new money       =       cs_get_user_money(i_Player)

  285.         cs_set_user_money(i_Player, money - amount)

  286.         new names[2][32]

  287.         get_user_name(id, names[0], 31)

  288.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Админ ^4 %s^1 забрал у вас ^4 %s $", names[0], amount)

  289.        

  290.         return PLUGIN_HANDLED

  291. }
[/pawn]

Спасибо)))

Добавлено спустя 10 минут 32 секунды:
НЕ работает чего то,проверь код
Аватара пользователя
german1997
 
Сообщения: 157
Зарегистрирован: 17 июл 2013, 05:27
Благодарил (а): 11 раз.
Поблагодарили: 0 раз.
Опыт программирования: Около 3 месяцев
Языки программирования: Counter-Strike 1.6

Re: Плагин /donate

Сообщение Vaillante » 24 янв 2014, 12:28

german1997 писал(а):
Bustazz писал(а):[pawn]
  1. #include <amxmodx>

  2. #include <cstrike>

  3. #include <colorchat>

  4.  

  5. public plugin_init()

  6. {

  7.         register_plugin("Donate", "1.0", "[email protected]");

  8.         register_clcmd("say /donate", "ShowMenu", _, "Передача денег между игроками");

  9.         register_clcmd("amx_donate", "donateAction");

  10.         register_clcmd("amx_donateremove", "removeAction");

  11.         register_clcmd("amx_donategive", "giveAction");

  12. }

  13.  

  14. public ShowMenu(id)

  15. {

  16.         if(get_user_flags(id) & ADMIN_MENU)

  17.         {

  18.                 new menu = menu_create("Передать денег игроку", "ShowMenuHandler");

  19.                

  20.                 menu_additem(menu, "Передать", "", 0); // case 0

  21.                 menu_additem(menu, "Дать", "", ADMIN_MENU); // case 1

  22.                 menu_additem(menu, "Забрать", "", ADMIN_MENU); // case 2

  23.                

  24.                 menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

  25.                 menu_setprop(menu, MPROP_EXITNAME, "Выход");

  26.                

  27.                 menu_display(id, menu, 0);

  28.         }

  29.         else

  30.         {

  31.                 donateMenu(id)

  32.         }

  33.         return PLUGIN_HANDLED;

  34. }

  35.  

  36. public ShowMenuHandler(id, menu, item)

  37. {

  38.         if(item == MENU_EXIT)

  39.         {

  40.                 menu_cancel(id);

  41.                 return PLUGIN_HANDLED;

  42.         }

  43.         new command[6], name[64], access, callback;

  44.        

  45.         menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

  46.        

  47.         switch(item)

  48.         {

  49.         case 0: {

  50.                         donateMenu(id)

  51.                 }

  52.         case 1: {

  53.                         selectPlayerFromGive(id)

  54.                 }

  55.         case 2: {

  56.                         selectPlayerFromRemove(id)

  57.                 }

  58.         }

  59.        

  60.         menu_destroy(menu);

  61.         return PLUGIN_HANDLED

  62. }

  63. public donateMenu(id)

  64. {

  65.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  66.  

  67.         new s_Players[32], i_Num, i_Player

  68.  

  69.         new s_Name[32], s_Player[10]

  70.  

  71.         get_players(s_Players, i_Num)

  72.         for (new i; i < i_Num; i++)

  73.         {

  74.                 i_Player = s_Players[i]

  75.  

  76.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  77.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  78.  

  79.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  80.  

  81.         }

  82.  

  83.         menu_display(id, i_Menu, 0)

  84.         return PLUGIN_HANDLED

  85. }

  86.  

  87. public donateMenuHandler(id, menu, item)

  88. {

  89.         if (item == MENU_EXIT)

  90.         {

  91.                 menu_destroy(menu)

  92.                 return PLUGIN_HANDLED

  93.         }

  94.  

  95.         new s_Data[6], s_Name[64], i_Access, i_Callback

  96.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  97.  

  98.         new i_Player = str_to_num(s_Data)

  99.  

  100.         client_cmd(id, "messagemode ^"amx_donate %i^"", i_Player);

  101.  

  102.         menu_destroy(menu)

  103.         return PLUGIN_HANDLED

  104. }

  105. public donateAction(id)

  106. {

  107.         new param[10]

  108.         read_argv(2, param, charsmax(param))

  109.         for (new x; x < strlen(param); x++)

  110.         {

  111.                 if(!isdigit(param[x]))

  112.                 {

  113.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  114.                         return PLUGIN_HANDLED

  115.                 }

  116.         }

  117.         new amount = str_to_num(param);

  118.         if (amount < 1)

  119.         {

  120.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  121.                 return PLUGIN_HANDLED

  122.         }

  123.         if (amount > 99999)

  124.         {

  125.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  126.                 return PLUGIN_HANDLED

  127.         }

  128.         read_argv(1, param, charsmax(param))

  129.         new i_Player = str_to_num(param)

  130.         new money       =       cs_get_user_money(i_Player)

  131.         new my_money    =       cs_get_user_money(id)

  132.         cs_set_user_money(i_Player, money + amount)

  133.         cs_set_user_money(id, my_money - amount)

  134.         new names[2][32]

  135.         get_user_name(id, names[0], 31)

  136.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Игрок ^4 %s^1 передал вам ^4 %s $", names[0], amount)

  137.        

  138.         return PLUGIN_HANDLED

  139. }

  140. /*** Дать ***/

  141. public selectPlayerFromGive(id)

  142. {

  143.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  144.  

  145.         new s_Players[32], i_Num, i_Player

  146.  

  147.         new s_Name[32], s_Player[10]

  148.  

  149.         get_players(s_Players, i_Num)

  150.         for (new i; i < i_Num; i++)

  151.         {

  152.                 i_Player = s_Players[i]

  153.  

  154.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  155.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  156.  

  157.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  158.  

  159.         }

  160.  

  161.         menu_display(id, i_Menu, 0)

  162.         return PLUGIN_HANDLED

  163. }

  164.  

  165. public selectPlayerFromGiveHandler(id, menu, item)

  166. {

  167.         if (item == MENU_EXIT)

  168.         {

  169.                 menu_destroy(menu)

  170.                 return PLUGIN_HANDLED

  171.         }

  172.  

  173.         new s_Data[6], s_Name[64], i_Access, i_Callback

  174.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  175.  

  176.         new i_Player = str_to_num(s_Data)

  177.  

  178.         client_cmd(id, "messagemode ^"amx_donategive %i^"", i_Player);

  179.  

  180.         menu_destroy(menu)

  181.         return PLUGIN_HANDLED

  182. }

  183. public giveAction(id)

  184. {

  185.         new param[10]

  186.         read_argv(2, param, charsmax(param))

  187.         for (new x; x < strlen(param); x++)

  188.         {

  189.                 if(!isdigit(param[x]))

  190.                 {

  191.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  192.                         return PLUGIN_HANDLED

  193.                 }

  194.         }

  195.         new amount = str_to_num(param);

  196.         if (amount < 1)

  197.         {

  198.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  199.                 return PLUGIN_HANDLED

  200.         }

  201.         if (amount > 99999)

  202.         {

  203.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  204.                 return PLUGIN_HANDLED

  205.         }

  206.         read_argv(1, param, charsmax(param))

  207.         new i_Player = str_to_num(param)

  208.         new money       =       cs_get_user_money(i_Player)

  209.         cs_set_user_money(i_Player, money + amount)

  210.         new names[2][32]

  211.         get_user_name(id, names[0], 31)

  212.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Админ ^4 %s^1 дал вам ^4 %s $", names[0], amount)

  213.        

  214.         return PLUGIN_HANDLED

  215. }

  216. /*** Забрать ***/

  217. public selectPlayerFromRemove(id)

  218. {

  219.         new i_Menu = menu_create("\rВыберите игрока:", "giveMoneyHandler")

  220.  

  221.         new s_Players[32], i_Num, i_Player

  222.  

  223.         new s_Name[32], s_Player[10]

  224.  

  225.         get_players(s_Players, i_Num)

  226.         for (new i; i < i_Num; i++)

  227.         {

  228.                 i_Player = s_Players[i]

  229.  

  230.                 get_user_name(i_Player, s_Name, charsmax(s_Name))

  231.                 num_to_str(i_Player, s_Player, charsmax(s_Player))

  232.  

  233.                 menu_additem(i_Menu, s_Name, s_Player, 0)

  234.  

  235.         }

  236.  

  237.         menu_display(id, i_Menu, 0)

  238.         return PLUGIN_HANDLED

  239. }

  240.  

  241. public selectPlayerFromRemoveHandler(id, menu, item)

  242. {

  243.         if (item == MENU_EXIT)

  244.         {

  245.                 menu_destroy(menu)

  246.                 return PLUGIN_HANDLED

  247.         }

  248.  

  249.         new s_Data[6], s_Name[64], i_Access, i_Callback

  250.         menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

  251.  

  252.         new i_Player = str_to_num(s_Data)

  253.  

  254.         client_cmd(id, "messagemode ^"amx_donateremove %i^"", i_Player);

  255.  

  256.         menu_destroy(menu)

  257.         return PLUGIN_HANDLED

  258. }

  259. public removeAction(id)

  260. {

  261.         new param[10]

  262.         read_argv(2, param, charsmax(param))

  263.         for (new x; x < strlen(param); x++)

  264.         {

  265.                 if(!isdigit(param[x]))

  266.                 {

  267.                         ColorChat(id, NORMAL, "^3[^4Money^3]^1 Введите целое число до 99999")

  268.                         return PLUGIN_HANDLED

  269.                 }

  270.         }

  271.         new amount = str_to_num(param);

  272.         if (amount < 1)

  273.         {

  274.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Минимальное значение ^4 1")

  275.                 return PLUGIN_HANDLED

  276.         }

  277.         if (amount > 99999)

  278.         {

  279.                 ColorChat(id, NORMAL, "^3[^4Money^3]^1 Максимальное значение ^4 99999")

  280.                 return PLUGIN_HANDLED

  281.         }

  282.         read_argv(1, param, charsmax(param))

  283.         new i_Player = str_to_num(param)

  284.         new money       =       cs_get_user_money(i_Player)

  285.         cs_set_user_money(i_Player, money - amount)

  286.         new names[2][32]

  287.         get_user_name(id, names[0], 31)

  288.         ColorChat(i_Player, NORMAL, "^3[^4Money^3]^1 Админ ^4 %s^1 забрал у вас ^4 %s $", names[0], amount)

  289.        

  290.         return PLUGIN_HANDLED

  291. }
[/pawn]

Спасибо)))

Добавлено спустя 10 минут 32 секунды:
НЕ работает чего то,проверь код

с какого *** я должен проверять ради тебя? Ты мне задание давал?! Я тебе основу дал, дальше сам.
Аватара пользователя
Vaillante
 
Сообщения: 493
Зарегистрирован: 28 окт 2013, 14:56
Откуда: ты?
Благодарил (а): 131 раз.
Поблагодарили: 90 раз.
Опыт программирования: Около 3 месяцев
Языки программирования: Counter-Strike 1.6

Re: Плагин /donate

Сообщение mega18 » 20 июл 2018, 01:23

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new g_iTimer

native dm_set_user_money(id, set)
native dm_get_user_money(id)
native dm_money_get_limit(id)
native get_user_hero(id)

new g_iMenuPlayers[33][32]
new g_iMenuPosition[33]
new g_iPlayer_Donate[33]

new Float:g_fTimerid[33]

new g_already

const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0


public plugin_init( )
{
register_clcmd( "say /donate" , "DonateMenu" )
register_clcmd( "Donate" , "DonateAmmo" )
register_menu("Donate Menu", KEYSMENU, "menu_player_list_don")
register_menu("Money Menu", KEYSMENU, "menu_money")
register_clcmd("say", "clcmd_say")

g_iTimer=180
set_task(1.0, "timer", 7884, _, _, "b")
}

public plugin_natives()
{
register_native("donate_show", "DonateMenu",1)
}

public timer() {
if(g_iTimer)g_iTimer--
else remove_task(7884)
}

show_menu_player_list(id, iPos)
{
if(iPos<0) return PLUGIN_HANDLED
new iPlayersNum
for(new i = 1; i <= 32; i++)
{
if(!is_user_connected(i) || i == id || fm_cs_get_user_team(i)!=fm_cs_get_user_team(id)) continue
g_iMenuPlayers[id][iPlayersNum++] = i;
}

new iStart = iPos * 8
if(iStart > iPlayersNum) iStart = iPlayersNum
iStart = iStart - (iStart % 8)
g_iMenuPosition[id] = iStart / 8
new iEnd = iStart + 8
if(iEnd > iPlayersNum) iEnd = iPlayersNum;
new szMenu[512], iLen
new iPagesNum = (iPlayersNum / 8 + ((iPlayersNum % 8) ? 1 : 0))

if(!iPagesNum){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Нету игроков")
return PLUGIN_HANDLED
}

iLen = formatex(szMenu, charsmax(szMenu), "\w Перевод денег \r[\y%d\r|\y%d\r]^n^n", iPos + 1, iPagesNum);

new szName[32], i, iKeys = (1<<9), b;
for(new a = iStart; a < iEnd; a++)
{
i = g_iMenuPlayers[id][a];
get_user_name(i, szName, charsmax(szName));
iKeys |= (1<<b);
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r[\y%d\r]\w %s \r(\y%d$\r)^n", ++b, szName, dm_get_user_money(i));
}
for(new i = b; i < 8; i++) iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n");
if(iEnd < iPlayersNum) formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n[\y9\r] \w%L^n[\y0\r] \w%L", "Далее", iPos ? "Назад" : "Выход")
else formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\r[\y0\r] \w%s", iPos ? "Назад" : "Выход")
return show_menu(id, KEYSMENU, szMenu, -1, "Donate Menu")
}

public menu_player_list_don(id, key)
{
if(!is_user_alive(id)){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Мертвым меню не доступно")
return PLUGIN_HANDLED
}

if(get_user_hero(id)||get_user_hero(g_iMenuPlayers[id][g_iMenuPosition[id] * 8 + key])) return PLUGIN_HANDLED

switch(key)
{
case 8: return show_menu_player_list(id, ++g_iMenuPosition[id]);
case 9: return show_menu_player_list(id, --g_iMenuPosition[id]);
default:
{
g_iPlayer_Donate[id]=g_iMenuPlayers[id][g_iMenuPosition[id] * 8 + key]
if(dm_get_user_money(g_iPlayer_Donate[id])>=dm_money_get_limit(g_iPlayer_Donate[id])){
DonateMenu(id)
client_printcolor(id, "^x01[^3Инфо^x01] ^x01У этого игрока ^x04максимум ^x01денег")
return PLUGIN_HANDLED
}
menu_disp_open(id)
}
}
return PLUGIN_HANDLED;
}

public menu_disp_open(id)
{
static menu[512], len
len = 0
new g_CurMoney=dm_get_user_money(id)
len += formatex(menu[len], charsmax(menu) - len, "\w Выберите сумму:^n\dВаши деньги: \y%d$^n^n", dm_get_user_money(id))
len += formatex(menu[len], charsmax(menu) - len, g_CurMoney>100?"\r[\y1\r]\w Передать \y100$^n":"\r[\y1\r]\d Передать 100$^n")
len += formatex(menu[len], charsmax(menu) - len, g_CurMoney>500?"\r[\y2\r]\w Передать \y500$^n":"\r[\y2\r]\d Передать 500$^n")
len += formatex(menu[len], charsmax(menu) - len, g_CurMoney>1000?"\r[\y3\r]\w Передать \y1000$^n":"\r[\y3\r]\d Передать 1000$^n")
len += formatex(menu[len], charsmax(menu) - len, g_CurMoney>5000?"\r[\y4\r]\w Передать \y5000$^n^n":"\r[\y4\r]\d Передать 5000$^n^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\y5\r]\w Передать \y%d$^n^n", g_CurMoney)
len += formatex(menu[len], charsmax(menu) - len, "\r[\y6\r]\y Передать свою сумму^n^n")
len += formatex(menu[len], charsmax(menu) - len, "^n\r[\y0\r]\w Выход")
show_menu(id, KEYSMENU, menu, -1, "Money Menu")
}

public menu_money(id, key)
{
if(!is_user_connected(g_iPlayer_Donate[id]))
{
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Этот игрок уже вышел с сервера")
return
}

if(!is_user_alive(id)){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Мертвым меню не доступно")
return
}

if(get_user_hero(id)||get_user_hero(g_iPlayer_Donate[id])) return

new g_CurMoney=dm_get_user_money(id)

switch(key)
{
case 0:{
if(g_CurMoney<100){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Недостаточно денег! ^x04(нужно 100$)")
return
}
donate_process(id, 100)
}
case 1:
{
if(g_CurMoney<500){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Недостаточно денег! ^x04(нужно 500$)")
return
}
donate_process(id, 500)
}

case 2:
{
if(g_CurMoney<1000){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Недостаточно денег! ^x04(нужно 1000$)")
return
}
donate_process(id, 1000)
}
case 3:
{
if(g_CurMoney<5000){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Недостаточно денег! ^x04(нужно 5000$)")
return
}
donate_process(id, 5000)
}
case 4:
{
if(g_CurMoney==0){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01У вас нет денег!")
return
}
donate_process(id, g_CurMoney)
}

case 5: client_cmd(id, "messagemode ^"Donate %i^"", g_iPlayer_Donate[id])
}
}


public DonateMenu( pPlayer )
{
if(!is_user_connected(pPlayer)) return PLUGIN_HANDLED

show_menu_player_list(pPlayer, g_iMenuPosition[pPlayer]=0)
return PLUGIN_HANDLED
}

public DonateAmmo(pPlayer)
{
if(!is_user_connected(pPlayer)) return PLUGIN_HANDLED

static g_param[7]
read_argv(2, g_param, charsmax(g_param))

for (new p; p < strlen(g_param); p++)
{
if(!isdigit(g_param[p])) {
client_print(pPlayer, print_center, "Ошибка перевода денег")
return 0
}
}

static g_Amount; g_Amount = str_to_num(g_param)

static g_Ammo; g_Ammo = dm_get_user_money(pPlayer)

if (g_Ammo < g_Amount){
client_print(pPlayer, print_center, "Недостаточно денег")
return 0
}

if(g_Amount<=0) {
client_print(pPlayer, print_center, "Неверная сумма")
return 0
}

read_argv(1, g_param, charsmax(g_param))
static g_Player ; g_Player = str_to_num(g_param)
if(!is_user_connected(g_Player)) return 0

static pAmmo; pAmmo = dm_get_user_money(g_Player)

dm_set_user_money(pPlayer, g_Ammo - g_Amount)
dm_set_user_money(g_Player, pAmmo + g_Amount)

static names[2][32]

get_user_name(pPlayer, names[0], 31)
get_user_name(g_Player, names[1], 31)

client_printcolor(0, "^x01[^3Инфо^x01] ^x04%s^x01 перевел [^x04%d $^x01] на счет ^x04%s^x01", names[0], g_Amount, names[1])

return 0
}

new g_msgChannel
new Float:g_Pos[4][] = {{0.0, 0.0}, {0.02, 0.14}, {-1.0, 0.2}, {-1.0, 0.7}}

public clcmd_say(id)
{
static g_param[6]; read_argv(1, g_param, charsmax(g_param))

for (new p; p < strlen(g_param); p++) if(!isdigit(g_param[p])) return PLUGIN_CONTINUE

new num=str_to_num(g_param)

if(num>=100&&num<=16000) {
if(!is_user_alive(id)) return PLUGIN_CONTINUE

if(get_gametime()<g_fTimerid[id]){
client_printcolor(id, "^x01[^3Инфо^x01] ^x01Подождите еще^x04 %d ^x01сек", floatround(g_fTimerid[id]-get_gametime()))
return PLUGIN_HANDLED
}

if(g_iTimer) {
if(g_iTimer/60>0) client_printcolor(id,"^x01[^3Инфо^x01] ^x01Подождите^x04 %d ^x01мин ^x01и^x04 %d ^x01сек", g_iTimer/60, g_iTimer-((g_iTimer/60)*60))
else client_printcolor(id,"^x01[^3Инфо^x01] ^x01Подождите еще^x04 %d ^x01сек", g_iTimer)
return PLUGIN_HANDLED
}

new name[32]; get_user_name(id, name, 31)
if (++g_msgChannel > 6 || g_msgChannel < 3)
g_msgChannel = 3

new Float:verpos = g_Pos[1][1] + float(g_msgChannel) / 35.0

if(g_already){
//set_hudmessage(255, 255, 255, 0.02, 0.19, 0, 6.0, 2.5, 5.0, 0.2, -1)
//show_hudmessage(0, "%s попросил %d$", name, num)
return PLUGIN_HANDLED
}
g_already=1

set_hudmessage(255, 255, 255, 0.02, 0.14, 2, 0.0, 2.0, 0.1, 0.2, -1)
for(new i = 1; i <= 32; i++)
{
if(!is_user_connected(i) || fm_cs_get_user_team(i)!=fm_cs_get_user_team(id)) continue

show_hudmessage(i, "%s попросил %d$", name, num)
}

g_fTimerid[id]=get_gametime()+10.0
set_task(3.0, "no_already")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}

public no_already()
{
g_already=0
}

stock donate_process(id, amount)
{
new g_CurMoney=dm_get_user_money(g_iPlayer_Donate[id])
new g_Limit=dm_money_get_limit(g_iPlayer_Donate[id])

if(g_CurMoney==g_Limit) return

new names[2][32]
get_user_name(id, names[0], 31)
get_user_name(g_iPlayer_Donate[id], names[1], 31)

if(g_CurMoney+amount>g_Limit) amount=g_Limit-g_CurMoney

dm_set_user_money(id, dm_get_user_money(id)-amount)
dm_set_user_money(g_iPlayer_Donate[id], dm_get_user_money(g_iPlayer_Donate[id])+amount)

client_printcolor(id, "^x01[^3Инфо^x01] ^x01Вы перевели ^x04%d$ ^x01на счет ^x04%s", amount, names[1])
client_printcolor(g_iPlayer_Donate[id], "^x01[^3Инфо^x01] ^x04%s^x01 перевел на ваш счет ^x04%d$", names[0], amount)
}

stock client_printcolor(const pPlayer, const input[], any:...)
{
static szMsg[191]
vformat(szMsg, charsmax(szMsg), input, 3)

if(pPlayer)
{
message_begin(MSG_ONE_UNRELIABLE, 76, _, pPlayer)
write_byte(pPlayer)
write_string(szMsg)
message_end()
}else{
static player
for (player = 1; player <= 32; player++)
{
if (!is_user_connected(player)) continue

message_begin(MSG_ONE_UNRELIABLE, 76, _, player)
write_byte(player)
write_string(szMsg)
message_end()
}
}
}

stock fm_cs_get_user_team(id)
{
if (pev_valid(id) != 2) return 0

return get_pdata_int(id, 114, 5)
}
Аватара пользователя
mega18
 
Сообщения: 7
Зарегистрирован: 13 май 2018, 22:12
Благодарил (а): 0 раз.
Поблагодарили: 0 раз.
Языки программирования: Pawn
SourcePawn
C++
Php
Ruby
Python
C#


Вернуться в Поиск плагинов

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 7