hlmod.hu
https://hlmod.hu/

Ellenfél a radaron
https://hlmod.hu/viewtopic.php?f=29&t=9610
Oldal: 1 / 1

Szerző:  Gatshow [ 2013.07.19. 20:43 ]
Hozzászólás témája:  Ellenfél a radaron

Hali!
Egy olyan plugint szeretnék kérni ami mutatja radar-on az ellenfelet is!
Előre is köszi!

Szerző:  pocok5 [ 2013.07.20. 00:41 ]
Hozzászólás témája:  Re: Ellenfél a radaron

Adminoknak: https://forums.alliedmods.net/showthread.php?t=8440

Szerző:  Gatshow [ 2013.07.20. 16:32 ]
Hozzászólás témája:  Re: Ellenfél a radaron

pocok5 írta:


megtudnád nekem ezt csinálni úgy hogy ne csak adminnak legyen?

Szerző:  pocok5 [ 2013.07.20. 16:52 ]
Hozzászólás témája:  Re: Ellenfél a radaron

Gatshow írta:
pocok5 írta:


megtudnád nekem ezt csinálni úgy hogy ne csak adminnak legyen?

Én nem :(

Szerző:  CrB [ 2013.07.22. 18:09 ]
Hozzászólás témája:  Re: Ellenfél a radaron

Próbáld
SMA Forráskód: [ Mindet kijelol ]
  1.  
  2. /* * * * * * * * * * * * * * * * * * * * * * * *
  3.  * Admin_radar, by BlueRaja (AMX Mod X) *
  4.  * *
  5.  * Special thanks to Damaged Soul *
  6.  * - not just for helping me when I needed it, *
  7.  * but for putting up with all my shit ^_^ *
  8.  * *
  9.  * (c) Copyright 2004 *
  10.  * This file is provided as is (no warranties) *
  11.  * * * * * * * * * * * * * * * * * * * * * * * */
  12.  
  13.  
  14. //Includes
  15. #include <amxmodx>
  16. #include <cstrike> //used for cs_get_user_team
  17.  
  18. //Defines
  19. #define ACCESS_LEVEL ADMIN_RCON //Default required admin level - don't want too many admins to have it, for the sake of speed
  20. #define REFRESH_TIME 1.0 //Amount of time, in seconds, between radar-refreshings
  21.  
  22. //Messages
  23. new gmsgBombDrop //Dropping of the bomb
  24. new gmsgHostagePos //Position of hostage(s)
  25. new gmsgHostageK //Hostage has been killed
  26.  
  27. //Globals
  28. new g_aAdminList[32], g_iAdminNum
  29. new g_aCTList[32], g_iCTNum
  30. new g_aTList[32], g_iTNum
  31. new g_iEnemyCounter, g_iHostageCounter //Both are used for keeping track of the enemy
  32. new g_iHostageModNum //Number with which to modulus hostage number; used to,
  33. //if there are less than 4 T's, kill a fake-hostage blip.
  34. new bool:g_bBombHeld
  35.  
  36. //Refreshes the list of admins
  37. public refresh_admin()
  38. {
  39. new aTemp[32], iTempNum
  40. get_players(aTemp, iTempNum, "c")//Skip bots
  41.  
  42. g_iAdminNum=0
  43. for (new i=0; i<iTempNum; i++) {
  44. {
  45. g_aAdminList[g_iAdminNum]=aTemp[i]
  46. g_iAdminNum++
  47. }//end if
  48. }//end for
  49. return PLUGIN_HANDLED
  50. }//end refresh_admin
  51.  
  52. //Refresh list of terrorists
  53. public refresh_t() {
  54. get_players(g_aTList, g_iTNum, "ae", "TERRORIST")
  55. if (g_iTNum<4 && g_iHostageModNum!=g_iTNum) {
  56. g_iHostageModNum=g_iTNum //Only modulus with this number now
  57.  
  58. //If there are three players left, then we want to fake-kill the fourth fake-hostage,
  59. //so that there aren't two blips on the radar for one player
  60. for(new i=0; i<g_iAdminNum; i++) {
  61. if (cs_get_user_team(g_aAdminList[i])==CS_TEAM_CT) {
  62. message_begin(MSG_ONE, gmsgHostageK, {0,0,0}, g_aAdminList[i])
  63. write_byte(g_iTNum+1) //Hostage to take off of radar
  64. message_end()
  65. }//end if
  66. }//end for
  67. }//end if
  68. }//end refresh_t()
  69.  
  70. //Refresh list of CT's
  71. #define refresh_ct() get_players(g_aCTList, g_iCTNum, "ae", "CT")
  72. //I wanted the above to be an inline function, but I don't think Small supports that,
  73. // so I used a macro instead
  74.  
  75. //This function will be called every second; it should display a single blip for a certain player
  76. public radar_event(id)
  77. {
  78. if(!g_iAdminNum || !g_iCTNum || !g_iTNum) return PLUGIN_HANDLED
  79.  
  80. new iEnemyT = g_aTList[g_iEnemyCounter%g_iTNum] //Cycle through the living Ts
  81. new iCoordsT[3]
  82. get_user_origin(iEnemyT, iCoordsT)
  83.  
  84. new iEnemyCT = g_aCTList[g_iEnemyCounter++%g_iCTNum]
  85. new iCoordsCT[3]
  86. get_user_origin(iEnemyCT, iCoordsCT)
  87.  
  88. new iHostageNum = (g_iHostageCounter++)%g_iHostageModNum + 1
  89.  
  90. for(new i=0; i<g_iAdminNum; i++)
  91. {
  92. //At this point, we know we want to send the message to the admin
  93. if (cs_get_user_team(g_aAdminList[i])==CS_TEAM_T) {
  94. if (g_bBombHeld) { //If bomb is on the ground, the admins need to see it on their radar
  95. message_begin(MSG_ONE, gmsgBombDrop, {0,0,0}, g_aAdminList[i])
  96. write_coord(iCoordsCT[0]) //X Coordinate
  97. write_coord(iCoordsCT[1]) //Y Coordinate
  98. write_coord(iCoordsCT[2]) //Z Coordinate
  99. write_byte(0) //?? This byte seems to always be 0...so, w/e
  100. message_end()
  101. }
  102. }
  103. else { //assume player is CT
  104. message_begin(MSG_ONE, gmsgHostagePos, {0,0,0}, g_aAdminList[i])
  105. write_byte(1) //No idea what this byte does; I think it has something to do with whether or not the hostage is following someone
  106. write_byte(iHostageNum) //The number of the hostage, 1-4
  107. write_coord(iCoordsT[0]) //X Coordinate
  108. write_coord(iCoordsT[1]) //Y Coordinate
  109. write_coord(iCoordsT[2]) //Z Coordinate
  110. message_end()
  111. }//end if
  112. }//end for
  113. return PLUGIN_HANDLED
  114. }//end radar_event
  115.  
  116. //Called at round start
  117. public RoundStart()
  118. {
  119. new Float:fRoundTime = get_cvar_float("mp_roundtime") * 60.0
  120. new iTimeLeft = read_data(1)
  121.  
  122. if (fRoundTime == iTimeLeft) { //Roundstart after freezetime
  123. g_iHostageCounter = 0
  124. g_iEnemyCounter = 0
  125. g_iHostageModNum = 4
  126. g_bBombHeld = true
  127. refresh_t()
  128. refresh_ct()
  129.  
  130. //The hostage "killed" is only #(g_iTNum+1); however, apparently when the engine receieves a HostagePos message,
  131. //It assumes there are four hostages. Therefore, when playing with less than three people, the hostages not represented
  132. //by players and not yet killed are set, by default, at the center of the map. To fix this, I'll have to kill hostage #4
  133. //(if there are two players) or hostages #3 & #4 (if there is only one player)
  134. if (g_iTNum<3) {
  135. for (new i=g_iTNum+2; i<=4; i++) {
  136. for(new j=0; j<g_iAdminNum; j++) {
  137. message_begin(MSG_ONE, gmsgHostageK, {0,0,0}, g_aAdminList[j])
  138. write_byte(i) //Hostage to take off of radar
  139. message_end()
  140. }//end for
  141. }//end for
  142. }//end if
  143. }//end if
  144. return PLUGIN_CONTINUE
  145. }//end RoundStart
  146.  
  147. //Initialization
  148. public plugin_init()
  149. {
  150. gmsgBombDrop = get_user_msgid("BombDrop")
  151. gmsgHostagePos = get_user_msgid("HostagePos")
  152. gmsgHostageK = get_user_msgid("HostageK")
  153. register_event("RoundTime", "RoundStart", "bc")
  154. register_event("BombDrop", "Bomb_Drop", "bc")
  155. register_event("BombPickup", "Bomb_Pickup", "bc")
  156. register_plugin("Admin Radar","1.1","BlueRaja")
  157. register_concmd("amx_refresh","refresh_admin",ACCESS_LEVEL," - refresh admin slots(adminradar)")
  158. set_task(REFRESH_TIME, "radar_event", _, _, _, "b")
  159. return PLUGIN_CONTINUE
  160. }
  161.  
  162. //refresh list on client connect/disconnect
  163. public client_authorized(id)
  164. {
  165. refresh_admin()
  166. }
  167. public client_disconnect(id)
  168. {
  169. refresh_admin()
  170. refresh_t()
  171. refresh_ct()
  172. }
  173.  
  174. //Refresh list of players on client death
  175. public client_kill(id)//Called when a player kills himself
  176. {
  177. if (cs_get_user_team(id)==CS_TEAM_T) {
  178. refresh_t()
  179. }
  180. else{
  181. refresh_ct()
  182. }
  183. }
  184.  
  185. public client_death(killer, victim, weapon, hitplace, TK) //Called when a player dies
  186. {
  187. if (cs_get_user_team(victim)==CS_TEAM_T) {
  188. refresh_t()
  189. }
  190. else{
  191. refresh_ct()
  192. }
  193. }
  194.  
  195. public Bomb_Drop()
  196. {
  197. g_bBombHeld = false
  198. }
  199.  
  200. public Bomb_Pickup()
  201. {
  202. g_bBombHeld = true
  203. }
  204.  

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/