hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.23. 21:22



Jelenlévő felhasználók

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

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-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  [ 4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Prefix
HozzászólásElküldve: 2013.09.21. 09:18 
Offline
Tud valamit
Avatar

Csatlakozott: 2013.09.12. 16:51
Hozzászólások: 144
Megköszönt másnak: 51 alkalommal
Megköszönték neki: 6 alkalommal
Olyan, plugin kéne hogy admin neve előtt írjon valamit
és steam idre lehet adni

pl:

[Tulaj] "steamid"

Kösz.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Prefix
HozzászólásElküldve: 2013.09.21. 09:26 
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
Szerintem az 1 kicsit húzós lenne steam id de amúgy ittvan 1 jobb:



V2.0

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


Alap olyan mint a adminchat color (lehet állítani a színt)


A hozzászólást 1 alkalommal szerkesztették, utoljára stupid 2013.09.21. 11:18-kor.

Ők köszönték meg stupid nek ezt a hozzászólást: nexus (2013.09.21. 09:38)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Prefix
HozzászólásElküldve: 2013.09.21. 15:56 
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
A steam id s dolgot is megtaláltam. tessék: http://amxmodx.crys.hu/site/?p=pluginz& ... eamplayers


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Prefix
HozzászólásElküldve: 2013.09.21. 16:13 
Offline
Felfüggesztve
Avatar

Csatlakozott: 2013.06.09. 18:47
Hozzászólások: 2004
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 220 alkalommal
Te tudod megadni, milyen előtag legyen az adminoknak.

http://amxmodx.crys.hu/site/?p=pluginz& ... dminprefix

_________________
Ha elnyerte valamelyik témában a hozzászólásom a tetszésedet melyet olvastál, akkor egy egyszerű gombnyomással kifejezheted, hogy tetszett.


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  [ 4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 8 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