hlmod.hu
https://hlmod.hu/

admin chat szinezes
https://hlmod.hu/viewtopic.php?f=29&t=22643
Oldal: 1 / 1

Szerző:  tarkaboci [2015.11.11. 13:16 ]
Hozzászólás témája:  admin chat szinezes

Sziasztok!

Mar regota keresek egy olyan plugint amivel lehet szinezni az admin chatet.
Nem az ichatre gondolok, hanem amikor valamelyik jatekos ir vagy jelenteni akar admin chatbe akkor mellette azt irja hogy "(Admin):asder aim" vagy hogy egyik admin a masiknak ir az amx_chat parancsal az nalam csak sarga es azt szeretnem szinezni.
Voltam szerb szerveren admin es ott zolden irta ki mindeszt es en is szeretnem kicsit szinezni mert igy nem igazan lehet normalisan latni hog ki mikor jelent. Ugyanez az amx_say-nel is csak ott meg ezt irja (Mind):blablabla....
Valaszokat elore is koszonom es bocs az ekezetlenseg miatt de kulfoldi laptopom van es lusta voltam magyar windowsot telepiteni :P :D

Tovabbi szep napot! :)

Szerző:  mforce [2015.11.11. 13:20 ]
Hozzászólás témája:  Re: admin chat szinezes

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #if AMXX_VERSION_NUM < 183
  5. #include <dhudmessage>
  6. #endif
  7.  
  8. #define PLUGIN_NAME "OciXCrom's Admin Chat"
  9. #define PLUGIN_VERSION "1.2"
  10.  
  11. #define FLAG_ADMIN ADMIN_BAN /* Flag for "ADMIN" usage */
  12. #define FLAG_PSAY ADMIN_RCON /* Players with this flag can read others players' private messages, including team ones */
  13. #define FLAG_READ ADMIN_BAN /* Players with this flag can see the admin chat */
  14. #define FLAG_VIPCHAT ADMIN_CHAT /* Players with this flag can use and read VIP chat messages */
  15. #define FLAG_ANONYMOUS ADMIN_RCON /* This flag grants you access to szAnonymous, which allows you to change the message's type to anonymous */
  16.  
  17. #define SAY_ALL '#' /* The symbol used for executing amx_say through default chat */
  18. #define SAY_HUD '@' /* The symbol used for sending a HUD message through default chat */
  19. #define SAY_DHUD '&' /* The symbol used for sending a DHUD message through default chat */
  20. #define TSAY_ADMIN '@' /* The symbol used for accessing the admin chat through team chat */
  21. #define TSAY_VIPCHAT '!' /* The symbol used for accessing the VIP chat through team chat */
  22. #define TSAY_PRIVATE '#' /* The symbol used for sending a private message through team chat */
  23. #define TSAY_TEAMSAY '&' /* The symbol used for sending a message to a specific team */
  24. #define HUD_BLINK "$" /* The symbol used for applying a blink effect to a (D)HUD message */
  25. #define HUD_TYPEWRITER "#" /* The symbol used for applying a typewriter effect to a (D)HUD message */
  26.  
  27. /* Here you can change the messages' secondary color.
  28. * You can use TEAM_COLOR, RED, BLUE and GREY */
  29. #define COLOR_SAY TEAM_COLOR /* Color for command: amx_say */
  30. #define COLOR_ASAY TEAM_COLOR /* Color for command: amx_asay */
  31. #define COLOR_CHAT TEAM_COLOR /* Color for command: amx_chat */
  32. #define COLOR_PSAY TEAM_COLOR /* Color for command: amx_psay */
  33. #define COLOR_TEAMSAY TEAM_COLOR /* Color for command: amx_teamsay */
  34.  
  35. new const szAdmin[] = "!nADMIN" /* The ADMIN prefix in the admin chat */
  36. new const szVip[] = "!nVIP" /* The VIP prefix in the admin chat */
  37. new const szPlayer[] = "!nPLAYER" /* The PLAYER prefix in the admin chat */
  38. new const szPrivate[] = "scientist/overhere.wav" /* The sound used when a player receives a private message */
  39. new const szServer[] = "!gS!tE!nR!gV!tE!nR" /* This is used instead of name when a command is executed through the server console */
  40. new const szAnonymous[] = "!an" /* Using this in a message will convert it to an anonymous one */
  41.  
  42. /* These messages are used in Default Mode - Feel free to modify them */
  43. new const g_Messages[][] = {
  44. "!g(ALL) !t%name% !n: !g%message%", /* amx_say -- Sends a message to all players */
  45. "!g(%level%!g) %name% !t: !n%message%", /* amx_asay -- Sends a message to all admins */
  46. "!g(VIP CHAT) !t%name% !n: !t%message%", /* amx_chat -- Send a message to VIP users */
  47. "!t(!g%name%!t -> !g%name2%!t) !n%message%", /* amx_psay -- Sends a private message to a player */
  48. "!t(!g%team%!t) !n%name% : !g%message%", /* amx_teamsay -- Sends a message to a specific team */
  49. "%name% : %message%" /* amx_<letter>say(2) -- Sends a (D)HUD message to all players */
  50. }
  51.  
  52. /* These messages are used in Anonymous Mode - Feel free to modify them */
  53. new const g_AnonymousMessages[][] = {
  54. "!g(ALL) !n: !g%message%", /* amx_say -- Sends a message to all players */
  55. "!g(%level%!g) %name% !t: !g%message%", /* amx_asay -- Sends a message to all admins */
  56. "!g(VIP CHAT) !t%name% !n: !t%message%", /* amx_chat -- Send a message to VIP users */
  57. "!t(!g%name%!t -> !g%name2%!t) !n%message%", /* amx_psay -- Sends a private message to a player */
  58. "!t(!g%team%!t) !n: !g%message%", /* amx_teamsay -- Sends a message to a specific team */
  59. "%message%" /* amx_<letter>say(2) -- Sends a (D)HUD message to all players */
  60. }
  61.  
  62. /* Team names for amx_teamsay */
  63. new const szTeams[][] = {
  64. "",
  65. "Terrorist",
  66. "Counter-Terrorist",
  67. "Spectator"
  68. }
  69.  
  70. /* These symbols are used for different colors in chat messages [don't touch the second ones (^4/^3/^1)] */
  71. new const g_Colors[][] = {
  72. "!g", "^4",
  73. "!t", "^3",
  74. "!n", "^1"
  75. }
  76.  
  77. /* These commands are used when the SAY_HUD symbol is entered X times in normal chat */
  78. new const g_ChatHud[][] = { "amx_tsay", "amx_csay", "amx_bsay", "amx_rsay" }
  79.  
  80. new g_HudColors[][] = {"random", "white", "red", "green", "blue", "yellow", "magenta", "cyan", "orange", "ocean", "maroon"}
  81. new g_HudValues[][] = {{0, 0, 0}, {255, 255, 255}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 0}, {255, 0, 255}, {0, 255, 255}, {227, 96, 8}, {45, 89, 116}, {103, 44, 38}}
  82. new Float:g_Positions[][] = {{-1.0, 0.7}, {-1.0, 0.1}, {0.75, 0.55}, {0.05, 0.55}}
  83. new g_Anonymous, g_MessageChannel
  84.  
  85. /* Don't modify anything from here ... */
  86. #define X 0
  87. #define Y 1
  88. #define R 0
  89. #define G 1
  90. #define B 2
  91.  
  92. #define CMD_SAY 0
  93. #define CMD_ASAY 1
  94. #define CMD_CHAT 2
  95. #define CMD_PSAY 3
  96. #define CMD_TEAM 4
  97. #define CMD_HSAY 5
  98.  
  99. #define CMD_BSAY 0
  100. #define CMD_CSAY 1
  101. #define CMD_RSAY 2
  102. #define CMD_TSAY 3
  103.  
  104. enum Color
  105. {
  106. NORMAL = 1, // clients scr_concolor cvar color
  107. GREEN, // Green Color
  108. TEAM_COLOR, // Red, grey, blue
  109. GREY, // grey
  110. RED, // Red
  111. BLUE, // Blue
  112. }
  113.  
  114. new TeamName[][] =
  115. {
  116. "",
  117. "TERRORIST",
  118. "CT",
  119. "SPECTATOR"
  120. }
  121. /* ... to here */
  122.  
  123. public plugin_init()
  124. {
  125. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, "OciXCrom")
  126. register_cvar("CRXAdminChat", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
  127.  
  128. register_clcmd("say", "hook_say")
  129. register_clcmd("say_team", "hook_sayTeam")
  130.  
  131. register_concmd("amx_say", "cmd_say", ADMIN_CHAT, "<message> -- Sends a message to all players")
  132. register_concmd("amx_asay", "cmd_asay", ADMIN_ALL, "<message> -- Sends a message to all admins")
  133. register_concmd("amx_chat", "cmd_chat", FLAG_VIPCHAT, "<message> -- Sends a message to all VIP users")
  134. register_concmd("amx_psay", "cmd_psay", ADMIN_CHAT, "<player> <message> -- Sends a private message to a player")
  135. register_concmd("amx_teamsay", "cmd_teamsay", ADMIN_BAN, "<team> <message> -- Sends a message to a specific team")
  136.  
  137. register_concmd("amx_bsay", "cmd_hsay", ADMIN_CHAT, "<color> <message> -- Sends a bottom HUD message to all players")
  138. register_concmd("amx_bsay2", "cmd_hsay", ADMIN_CHAT, "<color> <message> -- Sends a bottom HUD message to all players")
  139. register_concmd("amx_csay", "cmd_hsay", ADMIN_CHAT, "<color> <message> -- Sends a top HUD message to all players")
  140. register_concmd("amx_csay2", "cmd_hsay", ADMIN_RCON, "<color> <message> -- Sends a top DHUD message to all players")
  141. register_concmd("amx_rsay", "cmd_hsay", ADMIN_CHAT, "<color> <message> -- Sends a right sided HUD message to all players")
  142. register_concmd("amx_rsay2", "cmd_hsay", ADMIN_RCON, "<color> <message> -- Sends a right sided DHUD message to all players")
  143. register_concmd("amx_tsay", "cmd_hsay", ADMIN_CHAT, "<color> <message> -- Sends a left HUD message to all players")
  144. register_concmd("amx_tsay2", "cmd_hsay", ADMIN_RCON, "<color> <message> -- Sends a left DHUD message to all players")
  145.  
  146. g_Anonymous = register_cvar("crxchat_anonymous", "0")
  147. }
  148.  
  149. public hook_say(id)
  150. {
  151. new message[192]
  152. read_args(message, charsmax(message))
  153. remove_quotes(message)
  154.  
  155. switch(message[0])
  156. {
  157. case SAY_ALL: client_cmd(id, "amx_say %s", fix_message(message))
  158. case SAY_HUD, SAY_DHUD:
  159. {
  160. new type, color, symbol = message[0]
  161. message[0] = ' '
  162.  
  163. for(new i = 1; i < 4; i++)
  164. {
  165. if(message[i] == symbol)
  166. {
  167. message[i] = ' '
  168. type++
  169. }
  170. else break
  171. }
  172.  
  173. switch(message[type + 1])
  174. {
  175. case 'W': color = 1
  176. case 'R': color = 2
  177. case 'G': color = 3
  178. case 'B': color = 4
  179. case 'Y': color = 5
  180. case 'M': color = 6
  181. case 'C': color = 7
  182. case 'O': color = 8
  183. }
  184.  
  185. if(color > 0) message[type + 1] = ' '
  186. trim(message)
  187. client_cmd(id, "%s%s %s %s", g_ChatHud[type], (symbol == SAY_DHUD) ? "2" : "", g_HudColors[color], message)
  188. }
  189. default: return PLUGIN_CONTINUE
  190. }
  191.  
  192. return PLUGIN_HANDLED
  193. }
  194.  
  195. public hook_sayTeam(id)
  196. {
  197. new message[192]
  198. read_args(message, charsmax(message))
  199. remove_quotes(message)
  200.  
  201. switch(message[0])
  202. {
  203. case TSAY_ADMIN: client_cmd(id, "amx_asay %s", fix_message(message))
  204. case TSAY_VIPCHAT: client_cmd(id, "amx_chat %s", fix_message(message))
  205. case TSAY_PRIVATE:
  206. {
  207. message[0] = ' '
  208. trim(message)
  209.  
  210. new arg[32]
  211. parse(message, arg, charsmax(arg))
  212.  
  213. if(equal(arg, ""))
  214. return PLUGIN_HANDLED
  215.  
  216. new player = cmd_target(id, arg, 0)
  217. if(!player) return PLUGIN_HANDLED
  218.  
  219. replace(message, charsmax(message), arg, "")
  220. client_cmd(id, "amx_psay #%i %s", get_user_userid(player), message)
  221. }
  222. case TSAY_TEAMSAY:
  223. {
  224. message[0] = ' '
  225. trim(message)
  226.  
  227. new arg[32]
  228. parse(message, arg, charsmax(arg))
  229.  
  230. if(equal(arg, ""))
  231. return PLUGIN_HANDLED
  232.  
  233. replace(message, charsmax(message), arg, "")
  234. client_cmd(id, "amx_teamsay %s %s", arg, message)
  235. }
  236. default: return PLUGIN_CONTINUE
  237. }
  238.  
  239. return PLUGIN_HANDLED
  240. }
  241.  
  242. public cmd_say(id, level, cid)
  243. {
  244. if(!cmd_access(id, level, cid, 2))
  245. return PLUGIN_HANDLED
  246.  
  247. new arg[160]
  248. read_args(arg, charsmax(arg))
  249. remove_quotes(arg)
  250. trim(arg)
  251.  
  252. if(equal(arg, ""))
  253. return PLUGIN_HANDLED
  254.  
  255. new message[192], name[32]
  256. get_user_name(id, name, charsmax(name))
  257. formatex(message, charsmax(message), "%s", get_message(id, 0, is_anonymous(id, arg) ? g_AnonymousMessages[CMD_SAY] : g_Messages[CMD_SAY], arg))
  258.  
  259. new players[32], num
  260. get_players(players, num)
  261.  
  262. for(new i = 0; i < num; i++)
  263. ColorChat(players[i], COLOR_SAY, message)
  264.  
  265. message_log(name, arg, "amx_say")
  266. return PLUGIN_HANDLED
  267. }
  268.  
  269. public cmd_asay(id, level, cid)
  270. {
  271. if(!cmd_access(id, level, cid, 2))
  272. return PLUGIN_HANDLED
  273.  
  274. new arg[160]
  275. read_args(arg, charsmax(arg))
  276. remove_quotes(arg)
  277. trim(arg)
  278.  
  279. if(equal(arg, ""))
  280. return PLUGIN_HANDLED
  281.  
  282. new message[192], name[32]
  283. get_user_name(id, name, charsmax(name))
  284. formatex(message, charsmax(message), "%s", get_message(id, 0, is_anonymous(id, arg) ? g_AnonymousMessages[CMD_ASAY] : g_Messages[CMD_ASAY], arg))
  285.  
  286. new players[32], num
  287. get_players(players, num)
  288.  
  289. for(new i = 0; i < num; i++)
  290. if(get_user_flags(players[i]) & FLAG_READ || id == players[i]) ColorChat(players[i], COLOR_ASAY, message)
  291.  
  292. message_log(name, arg, "amx_asay")
  293. return PLUGIN_HANDLED
  294. }
  295.  
  296. public cmd_chat(id, level, cid)
  297. {
  298. if(!cmd_access(id, level, cid, 2))
  299. return PLUGIN_HANDLED
  300.  
  301. new arg[160]
  302. read_args(arg, charsmax(arg))
  303. remove_quotes(arg)
  304. trim(arg)
  305.  
  306. if(equal(arg, ""))
  307. return PLUGIN_HANDLED
  308.  
  309. new message[192], name[32]
  310. get_user_name(id, name, charsmax(name))
  311. formatex(message, charsmax(message), "%s", get_message(id, 0, is_anonymous(id, arg) ? g_AnonymousMessages[CMD_CHAT] : g_Messages[CMD_CHAT], arg))
  312.  
  313. new players[32], num
  314. get_players(players, num)
  315.  
  316. for(new i = 0; i < num; i++)
  317. if(get_user_flags(players[i]) & FLAG_VIPCHAT) ColorChat(players[i], COLOR_CHAT, message)
  318.  
  319. message_log(name, arg, "amx_chat")
  320. return PLUGIN_HANDLED
  321. }
  322.  
  323. public cmd_psay(id, level, cid)
  324. {
  325. if(!cmd_access(id, level, cid, 3))
  326. return PLUGIN_HANDLED
  327.  
  328. new arg[180], plr[32]
  329. read_args(arg, charsmax(arg))
  330. read_argv(1, plr, charsmax(plr))
  331.  
  332. new player = cmd_target(id, plr, 0)
  333.  
  334. if(!player)
  335. return PLUGIN_HANDLED
  336.  
  337. replace(arg, charsmax(arg), plr, "")
  338. trim(arg)
  339.  
  340. if(equal(arg, ""))
  341. return PLUGIN_HANDLED
  342.  
  343. new message[192], name[68], name2[32]
  344. get_user_name(id, name, charsmax(name))
  345. get_user_name(player, name2, charsmax(name2))
  346. formatex(message, charsmax(message), "%s", get_message(id, player, is_anonymous(id, arg) ? g_AnonymousMessages[CMD_PSAY] : g_Messages[CMD_PSAY], arg))
  347. add(name, charsmax(name), " > ")
  348. add(name, charsmax(name), name2)
  349.  
  350. new players[32], num
  351. get_players(players, num)
  352.  
  353. for(new i = 0; i < num; i++)
  354. if(get_user_flags(players[i]) & FLAG_PSAY || player == players[i] || id == players[i]) ColorChat(players[i], COLOR_PSAY, message)
  355.  
  356. client_cmd(player, "spk %s", szPrivate)
  357.  
  358. message_log(name, arg, "amx_psay")
  359. return PLUGIN_HANDLED
  360. }
  361.  
  362. public cmd_teamsay(id, level, cid)
  363. {
  364. if(!cmd_access(id, level, cid, 3))
  365. return PLUGIN_HANDLED
  366.  
  367. new arg[180], strteam[32], team
  368. read_args(arg, charsmax(arg))
  369. read_argv(1, strteam, charsmax(strteam))
  370.  
  371. switch(strteam[0])
  372. {
  373. case 't': team = 1
  374. case 'c': team = 2
  375. case 's': team = 3
  376. default: return PLUGIN_HANDLED
  377. }
  378.  
  379. replace(arg, charsmax(arg), strteam, "")
  380. trim(arg)
  381.  
  382. if(equal(arg, ""))
  383. return PLUGIN_HANDLED
  384.  
  385. new message[192], name[68]
  386. get_user_name(id, name, charsmax(name))
  387. formatex(message, charsmax(message), "%s", get_message(id, team, is_anonymous(id, arg) ? g_AnonymousMessages[CMD_TEAM] : g_Messages[CMD_TEAM], arg))
  388. add(name, charsmax(name), " > ")
  389. add(name, charsmax(name), szTeams[team])
  390.  
  391. new players[32], num
  392. get_players(players, num)
  393.  
  394. for(new i = 0; i < num; i++)
  395. if(get_user_flags(players[i]) & FLAG_PSAY || get_user_team(players[i]) == team || id == players[i]) ColorChat(players[i], COLOR_TEAMSAY, message)
  396.  
  397. message_log(name, arg, "amx_teamsay")
  398. return PLUGIN_HANDLED
  399. }
  400.  
  401. public cmd_hsay(id, level, cid)
  402. {
  403. if(!cmd_access(id, level, cid, 3))
  404. return PLUGIN_HANDLED
  405.  
  406. new arg[180], color[10]
  407. read_args(arg, charsmax(arg))
  408. parse(arg, color, charsmax(color))
  409. replace(arg, charsmax(arg), color, "")
  410. trim(arg)
  411.  
  412. if(equal(arg, ""))
  413. return PLUGIN_HANDLED
  414.  
  415. new message[192], name[32], command[10], type, clr, effect
  416. get_user_name(id, name, charsmax(name))
  417. read_argv(0, command, charsmax(command))
  418. formatex(message, charsmax(message), "%s", get_message(id, 0, is_anonymous(id, arg) ? g_AnonymousMessages[CMD_HSAY] : g_Messages[CMD_HSAY], arg))
  419.  
  420. if(contain(message, HUD_BLINK) != -1)
  421. {
  422. replace(message, charsmax(message), HUD_BLINK, "")
  423. effect = 1
  424. }
  425. else if(contain(message, HUD_TYPEWRITER) != -1)
  426. {
  427. replace(message, charsmax(message), HUD_TYPEWRITER, "")
  428. effect = 2
  429. }
  430.  
  431. if(++g_MessageChannel > 6 || g_MessageChannel < 3)
  432. g_MessageChannel = 3
  433.  
  434. switch(command[4])
  435. {
  436. case 'b': type = CMD_BSAY
  437. case 'c': type = CMD_CSAY
  438. case 'r': type = CMD_RSAY
  439. case 't': type = CMD_TSAY
  440. }
  441.  
  442. for(clr = 0; clr < sizeof(g_HudColors); clr++)
  443. {
  444. if(equal(color, g_HudColors[clr]))
  445. break
  446. }
  447.  
  448. if(clr >= sizeof(g_HudColors))
  449. clr = 0
  450.  
  451. new dhud = (command[8] == '2') ? 1 : 0
  452. new bool:rndm = (clr == 0) ? true : false
  453.  
  454. rndm ? send_hudmessage(dhud, random(255), random(255), random(255), type, message, effect) : send_hudmessage(dhud, g_HudValues[clr][R], g_HudValues[clr][G], g_HudValues[clr][B], type, message, effect)
  455. client_print(0, print_console, "[%sHUD] %s", dhud ? "D" : "", message)
  456.  
  457. message_log(name, arg, command)
  458. return PLUGIN_HANDLED
  459. }
  460.  
  461. public plugin_precache()
  462. precache_sound(szPrivate)
  463.  
  464. public message_log(name[], message[], command[])
  465. log_amx("[%s] %s : %s", command, name, message)
  466.  
  467. public send_hudmessage(hud, red, green, blue, type, message[], effect)
  468. {
  469. new Float:position = g_Positions[type][Y] + float(g_MessageChannel) / 35.0
  470.  
  471. switch(hud)
  472. {
  473. case 0:
  474. {
  475. set_hudmessage(red, green, blue, g_Positions[type][X], position, effect, 1.0, 6.0, 0.1, 0.15, -1)
  476. show_hudmessage(0, message)
  477. }
  478. case 1:
  479. {
  480. set_dhudmessage(red, green, blue, g_Positions[type][X], position, effect, 1.0, 6.0, 0.1, 0.15)
  481. show_dhudmessage(0, message)
  482. }
  483. }
  484. }
  485.  
  486. stock get_message(id, player, msg[], arg[])
  487. {
  488. new message[192], info[32]
  489. formatex(message, charsmax(message), "%s", msg)
  490.  
  491. if(contain(message, "%name%") != -1)
  492. {
  493. is_user_connected(id) ? get_user_name(id, info, charsmax(info)) : formatex(info, charsmax(info), "%s", szServer)
  494. replace_all(message, charsmax(message), "%name%", info)
  495. }
  496.  
  497. if(contain(message, "%name2%") != -1)
  498. {
  499. get_user_name(player, info, charsmax(info))
  500. replace_all(message, charsmax(message), "%name2%", info)
  501. }
  502.  
  503. if(contain(message, "%level%") != -1)
  504. {
  505. formatex(info, charsmax(info), "%s", get_user_flags(id) & FLAG_ADMIN ? szAdmin : is_user_admin(id) ? szVip : szPlayer)
  506. replace_all(message, charsmax(message), "%level%", info)
  507. }
  508.  
  509. if(contain(message, "%team%") != -1)
  510. replace_all(message, charsmax(message), "%team%", szTeams[player])
  511.  
  512. if(contain(message, "%message%") != -1)
  513. replace_all(message, charsmax(message), "%message%", arg)
  514.  
  515. if(contain(message, "%") != -1)
  516. replace_all(message, charsmax(message), "%", "")
  517.  
  518. if(contain(message, szAnonymous) != -1)
  519. if(get_user_flags(id) & FLAG_ANONYMOUS) replace_all(message, charsmax(message), szAnonymous, "")
  520.  
  521. for(new i = 0; i < sizeof(g_Colors) - 1; i += 2)
  522. replace_all(message, charsmax(message), g_Colors[i], g_Colors[i + 1])
  523.  
  524. return message
  525. }
  526.  
  527. stock fix_message(msg[])
  528. {
  529. new message[192]
  530. formatex(message, charsmax(message), "%s", msg)
  531. message[0] = ' '
  532. trim(message)
  533. return message
  534. }
  535.  
  536. stock is_anonymous(id, message[])
  537. return (get_pcvar_num(g_Anonymous) || ((contain(message, szAnonymous) != -1) && get_user_flags(id) & FLAG_ANONYMOUS)) ? true : false
  538.  
  539. /* ColorChat */
  540.  
  541. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  542. {
  543. static message[256];
  544.  
  545. switch(type)
  546. {
  547. case NORMAL: // clients scr_concolor cvar color
  548. {
  549. message[0] = 0x01;
  550. }
  551. case GREEN: // Green
  552. {
  553. message[0] = 0x04;
  554. }
  555. default: // White, Red, Blue
  556. {
  557. message[0] = 0x03;
  558. }
  559. }
  560.  
  561. vformat(message[1], 251, msg, 4);
  562.  
  563. // Make sure message is not longer than 192 character. Will crash the server.
  564. message[192] = '^0';
  565.  
  566. static team, ColorChange, index, MSG_Type;
  567.  
  568. if(id)
  569. {
  570. MSG_Type = MSG_ONE;
  571. index = id;
  572. } else {
  573. index = FindPlayer();
  574. MSG_Type = MSG_ALL;
  575. }
  576.  
  577. team = get_user_team(index);
  578. ColorChange = ColorSelection(index, MSG_Type, type);
  579.  
  580. ShowColorMessage(index, MSG_Type, message);
  581.  
  582. if(ColorChange)
  583. {
  584. Team_Info(index, MSG_Type, TeamName[team]);
  585. }
  586. }
  587.  
  588. ShowColorMessage(id, type, message[])
  589. {
  590. message_begin(type, get_user_msgid("SayText"), _, id);
  591. write_byte(id)
  592. write_string(message);
  593. message_end();
  594. }
  595.  
  596. Team_Info(id, type, team[])
  597. {
  598. message_begin(type, get_user_msgid("TeamInfo"), _, id);
  599. write_byte(id);
  600. write_string(team);
  601. message_end();
  602.  
  603. return 1;
  604. }
  605.  
  606. ColorSelection(index, type, Color:Type)
  607. {
  608. switch(Type)
  609. {
  610. case RED:
  611. {
  612. return Team_Info(index, type, TeamName[1]);
  613. }
  614. case BLUE:
  615. {
  616. return Team_Info(index, type, TeamName[2]);
  617. }
  618. case GREY:
  619. {
  620. return Team_Info(index, type, TeamName[0]);
  621. }
  622. }
  623.  
  624. return 0;
  625. }
  626.  
  627. FindPlayer()
  628. {
  629. static i;
  630. i = -1;
  631.  
  632. while(i <= get_maxplayers())
  633. {
  634. if(is_user_connected(++i))
  635. {
  636. return i;
  637. }
  638. }
  639.  
  640. return -1;
  641. }

Szerző:  tarkaboci [2015.11.11. 13:27 ]
Hozzászólás témája:  Re: admin chat szinezes

szia mforce :D

hol talalhatom meg ezt az sma file-t?

Valaszt koszonom elore is :)

Szerző:  mforce [2015.11.11. 13:30 ]
Hozzászólás témája:  Re: admin chat szinezes

adminchat

Szerző:  tarkaboci [2015.11.11. 13:31 ]
Hozzászólás témája:  Re: admin chat szinezes

Koszonom =)

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