Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fakemeta>
  4. #include <fakemeta_util>
  5. #include <hamsandwich>
  6.  
  7. #define PLUGIN "FURIEN EVENT - Last player"
  8. #define VERSION "1.0"
  9. #define AUTHOR "DaNNe."
  10.  
  11. new FURIENS, ANTIFURIENS;
  12.  
  13. public plugin_init() {
  14. register_plugin(PLUGIN, VERSION, AUTHOR)
  15.  
  16. register_event("DeathMsg", "EVENT_Death", "a")
  17. register_event("HLTV", "NEW_ROUND", "a", "1=0", "2=0")
  18. RegisterHam(Ham_Spawn, "player", "SPAWN", 1)
  19. }
  20.  
  21. public client_disconnect(id) {
  22. switch(get_user_team(id)) {
  23. case 1: FURIENS--
  24. case 2: ANTIFURIENS--
  25. }
  26. if(FURIENS == 1 && ANTIFURIENS == 1)
  27. set_task(0.2, "TASK_CHECK")
  28. }
  29.  
  30. public SPAWN(id) {
  31. if(is_user_connected(id) && is_user_alive(id)) {
  32. switch(get_user_team(id)) {
  33. case 1: FURIENS++
  34. case 2: ANTIFURIENS++
  35. }
  36. }
  37. }
  38.  
  39. public NEW_ROUND() {
  40. FURIENS = 0
  41. ANTIFURIENS = 0
  42. }
  43.  
  44. public EVENT_Death() {
  45. new Attacker = read_data(1),
  46. Victim = read_data(2)
  47. if(is_user_connected(Attacker) && is_user_connected(Victim)) {
  48. switch(get_user_team(Victim)) {
  49. case 1: FURIENS--
  50. case 2: ANTIFURIENS--
  51. }
  52. if(FURIENS == 1 && ANTIFURIENS == 1)
  53. set_task(0.2, "TASK_CHECK")
  54. }
  55. }
  56.  
  57. public TASK_CHECK() {
  58. new FURIEN = GETPLAYERS(1),
  59. ANTIFURIEN = GETPLAYERS(2),
  60. FurienName[32], FurienNameLen = charsmax(FurienName),
  61. AntiFurienName[32], AntiFurienNameLen = charsmax(AntiFurienName)
  62. if(is_user_alive(FURIEN) && is_user_alive(ANTIFURIEN)) {
  63. get_user_name(FURIEN, FurienName, FurienNameLen)
  64. get_user_name(ANTIFURIEN, AntiFurienName, AntiFurienNameLen)
  65. ColorChat(0, "!g[FURIEN EVENT]!n JUCATORUL!t %s!n este ultimul!t FURIEN!n ramas in viata (BONUS:!t +$3000!n).", FurienName)
  66. ColorChat(0, "!g[FURIEN EVENT]!n JUCATORUL!t %s!n este ultimul!t ANTI-FURIEN!n ramas in viata (BONUS:!t +$3000!n).", AntiFurienName)
  67. ColorChat(0, "!g[FURIEN EVENT]!t %s!n vs.!t %s!n. Oare cine va castiga?!", FurienName, AntiFurienName)
  68. cs_set_user_money(FURIEN, cs_get_user_money(FURIEN) + 3000)
  69. cs_set_user_money(ANTIFURIEN, cs_get_user_money(ANTIFURIEN) + 3000)
  70. }
  71. }
  72. stock GETPLAYERS(TEAM) {
  73. new Players[32], Num, id, PlayerID;
  74. get_players(Players, Num, "ach")
  75. for(new i = 0; i < Num; i++) {
  76. PlayerID = Players[i]
  77. if(is_user_alive(PlayerID)) {
  78. if(get_user_team(PlayerID) == TEAM)
  79. id = PlayerID;
  80. }
  81. }
  82. return id
  83. }
  84.  
  85. stock ColorChat(const id, const input[], any:...) {
  86. new count = 1, players[32];
  87. static msg[191];
  88. vformat(msg, 190, input, 3);
  89.  
  90. replace_all(msg, 190, "!g", "^4");
  91. replace_all(msg, 190, "!n", "^1");
  92. replace_all(msg, 190, "!t", "^3");
  93.  
  94. if(id) players[0] = id;
  95. else get_players(players, count, "c");
  96. for(new i = 0; i < count; i++) {
  97. if(is_user_connected(players[i])) {
  98. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  99. write_byte(players[i]);
  100. write_string(msg);
  101. message_end();
  102. }
  103. }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement