seroff

[Death PSpawn] 0.1.1 By Sn1k3rS+Seroff

Jul 8th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <hamsandwich>
  4.  
  5. #define PLUGIN "[Death PSpawn]"
  6. #define VERSION "0.1.1"
  7. #define AUTHOR "Sn1k3rS+Seroff"
  8.  
  9. #define g_CostRespawn get_pcvar_num(cvarcostrespawn)
  10.  
  11. const KEYSMENU = MENU_KEY_1|MENU_KEY_2
  12.  
  13. new cvarcostrespawn,cvar_dp_respawn;
  14.  
  15. public plugin_init()
  16. {
  17. register_plugin(PLUGIN, VERSION, AUTHOR )
  18. RegisterHam(Ham_Killed, "player", "g_Spawn");
  19. register_logevent("round_end", 2, "1=Round_End");
  20. register_menu("respawnmenu", KEYSMENU, "menu_respawn");
  21. cvarcostrespawn = register_cvar("dp_cost_respawn", "8000"); //Cost the respawn
  22. cvar_dp_respawn = register_cvar("dp_enable", "1"); //on: 1/off: 2
  23. }
  24.  
  25. public round_end(){
  26. new Players[32],Num;
  27. get_players(Players,Num);
  28. for(new id=1;id<=Num;id++){
  29. show_menu(id, 0, "^n^n^n^n^n^n^n^n^n", 1, "respawnmenu");
  30. }
  31. }
  32.  
  33. public close_menu(id){
  34. show_menu(id, 0, "^n^n^n^n^n^n^n^n^n", 1, "respawnmenu");
  35. }
  36.  
  37. public g_Spawn(id)
  38. {
  39. if(!(get_pcvar_num(cvar_dp_respawn)))
  40. {
  41. return PLUGIN_CONTINUE
  42. }
  43. if(cs_get_user_money(id) >= g_CostRespawn)
  44. {
  45. OpenRespawnMenu(id);
  46. }
  47. return PLUGIN_HANDLED
  48. }
  49.  
  50. public OpenRespawnMenu(id)
  51. {
  52. new g_Money = cs_get_user_money(id)
  53. static menu[512], len;
  54. len = 0;
  55. len += formatex(menu[len], charsmax(menu) - len, "\yВозродиться за \r%d $\y?^n\wТвои деньги\d: \r%d $ ^n^n",g_CostRespawn,g_Money);
  56. len += formatex(menu[len], charsmax(menu) - len, "\w1. \yДа^n");
  57. len += formatex(menu[len], charsmax(menu) - len, "\w2. \rНет");
  58. show_menu(id, KEYSMENU, menu, -1, "respawnmenu");
  59. return PLUGIN_CONTINUE
  60. }
  61.  
  62. public menu_respawn( id, key )
  63. {
  64. switch ( key )
  65. {
  66. case 0:
  67. {
  68. if(cs_get_user_money(id) < g_CostRespawn)
  69. {
  70. ColorChat(id, "^1[^4Spawn^1]^1 У Вас ^3не хватает денег^1!")
  71. return PLUGIN_HANDLED
  72. }
  73. new name[32]
  74. get_user_name(id, name, 31)
  75. ExecuteHamB(Ham_CS_RoundRespawn,id)
  76. cs_set_user_money(id, cs_get_user_money(id) - g_CostRespawn)
  77. ColorChat(0, "^1[^4Spawn^1]^1 Игрок ^3%s^1 купил возрождение!",name)
  78. }
  79. case 1:
  80. {
  81. ColorChat(id, "^1[^4Spawn^1]^1 Вы ^3отказались^1 от покупки возрождения!")
  82. return PLUGIN_HANDLED
  83. }
  84. }
  85. return PLUGIN_HANDLED
  86. }
  87.  
  88.  
  89. stock register_menu(const title[],keys,const function[],outside=0)
  90. {
  91. register_menucmd(register_menuid(title,outside),keys,function);
  92. }
  93.  
  94. stock ColorChat(const id, const input[], any:...)
  95. {
  96. new count = 1, players[32];
  97. static msg[191];
  98. vformat(msg, 190, input, 3);
  99.  
  100. replace_all(msg, 190, "!g", "^4"); // Зелёный
  101. replace_all(msg, 190, "!y", "^1"); // Стандартный
  102. replace_all(msg, 190, "!t", "^3"); // Цвет команды
  103.  
  104. if (id) players[0] = id; else get_players(players, count, "ch")
  105. {
  106. for (new i = 0; i < count; i++)
  107. {
  108. if (is_user_connected(players[i]))
  109. {
  110. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  111. write_byte(players[i]);
  112. write_string(msg);
  113. message_end();
  114. }
  115. }
  116. }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment