hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.08.03. 00:43



Jelenlévő felhasználók

Jelenleg 385 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 384 vendég

A legtöbb felhasználó (2883 fő) 2025.07.30. 16:00-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Rang javítás
HozzászólásElküldve:2013.10.10. 17:46 
Offline
Felfüggesztve

Csatlakozott:2013.08.09. 22:37
Hozzászólások:571
Megköszönt másnak: 10 alkalommal
Megköszönték neki: 85 alkalommal
Na csó.

Valaki javítaná ezt hogy ne logoljon olyanokat : MSG_ONE_UNREALIBE or MSG_ONE no target entity.
SMA Forráskód: [ Mindet kijelol ]
  1.  
  2. #include <amxmodx>
  3. #include <amxmisc>
  4.  
  5. #define PLUGIN "Admin Chat Colors"
  6. #define VERSION "2.0"
  7. #define AUTHOR "Arion"
  8.  
  9. #define ACCESS_LEVEL ADMIN_IMMUNITY
  10. #define ADMIN_LISTEN ADMIN_LEVEL_C
  11.  
  12. new message[192]
  13. new sayText
  14. new teamInfo
  15. new maxPlayers
  16.  
  17. new g_MessageColor
  18. new g_NameColor
  19. new g_AdminListen
  20.  
  21. new strName[191]
  22. new strText[191]
  23. new alive[11]
  24.  
  25. new const g_szTag[][] = {
  26. "", // DO NOT REMOVE
  27. "[Tulaj]",
  28. "[Felügyelő]",
  29. "[VIP]",
  30. "[Jatekos]"
  31. }
  32.  
  33. new const g_iTagFlag[sizeof(g_szTag)] = {
  34. ADMIN_ALL, // DO NOT REMOVE
  35. ADMIN_IMMUNITY,
  36. ADMIN_BAN,
  37. ADMIN_RESERVATION,
  38. ADMIN_LEVEL_B
  39. }
  40.  
  41. public plugin_init()
  42. {
  43. register_plugin(PLUGIN, VERSION, AUTHOR)
  44.  
  45. g_MessageColor = register_cvar("amx_color", "4") // Message colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red
  46. g_NameColor = register_cvar("amx_namecolor", "2") // Name colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red, [6] Team-color
  47. g_AdminListen = register_cvar("amx_listen", "1") // Set whether admins see or not all messages(Alive, dead and team-only)
  48.  
  49.  
  50. sayText = get_user_msgid("SayText")
  51. teamInfo = get_user_msgid("TeamInfo")
  52. maxPlayers = get_maxplayers()
  53.  
  54.  
  55. register_message(sayText, "avoid_duplicated")
  56.  
  57. register_concmd("amx_color", "set_color", ACCESS_LEVEL, "<color>")
  58. register_concmd("amx_namecolor", "set_name_color", ACCESS_LEVEL, "<color>")
  59. register_concmd("amx_listen", "set_listen", ACCESS_LEVEL, "<1 | 0>")
  60. register_clcmd("say", "hook_say")
  61. register_clcmd("say_team", "hook_teamsay")
  62. }
  63.  
  64.  
  65. public avoid_duplicated(msgId, msgDest, receiver)
  66. {
  67. return PLUGIN_HANDLED
  68. }
  69.  
  70. get_tag_index(id)
  71. {
  72. new flags = get_user_flags(id)
  73.  
  74. for(new i = 1; i < sizeof(g_iTagFlag); i++)
  75. {
  76. if(check_admin_flag(flags, g_iTagFlag[i]))
  77. {
  78. return i
  79. }
  80. }
  81.  
  82. return 0
  83. }
  84.  
  85. check_admin_flag(flags, flag)
  86. {
  87. if(flag == ADMIN_ADMIN)
  88. {
  89. return ((flags & ~ADMIN_USER) > 0)
  90. }
  91. else if(flag == ADMIN_ALL)
  92. {
  93. return 1
  94. }
  95.  
  96. return (flags & flag)
  97. }
  98.  
  99. public hook_say(id)
  100. {
  101. read_args(message, 191)
  102. remove_quotes(message)
  103.  
  104. // Gungame commands and empty messages
  105. if(message[0] == '@' || message[0] == '/' || message[0] == '!' || equal(message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  106. return PLUGIN_CONTINUE
  107.  
  108. new name[32]
  109. get_user_name(id, name, 31)
  110.  
  111. new admin = get_tag_index(id)
  112.  
  113. new isAlive
  114.  
  115. if(is_user_alive(id))
  116. {
  117. isAlive = 1
  118. alive = "^x01"
  119. }
  120. else
  121. {
  122. isAlive = 0
  123. alive = "^x01->HALOTT<--"
  124. }
  125.  
  126. static color[10]
  127.  
  128. if(admin)
  129. {
  130. // Name
  131. switch(get_pcvar_num(g_NameColor))
  132. {
  133. case 1:
  134. format(strName, 191, "^x04%s %s%s", g_szTag[admin], alive, name)
  135. case 2:
  136. format(strName, 191, "^x04%s %s^x04%s ", g_szTag[admin], alive, name)
  137. case 3:
  138. {
  139. color = "SPECTATOR"
  140. format(strName, 191, "^x04%s %s^x03%s ", g_szTag[admin], alive, name)
  141. }
  142. case 4:
  143. {
  144. color = "CT"
  145. format(strName, 191, "^x04%s %s^x03%s", g_szTag[admin], alive, name)
  146. }
  147. case 5:
  148. {
  149. color = "TERRORIST"
  150. format(strName, 191, "^x04%s %s^x03%s", g_szTag[admin], alive, name)
  151. }
  152. case 6:
  153. {
  154. get_user_team(id, color, 9)
  155. format(strName, 191, "^x04%s %s^x03%s", g_szTag[admin], alive, name)
  156. }
  157. }
  158.  
  159. // Message
  160. switch(get_pcvar_num(g_MessageColor))
  161. {
  162. case 1: // Yellow
  163. format(strText, 191, "%s", message)
  164. case 2: // Green
  165. format(strText, 191, "^x04%s", message)
  166. case 3: // White
  167. {
  168. copy(color, 9, "SPECTATOR")
  169. format(strText, 191, "^x03%s", message)
  170. }
  171. case 4: // Blue
  172. {
  173. copy(color, 9, "CT")
  174. format(strText, 191, "^x03%s", message)
  175. }
  176. case 5: // Red
  177. {
  178. copy(color, 9, "TERRORIST")
  179. format(strText, 191, "^x03%s", message)
  180. }
  181. }
  182. }
  183. else // Player is not admin. Team-color name : Yellow message
  184. {
  185. get_user_team(id, color, 9)
  186. format(strName, 191, "%s^x03%s", alive, name)
  187. format(strText, 191, "%s", message)
  188. }
  189.  
  190. format(message, 191, "%s^x01 : %s", strName, strText)
  191.  
  192. sendMessage(color, isAlive) // Sends the colored message
  193.  
  194. return PLUGIN_CONTINUE
  195. }
  196.  
  197.  
  198. public hook_teamsay(id)
  199. {
  200. new playerTeam = get_user_team(id)
  201. new playerTeamName[19]
  202.  
  203. switch(playerTeam) // Team names which appear on team-only messages
  204. {
  205. case 1:
  206. copy(playerTeamName, 11, "Terrorists")
  207.  
  208. case 2:
  209. copy(playerTeamName, 18, "Counter-Terrorists")
  210.  
  211. default:
  212. copy(playerTeamName, 9, "Spectator")
  213. }
  214.  
  215. read_args(message, 191)
  216. remove_quotes(message)
  217.  
  218. // Gungame commands and empty messages
  219. if(message[0] == '@' || message[0] == '/' || message[0] == '!' || equal(message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  220. return PLUGIN_CONTINUE
  221.  
  222. new name[32]
  223. get_user_name(id, name, 31)
  224.  
  225. new admin = get_tag_index(id)
  226.  
  227. new isAlive
  228.  
  229. if(is_user_alive(id))
  230. {
  231. isAlive = 1
  232. alive = "^x01"
  233. }
  234. else
  235. {
  236. isAlive = 0
  237. alive = "^x01*DEAD* "
  238. }
  239.  
  240. static color[10]
  241.  
  242. if(admin)
  243. {
  244. // Name
  245. switch(get_pcvar_num(g_NameColor))
  246. {
  247. case 1:
  248. format(strName, 191, "%s(%s)^x04%s %s", alive, playerTeamName, g_szTag[admin], name)
  249. case 2:
  250. format(strName, 191, "%s(%s)^x04%s ^x04%s", alive, playerTeamName, g_szTag[admin], name)
  251. case 3:
  252. {
  253. color = "SPECTATOR"
  254. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  255. }
  256. case 4:
  257. {
  258. color = "CT"
  259. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  260. }
  261. case 5:
  262. {
  263. color = "TERRORIST"
  264. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  265. }
  266. case 6:
  267. {
  268. get_user_team(id, color, 9)
  269. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  270. }
  271. }
  272.  
  273. // Message
  274. switch(get_pcvar_num(g_MessageColor))
  275. {
  276. case 1: // Yellow
  277. format(strText, 191, "%s", message)
  278. case 2: // Green
  279. format(strText, 191, "^x04%s", message)
  280. case 3: // White
  281. {
  282. copy(color, 9, "SPECTATOR")
  283. format(strText, 191, "^x03%s", message)
  284. }
  285. case 4: // Blue
  286. {
  287. copy(color, 9, "CT")
  288. format(strText, 191, "^x03%s", message)
  289. }
  290. case 5: // Red
  291. {
  292. copy(color, 9, "TERRORIST")
  293. format(strText, 191, "^x03%s", message)
  294. }
  295. }
  296. }
  297. else // Player is not admin. Team-color name : Yellow message
  298. {
  299. get_user_team(id, color, 9)
  300. format(strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  301. format(strText, 191, "%s", message)
  302. }
  303.  
  304. format(message, 191, "%s ^x01: %s", strName, strText)
  305.  
  306. sendTeamMessage(color, isAlive, playerTeam) // Sends the colored message
  307.  
  308. return PLUGIN_CONTINUE
  309. }
  310.  
  311.  
  312. public set_color(id, level, cid)
  313. {
  314. if(!cmd_access(id, level, cid, 2))
  315. return PLUGIN_HANDLED
  316.  
  317. new arg[1], newColor
  318. read_argv(1, arg, 1)
  319.  
  320. newColor = str_to_num(arg)
  321.  
  322. if(newColor >= 1 && newColor <= 5)
  323. {
  324. set_pcvar_num(g_MessageColor, newColor)
  325.  
  326. if(get_pcvar_num(g_NameColor) != 1 &&
  327. ((newColor == 3 && get_pcvar_num(g_NameColor) != 3)
  328. ||(newColor == 4 && get_pcvar_num(g_NameColor) != 4)
  329. ||(newColor == 5 && get_pcvar_num(g_NameColor) != 5)))
  330. {
  331. set_pcvar_num(g_NameColor, 2)
  332. }
  333. }
  334.  
  335. return PLUGIN_HANDLED
  336. }
  337.  
  338.  
  339. public set_name_color(id, level, cid)
  340. {
  341. if(!cmd_access(id, level, cid, 2))
  342. return PLUGIN_HANDLED
  343.  
  344. new arg[1], newColor
  345. read_argv(1, arg, 1)
  346.  
  347. newColor = str_to_num(arg)
  348.  
  349. if(newColor >= 1 && newColor <= 6)
  350. {
  351. set_pcvar_num(g_NameColor, newColor)
  352.  
  353. if((get_pcvar_num(g_MessageColor) != 1
  354. &&((newColor == 3 && get_pcvar_num(g_MessageColor) != 3)
  355. ||(newColor == 4 && get_pcvar_num(g_MessageColor) != 4)
  356. ||(newColor == 5 && get_pcvar_num(g_MessageColor) != 5)))
  357. || get_pcvar_num(g_NameColor) == 6)
  358. {
  359. set_pcvar_num(g_MessageColor, 2)
  360. }
  361. }
  362.  
  363. return PLUGIN_HANDLED
  364. }
  365.  
  366.  
  367. public set_listen(id, level, cid)
  368. {
  369. if(!cmd_access(id, level, cid, 2))
  370. return PLUGIN_HANDLED
  371.  
  372. new arg[1], newListen
  373. read_argv(1, arg, 1)
  374.  
  375. newListen = str_to_num(arg)
  376.  
  377. set_pcvar_num(g_AdminListen, newListen)
  378.  
  379. return PLUGIN_HANDLED
  380. }
  381.  
  382.  
  383. public sendMessage(color[], alive)
  384. {
  385. new teamName[10]
  386.  
  387. for(new player = 1; player < maxPlayers; player++)
  388. {
  389. if(!is_user_connected(player))
  390. continue
  391.  
  392. if(alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  393. {
  394. get_user_team(player, teamName, 9) // Stores user's team name to change back after sending the message
  395. changeTeamInfo(player, color) // Changes user's team according to color choosen
  396. writeMessage(player, message) // Writes the message on player's chat
  397. changeTeamInfo(player, teamName) // Changes user's team back to original
  398. }
  399. }
  400. }
  401.  
  402.  
  403. public sendTeamMessage(color[], alive, playerTeam)
  404. {
  405. new teamName[10]
  406.  
  407. for(new player = 1; player < maxPlayers; player++)
  408. {
  409. if(!is_user_connected(player))
  410. continue
  411.  
  412. if(get_user_team(player) == playerTeam || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  413. {
  414. if(alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  415. {
  416. get_user_team(player, teamName, 9) // Stores user's team name to change back after sending the message
  417. changeTeamInfo(player, color) // Changes user's team according to color choosen
  418. writeMessage(player, message) // Writes the message on player's chat
  419. changeTeamInfo(player, teamName) // Changes user's team back to original
  420. }
  421. }
  422. }
  423. }
  424.  
  425.  
  426. public changeTeamInfo(player, team[])
  427. {
  428. message_begin(MSG_ONE, teamInfo, _, player) // Tells to to modify teamInfo(Which is responsable for which time player is)
  429. write_byte(player) // Write byte needed
  430. write_string(team) // Changes player's team
  431. message_end() // Also Needed
  432. }
  433.  
  434.  
  435. public writeMessage(player, message[])
  436. {
  437. message_begin(MSG_ONE, sayText, {0, 0, 0}, player) // Tells to modify sayText(Which is responsable for writing colored messages)
  438. write_byte(player) // Write byte needed
  439. write_string(message) // Effectively write the message, finally, afterall
  440. message_end() // Needed as always
  441. }
  442.  


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Rang javítás
HozzászólásElküldve:2013.10.11. 09:39 
Offline
Tud valamit
Avatar

Csatlakozott:2013.07.01. 23:32
Hozzászólások:122
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 23 alkalommal
Szeva,Én Javítottam az enyémet,leis teszteltem nekem nemküld ezzel logot!

SMA Forráskód: [ Mindet kijelol ]
  1.  
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5.  
  6. #define PLUGIN "Admin Chat Colors"
  7. #define VERSION "2.0"
  8. #define AUTHOR "Arion"
  9.  
  10. #define ACCESS_LEVEL ADMIN_IMMUNITY
  11. #define ADMIN_LISTEN ADMIN_LEVEL_C
  12.  
  13. new message[192]
  14. new sayText
  15. new teamInfo
  16. new maxPlayers
  17.  
  18. new g_MessageColor
  19. new g_NameColor
  20. new g_AdminListen
  21.  
  22. new strName[191]
  23. new strText[191]
  24. new alive[11]
  25.  
  26. new const g_szTag[][] = {
  27. "", // DO NOT REMOVE
  28. "[Tulaj]",
  29. "[Felügyelő]",
  30. "[VIP]",
  31. "[Jatekos]"
  32. }
  33.  
  34. new const g_iTagFlag[sizeof(g_szTag)] = {
  35. ADMIN_ALL, // DO NOT REMOVE
  36. ADMIN_IMMUNITY,
  37. ADMIN_BAN,
  38. ADMIN_RESERVATION,
  39. ADMIN_LEVEL_B
  40. }
  41.  
  42. public plugin_init()
  43. {
  44. register_plugin(PLUGIN, VERSION, AUTHOR)
  45.  
  46. g_MessageColor = register_cvar("amx_color", "4") // Message colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red
  47. g_NameColor = register_cvar("amx_namecolor", "2") // Name colors: [1] Default Yellow, [2] Green, [3] White, [4] Blue, [5] Red, [6] Team-color
  48. g_AdminListen = register_cvar("amx_listen", "1") // Set whether admins see or not all messages(Alive, dead and team-only)
  49.  
  50.  
  51. sayText = get_user_msgid("SayText")
  52. teamInfo = get_user_msgid("TeamInfo")
  53. maxPlayers = get_maxplayers()
  54.  
  55.  
  56. register_message(sayText, "avoid_duplicated")
  57.  
  58. register_concmd("amx_color", "set_color", ACCESS_LEVEL, "<color>")
  59. register_concmd("amx_namecolor", "set_name_color", ACCESS_LEVEL, "<color>")
  60. register_concmd("amx_listen", "set_listen", ACCESS_LEVEL, "<1 | 0>")
  61. register_clcmd("say", "hook_say")
  62. register_clcmd("say_team", "hook_teamsay")
  63. }
  64.  
  65.  
  66. public avoid_duplicated(msgId, msgDest, receiver)
  67. {
  68. return PLUGIN_HANDLED
  69. }
  70.  
  71. get_tag_index(id)
  72. {
  73. new flags = get_user_flags(id)
  74.  
  75. for(new i = 1; i < sizeof(g_iTagFlag); i++)
  76. {
  77. if(check_admin_flag(flags, g_iTagFlag[i]))
  78. {
  79. return i
  80. }
  81. }
  82.  
  83. return 0
  84. }
  85.  
  86. check_admin_flag(flags, flag)
  87. {
  88. if(flag == ADMIN_ADMIN)
  89. {
  90. return ((flags & ~ADMIN_USER) > 0)
  91. }
  92. else if(flag == ADMIN_ALL)
  93. {
  94. return 1
  95. }
  96.  
  97. return (flags & flag)
  98. }
  99.  
  100. public hook_say(id)
  101. {
  102. read_args(message, 191)
  103. remove_quotes(message)
  104.  
  105. // Gungame commands and empty messages
  106. if(message[0] == '@' || message[0] == '/' || message[0] == '!' || equal(message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  107. return PLUGIN_CONTINUE
  108.  
  109. new name[32]
  110. get_user_name(id, name, 31)
  111.  
  112. new admin = get_tag_index(id)
  113.  
  114. new isAlive
  115.  
  116. if(is_user_alive(id))
  117. {
  118. isAlive = 1
  119. alive = "^x01"
  120. }
  121. else
  122. {
  123. isAlive = 0
  124. alive = "^x01-Halott->"
  125. }
  126.  
  127. static color[10]
  128.  
  129. if(admin)
  130. {
  131. // Name
  132. switch(get_pcvar_num(g_NameColor))
  133. {
  134. case 1:
  135. format(strName, 191, "^x04%s %s%s", g_szTag[admin], alive, name)
  136. case 2:
  137. format(strName, 191, "^x04%s %s^x04%s ", g_szTag[admin], alive, name)
  138. case 3:
  139. {
  140. color = "SPECTATOR"
  141. format(strName, 191, "^x04%s %s^x03%s ", g_szTag[admin], alive, name)
  142. }
  143. case 4:
  144. {
  145. color = "CT"
  146. format(strName, 191, "^x04%s %s^x03%s", g_szTag[admin], alive, name)
  147. }
  148. case 5:
  149. {
  150. color = "TERRORIST"
  151. format(strName, 191, "^x04%s %s^x03%s", g_szTag[admin], alive, name)
  152. }
  153. case 6:
  154. {
  155. get_user_team(id, color, 9)
  156. format(strName, 191, "^x04%s %s^x03%s", g_szTag[admin], alive, name)
  157. }
  158. }
  159.  
  160. // Message
  161. switch(get_pcvar_num(g_MessageColor))
  162. {
  163. case 1: // Yellow
  164. format(strText, 191, "%s", message)
  165. case 2: // Green
  166. format(strText, 191, "^x04%s", message)
  167. case 3: // White
  168. {
  169. copy(color, 9, "SPECTATOR")
  170. format(strText, 191, "^x03%s", message)
  171. }
  172. case 4: // Blue
  173. {
  174. copy(color, 9, "CT")
  175. format(strText, 191, "^x03%s", message)
  176. }
  177. case 5: // Red
  178. {
  179. copy(color, 9, "TERRORIST")
  180. format(strText, 191, "^x03%s", message)
  181. }
  182. }
  183. }
  184. else // Player is not admin. Team-color name : Yellow message
  185. {
  186. get_user_team(id, color, 9)
  187. format(strName, 191, "%s^x03%s", alive, name)
  188. format(strText, 191, "%s", message)
  189. }
  190.  
  191. format(message, 191, "%s^x01 : %s", strName, strText)
  192.  
  193. sendMessage(color, isAlive) // Sends the colored message
  194.  
  195. return PLUGIN_CONTINUE
  196. }
  197.  
  198.  
  199. public hook_teamsay(id)
  200. {
  201. new playerTeam = get_user_team(id)
  202. new playerTeamName[19]
  203.  
  204. switch(playerTeam) // Team names which appear on team-only messages
  205. {
  206. case 1:
  207. copy(playerTeamName, 11, "Terrorists")
  208.  
  209. case 2:
  210. copy(playerTeamName, 18, "Counter-Terrorists")
  211.  
  212. default:
  213. copy(playerTeamName, 9, "Spectator")
  214. }
  215.  
  216. read_args(message, 191)
  217. remove_quotes(message)
  218.  
  219. // Gungame commands and empty messages
  220. if(message[0] == '@' || message[0] == '/' || message[0] == '!' || equal(message, "")) // Ignores Admin Hud Messages, Admin Slash commands,
  221. return PLUGIN_CONTINUE
  222.  
  223. new name[32]
  224. get_user_name(id, name, 31)
  225.  
  226. new admin = get_tag_index(id)
  227.  
  228. new isAlive
  229.  
  230. if(is_user_alive(id))
  231. {
  232. isAlive = 1
  233. alive = "^x01"
  234. }
  235. else
  236. {
  237. isAlive = 0
  238. alive = "^x01*DEAD* "
  239. }
  240.  
  241. static color[10]
  242.  
  243. if(admin)
  244. {
  245. // Name
  246. switch(get_pcvar_num(g_NameColor))
  247. {
  248. case 1:
  249. format(strName, 191, "%s(%s)^x04%s %s", alive, playerTeamName, g_szTag[admin], name)
  250. case 2:
  251. format(strName, 191, "%s(%s)^x04%s ^x04%s", alive, playerTeamName, g_szTag[admin], name)
  252. case 3:
  253. {
  254. color = "SPECTATOR"
  255. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  256. }
  257. case 4:
  258. {
  259. color = "CT"
  260. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  261. }
  262. case 5:
  263. {
  264. color = "TERRORIST"
  265. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  266. }
  267. case 6:
  268. {
  269. get_user_team(id, color, 9)
  270. format(strName, 191, "%s(%s)^x04%s ^x03%s", alive, playerTeamName, g_szTag[admin], name)
  271. }
  272. }
  273.  
  274. // Message
  275. switch(get_pcvar_num(g_MessageColor))
  276. {
  277. case 1: // Yellow
  278. format(strText, 191, "%s", message)
  279. case 2: // Green
  280. format(strText, 191, "^x04%s", message)
  281. case 3: // White
  282. {
  283. copy(color, 9, "SPECTATOR")
  284. format(strText, 191, "^x03%s", message)
  285. }
  286. case 4: // Blue
  287. {
  288. copy(color, 9, "CT")
  289. format(strText, 191, "^x03%s", message)
  290. }
  291. case 5: // Red
  292. {
  293. copy(color, 9, "TERRORIST")
  294. format(strText, 191, "^x03%s", message)
  295. }
  296. }
  297. }
  298. else // Player is not admin. Team-color name : Yellow message
  299. {
  300. get_user_team(id, color, 9)
  301. format(strName, 191, "%s(%s) ^x03%s", alive, playerTeamName, name)
  302. format(strText, 191, "%s", message)
  303. }
  304.  
  305. format(message, 191, "%s ^x01: %s", strName, strText)
  306.  
  307. sendTeamMessage(color, isAlive, playerTeam) // Sends the colored message
  308.  
  309. return PLUGIN_CONTINUE
  310. }
  311.  
  312.  
  313. public set_color(id, level, cid)
  314. {
  315. if(!cmd_access(id, level, cid, 2))
  316. return PLUGIN_HANDLED
  317.  
  318. new arg[1], newColor
  319. read_argv(1, arg, 1)
  320.  
  321. newColor = str_to_num(arg)
  322.  
  323. if(newColor >= 1 && newColor <= 5)
  324. {
  325. set_pcvar_num(g_MessageColor, newColor)
  326.  
  327. if(get_pcvar_num(g_NameColor) != 1 &&
  328. ((newColor == 3 && get_pcvar_num(g_NameColor) != 3)
  329. ||(newColor == 4 && get_pcvar_num(g_NameColor) != 4)
  330. ||(newColor == 5 && get_pcvar_num(g_NameColor) != 5)))
  331. {
  332. set_pcvar_num(g_NameColor, 2)
  333. }
  334. }
  335.  
  336. return PLUGIN_HANDLED
  337. }
  338.  
  339.  
  340. public set_name_color(id, level, cid)
  341. {
  342. if(!cmd_access(id, level, cid, 2))
  343. return PLUGIN_HANDLED
  344.  
  345. new arg[1], newColor
  346. read_argv(1, arg, 1)
  347.  
  348. newColor = str_to_num(arg)
  349.  
  350. if(newColor >= 1 && newColor <= 6)
  351. {
  352. set_pcvar_num(g_NameColor, newColor)
  353.  
  354. if((get_pcvar_num(g_MessageColor) != 1
  355. &&((newColor == 3 && get_pcvar_num(g_MessageColor) != 3)
  356. ||(newColor == 4 && get_pcvar_num(g_MessageColor) != 4)
  357. ||(newColor == 5 && get_pcvar_num(g_MessageColor) != 5)))
  358. || get_pcvar_num(g_NameColor) == 6)
  359. {
  360. set_pcvar_num(g_MessageColor, 2)
  361. }
  362. }
  363.  
  364. return PLUGIN_HANDLED
  365. }
  366.  
  367.  
  368. public set_listen(id, level, cid)
  369. {
  370. if(!cmd_access(id, level, cid, 2))
  371. return PLUGIN_HANDLED
  372.  
  373. new arg[1], newListen
  374. read_argv(1, arg, 1)
  375.  
  376. newListen = str_to_num(arg)
  377.  
  378. set_pcvar_num(g_AdminListen, newListen)
  379.  
  380. return PLUGIN_HANDLED
  381. }
  382.  
  383.  
  384. public sendMessage(color[], alive)
  385. {
  386. new teamName[10]
  387.  
  388. for(new player = 1; player < maxPlayers; player++)
  389. {
  390. if(!is_user_connected(player))
  391. continue
  392.  
  393. if(alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  394. {
  395. get_user_team(player, teamName, 9) // Stores user's team name to change back after sending the message
  396. changeTeamInfo(player, color) // Changes user's team according to color choosen
  397. writeMessage(player, message) // Writes the message on player's chat
  398. changeTeamInfo(player, teamName) // Changes user's team back to original
  399. }
  400. }
  401. }
  402.  
  403.  
  404. public sendTeamMessage(color[], alive, playerTeam)
  405. {
  406. new teamName[10]
  407.  
  408. for(new player = 1; player < maxPlayers; player++)
  409. {
  410. if(!is_user_connected(player))
  411. continue
  412.  
  413. if(get_user_team(player) == playerTeam || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  414. {
  415. if(alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  416. {
  417. get_user_team(player, teamName, 9) // Stores user's team name to change back after sending the message
  418. changeTeamInfo(player, color) // Changes user's team according to color choosen
  419. writeMessage(player, message) // Writes the message on player's chat
  420. changeTeamInfo(player, teamName) // Changes user's team back to original
  421. }
  422. }
  423. }
  424. }
  425.  
  426.  
  427. public changeTeamInfo(player, team[])
  428. {
  429. message_begin(MSG_ONE, teamInfo, _, player) // Tells to to modify teamInfo(Which is responsable for which time player is)
  430. write_byte(player) // Write byte needed
  431. write_string(team) // Changes player's team
  432. message_end() // Also Needed
  433. }
  434.  
  435.  
  436. public writeMessage(player, message[])
  437. {
  438. message_begin(MSG_ONE, sayText, {0, 0, 0}, player) // Tells to modify sayText(Which is responsable for writing colored messages)
  439. write_byte(player) // Write byte needed
  440. write_string(message) // Effectively write the message, finally, afterall
  441. message_end() // Needed as always
  442. }
  443.  

:)

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Rang javítás
HozzászólásElküldve:2013.10.11. 12:38 
Offline
Felfüggesztve

Csatlakozott:2013.08.09. 22:37
Hozzászólások:571
Megköszönt másnak: 10 alkalommal
Megköszönték neki: 85 alkalommal
Már megoldottam. (Közbe szereztem 1 jobbat :) )


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 33 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole