HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4. #include <cstrike>
  5.  
  6. new g_counter
  7.  
  8. new g_SyncRestartTimer
  9. new g_SyncGameStart
  10.  
  11. new Float:RoundStartTime
  12.  
  13. new g_Time_Interval;
  14. const MAX_PLAYERS = 32;
  15.  
  16. new g_iRespawn[MAX_PLAYERS+1], g_TeamInfoCounter[MAX_PLAYERS+1], CsTeams:g_iPlayerTeam[MAX_PLAYERS+1];
  17. new g_pCvarRespawnTime, g_pCvarRespawnDelay, g_pCvarMaxHealth;
  18.  
  19. public plugin_init()
  20. {
  21. register_plugin("Dr.Respawn", "1.2", "Vicious Vixen");
  22. RegisterHam(Ham_Killed, "player", "fwdPlayerKilledPost", 1);
  23. RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawnPost", 1);
  24. register_event("TeamInfo", "eTeamInfo", "a");
  25. register_logevent( "LogEventRoundStart", 2, "1=Round_Start" )
  26. g_pCvarRespawnTime = register_cvar("amx_respawn_tickets", "0"); //Set to 0 for unlimited respawns
  27. g_pCvarRespawnDelay = register_cvar("amx_respawn_delay", "1");
  28. g_pCvarMaxHealth = register_cvar("amx_max_health", "100");
  29. g_Time_Interval = register_cvar("amx_max_time", "20");
  30. set_msg_block( get_user_msgid( "ClCorpse" ), BLOCK_SET );
  31.  
  32. g_SyncRestartTimer = CreateHudSyncObj()
  33. g_SyncGameStart = CreateHudSyncObj()
  34.  
  35. }
  36.  
  37. public LogEventRoundStart()
  38. {
  39. RoundStartTime = get_gametime()
  40.  
  41. new iPlayers[32]
  42. new iNum
  43.  
  44. get_players( iPlayers, iNum )
  45.  
  46. for( new i = 0; i < iNum; i++ )
  47. {
  48. g_iRespawn[iPlayers[i]] = true
  49. }
  50. set_task(1.0,"TimeCounter",123456,_,_,"a",get_pcvar_num(g_Time_Interval))
  51. set_task(get_pcvar_float(g_Time_Interval),"Runda_Terminata",789123)
  52. }
  53.  
  54. public Runda_Terminata()
  55. {
  56. if(RoundStartTime)
  57. {
  58. set_hudmessage( 255, 0, 0, 0.09, 0.00, 1, 0.5, 1.0, 0.5, 15.0, -1)
  59. ShowSyncHudMsg( 0, g_SyncGameStart, "Újra éledés vége!")
  60. }
  61. }
  62.  
  63. public fwdPlayerKilledPost(iVictim, iKiller, iShoudlGib)
  64. {
  65. if(g_iRespawn[iVictim]++ < get_pcvar_num(g_pCvarRespawnTime) || get_pcvar_num(g_pCvarRespawnTime) == 0)
  66. {
  67. set_task(get_pcvar_float(g_pCvarRespawnDelay), "taskRespawnPlayer", iVictim);
  68. }
  69. return HAM_IGNORED;
  70. }
  71.  
  72. public fwdPlayerSpawnPost(iClient)
  73. {
  74. if(is_user_alive(iClient))
  75. {
  76. set_pev(iClient, pev_health, get_pcvar_float(g_pCvarMaxHealth));
  77. }
  78. }
  79.  
  80. public taskRespawnPlayer(id)
  81. {
  82. if(is_user_connected(id) && RoundStartTime + get_pcvar_num(g_Time_Interval) >= get_gametime() && g_iRespawn[id] && !is_user_alive(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR) {
  83. ExecuteHamB(Ham_CS_RoundRespawn, id)
  84. g_iRespawn[id] = false
  85. return PLUGIN_HANDLED;
  86. }
  87. return PLUGIN_HANDLED;
  88. }
  89.  
  90. public eTeamInfo()
  91. {
  92. new iClient = read_data(1);
  93. new szTeam[2];
  94. read_data(2, szTeam, charsmax(szTeam));
  95. switch(szTeam[0])
  96. {
  97. case 'T':
  98. {
  99. remove_task(iClient);
  100. g_iPlayerTeam[iClient] = CS_TEAM_T;
  101. }
  102. case 'C':
  103. {
  104. if(g_TeamInfoCounter[iClient] == 2 || g_iPlayerTeam[iClient] == CS_TEAM_SPECTATOR)
  105. {
  106. set_task(get_pcvar_float(g_pCvarRespawnDelay), "taskRespawnPlayer", iClient);
  107. }
  108. g_iPlayerTeam[iClient] = CS_TEAM_CT;
  109. }
  110. case 'S':
  111. {
  112. remove_task(iClient);
  113. g_iPlayerTeam[iClient] = CS_TEAM_SPECTATOR;
  114. }
  115. }
  116. }
  117.  
  118. public TimeCounter()
  119. {
  120. g_counter++
  121.  
  122. new Float:iRestartTime = get_pcvar_float(g_Time_Interval) - g_counter
  123. new Float:fSec
  124. fSec = iRestartTime
  125.  
  126. set_hudmessage( 255, 0, 0, 0.09, 0.0, 1, 0.0, 1.0, 0.0, 0.0, -1)
  127. ShowSyncHudMsg( 0, g_SyncRestartTimer, "Újraéledés még %d másodpercig.", floatround(fSec))
  128.  
  129. if(get_pcvar_num(g_Time_Interval) - g_counter < 11 && get_pcvar_num(g_Time_Interval) - g_counter !=0)
  130. {
  131. static szNum[32]
  132. num_to_word(get_pcvar_num(g_Time_Interval) - g_counter, szNum, 31)
  133. }
  134. if(g_counter == get_pcvar_num(g_Time_Interval))
  135. {
  136. g_counter = 0
  137. }
  138. }
  139. stock print_color(const id, const input[], any:...)
  140. {
  141. new count = 1, players[32]
  142. static msg[191]
  143. vformat(msg, 190, input, 3)
  144.  
  145. replace_all(msg, 190, "!g", "^4")
  146. replace_all(msg, 190, "!y", "^1")
  147. replace_all(msg, 190, "!t", "^3")
  148. replace_all(msg, 190, "", "á")
  149. replace_all(msg, 190, "", "é")
  150. replace_all(msg, 190, "", "í")
  151. replace_all(msg, 190, "", "ó")
  152. replace_all(msg, 190, "", "ö")
  153. replace_all(msg, 190, "", "ő")
  154. replace_all(msg, 190, "", "ú")
  155. replace_all(msg, 190, "", "ü")
  156. replace_all(msg, 190, "", "ű")
  157. replace_all(msg, 190, "", "Á")
  158. replace_all(msg, 190, "", "É")
  159. replace_all(msg, 190, "", "Í")
  160. replace_all(msg, 190, "", "Ó")
  161. replace_all(msg, 190, "", "Ö")
  162. replace_all(msg, 190, "", "Ő")
  163. replace_all(msg, 190, "", "Ú")
  164. replace_all(msg, 190, "", "Ü")
  165. replace_all(msg, 190, "", "Ű")
  166.  
  167. if (id) players[0] = id; else get_players(players, count, "ch")
  168. {
  169. for (new i = 0; i < count; i++)
  170. {
  171. if (is_user_connected(players[i]))
  172. {
  173. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  174. write_byte(players[i])
  175. write_string(msg)
  176. message_end()
  177. }
  178. }
  179. }
  180. return PLUGIN_HANDLED
  181. }
  182. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  183. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  184. */
  185.