seroff

Respawn For Money By Seroff

Jul 6th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. #define OFFSET_CSMONEY 115
  5.  
  6. public plugin_init() {
  7. register_plugin("Respawn for money", "1.0", "Seroff");
  8. register_clcmd("say /respawn", "RespawnMoney");
  9. }
  10.  
  11. public RespawnMoney(id)
  12. {
  13. new money = cs_get_user_money(id);
  14. new name[32];
  15. get_user_name(id, name, 31);
  16. if(!is_user_alive(id))
  17. {
  18. if(money < 1000)
  19. {
  20. ColorChat(id, "^1[^4Respawn^1] У Вас недостаточно средств для того чтобы воскреситься!")
  21. } else {
  22. cs_set_user_money(id, money - 1000);
  23. cs_user_spawn(id);
  24. ColorChat(0, "^1[^4Respawn^1] Игрок ^4%s ^1воскресился!", name);
  25. }
  26. } else {
  27. ColorChat(id, "^1[^4Respawn^1] Вы живы!")
  28. return PLUGIN_HANDLED;
  29. }
  30. return PLUGIN_HANDLED;
  31. }
  32.  
  33.  
  34.  
  35. stock ColorChat(const id, const input[], any:...)
  36. {
  37. new count = 1, players[32]
  38. static msg[191]
  39. vformat(msg, 190, input, 3)
  40.  
  41. replace_all(msg, 190, "!g", "^4") // Зелёный
  42. replace_all(msg, 190, "!n", "^1") // Стандартный
  43. replace_all(msg, 190, "!t", "^3") // Цвет команды
  44.  
  45. if (id) players[0] = id; else get_players(players, count, "ch")
  46. {
  47. for (new i = 0; i < count; i++)
  48. {
  49. if (is_user_connected(players[i]))
  50. {
  51. message_begin(MSG_ONE, get_user_msgid("SayText"), _, players[i])
  52. write_byte(players[i]);
  53. write_string(msg);
  54. message_end();
  55. }
  56. }
  57. }
  58. }
  59.  
  60. /* cstrike stock`s generated using fakemeta */
  61.  
  62. stock cs_user_spawn(id) {
  63. set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
  64. dllfunc(DLLFunc_Spawn, id)
  65. set_pev(id, pev_iuser1, 0)
  66. }
  67.  
  68. stock cs_set_user_money(index, money, flash = 1)
  69. {
  70. set_pdata_int(index, OFFSET_CSMONEY, money)
  71. message_begin(MSG_ONE, get_user_msgid("Money"), _, index)
  72. write_long(money)
  73. write_byte(flash ? 1 : 0)
  74. message_end()
  75. }
  76.  
  77. stock cs_get_user_money(index)
  78. {
  79. return get_pdata_int(index, OFFSET_CSMONEY)
  80. }
Add Comment
Please, Sign In to add comment