hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.15. 10:11



Jelenlévő felhasználók

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

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó 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: Előtagok
HozzászólásElküldve: 2013.08.27. 16:03 
Offline
Lelkes

Csatlakozott: 2013.08.17. 16:47
Hozzászólások: 26
Megköszönt másnak: 4 alkalommal
Megköszönték neki: 1 alkalommal
Azt a plugint keresem amelyik ki írja emberek elé hogy
PL:
[ADMIN]Torta
[STEAM]Süti
[NON~STEAM]Kenyér
és úgy legyen hogy ne 2x írjon egyszer úgy simán Süti:asd
majd [STEAM]Süti:asd
Aki segít megy a GOMB!

_________________
Kép

Top1Cs.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Előtagok
HozzászólásElküldve: 2013.08.27. 16:08 
Offline
Tud valamit
Avatar

Csatlakozott: 2013.05.14. 21:07
Hozzászólások: 117
Megköszönt másnak: 39 alkalommal
Megköszönték neki: 1 alkalommal
Tokione írta:
Azt a plugint keresem amelyik ki írja emberek elé hogy
PL:
[ADMIN]Torta
[STEAM]Süti
[NON~STEAM]Kenyér
és úgy legyen hogy ne 2x írjon egyszer úgy simán Süti:asd
majd [STEAM]Süti:asd
Aki segít megy a GOMB!


Steames előtag :D
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN "STEAM Players"
  5. #define VERSION "0.0b"
  6. #define AUTHOR "Quit edit"
  7.  
  8. #define ACCESS_LEVEL ADMIN_CVAR
  9. #define ADMIN_LISTEN ADMIN_RCON
  10.  
  11. new message[192]
  12. new sayText
  13. new teamInfo
  14. new maxPlayers
  15.  
  16. new show_ip,show_steamid,show_time,show_ping,show_loss;
  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. public plugin_init()
  27. {
  28. register_plugin (PLUGIN , VERSION , AUTHOR)
  29.  
  30. g_MessageColor = register_cvar ("amx_color", "1")
  31. g_NameColor = register_cvar ("amx_namecolor", "6")
  32. g_AdminListen = register_cvar ("amx_listen", "1")
  33. show_ip = register_cvar("sp_showip","0")
  34. show_steamid = register_cvar("sp_showsteamid","1")
  35. show_time = register_cvar("sp_showtime","0")
  36. show_ping = register_cvar("sp_showping","0")
  37. show_loss = register_cvar("sp_showloss","0")
  38.  
  39.  
  40. sayText = get_user_msgid ("SayText")
  41. teamInfo = get_user_msgid ("TeamInfo")
  42. maxPlayers = get_maxplayers()
  43.  
  44.  
  45. register_message (sayText, "det_duplicated")
  46.  
  47. register_clcmd ("amx_color", "set_color", ACCESS_LEVEL, "<color>")
  48. register_clcmd ("amx_namecolor", "set_name_color", ACCESS_LEVEL, "<color>")
  49. register_clcmd ("amx_listen", "set_listen", ACCESS_LEVEL, "<1 | 0>")
  50.  
  51. register_clcmd ("say /steamosok", "who_steam")
  52. register_clcmd ("say /sp", "who_steam")
  53. register_clcmd ("say /steamosjatekosok", "who_steam")
  54. register_clcmd ("say", "hook_say")
  55. register_clcmd ("say_team", "hook_teamsay")
  56. }
  57.  
  58.  
  59. public det_duplicated (msgId, msgDest, receiver)
  60. {
  61. return PLUGIN_HANDLED
  62. }
  63. public who_steam(id)
  64. {
  65. new bool:ip_showed = false
  66. new bool:steamid_showed = false
  67. new bool:time_showed = false
  68. new bool:ping_showed = false
  69. new bool:loss_showed = false
  70. if (get_pcvar_num(show_ip)>0)
  71. {
  72. ip_showed = true
  73. }
  74. if (get_pcvar_num(show_steamid)>0)
  75. {
  76. steamid_showed = true
  77. }
  78. if (get_pcvar_num(show_time)>0)
  79. {
  80. time_showed = true
  81. }
  82. if (get_pcvar_num(show_ping)>0)
  83. {
  84. ping_showed = true
  85. }
  86. if (get_pcvar_num(show_loss)>0)
  87. {
  88. loss_showed = true
  89. }
  90.  
  91. new players[32], playersFound
  92. get_players(players,playersFound)
  93. new pos, message[2048]
  94. new name[40], ip[30],steamid[32], ping, loss;
  95. new str_pt[6],str_pi[6],str_lo[6]
  96. pos += format(message[pos],2048 - pos,"<STYLE>body{background:#232323;color:#cfcbc2;margin:20px}table{width:100%%;line-height:160%%;font-size:12px}th{background:#2f3030;color:#c4b550;text-align:left}.q{border:2px solid #4a4945}tr{background:#4a4945}.b{background:#3b3b37}</STYLE>")
  97. for (new i = 0;i < playersFound;i++)
  98. {
  99. new bool:steam = false
  100. if (is_user_steam(id))
  101. steam = true
  102. new bool:bot = false
  103. if (is_user_bot(id))
  104. bot = true
  105. get_user_name(players[i],name,39)
  106. get_user_ip(players[i],ip,29,1)
  107. get_user_authid(players[i], steamid, 31)
  108. num_to_str(get_user_time(players[i]),str_pt,5)
  109. get_user_ping(players[i],ping,loss)
  110. num_to_str(ping,str_pi,5)
  111. num_to_str(loss,str_lo,5)
  112.  
  113. pos += format(message[pos],2048 - pos,"%d.<font color=^"red^">%s</font> <font color=^"green^">%s</font>%s %s%s",i+1,name,steam?"[STEAM]":"",bot?"[BOT]":"",ip_showed?"IP:":"",ip_showed?ip:"")
  114. pos += format(message[pos],2048 - pos," %s%s %s%s",steamid_showed?"STEAMID:":"",steamid_showed?steamid:"",time_showed?"TIME:":"",time_showed?str_pt:"")
  115. pos += format(message[pos],2048 - pos," %s%s %s%s^n",ping_showed?"PING":"",ping_showed?str_pi:"",loss_showed?"LOSS:":"",loss_showed?str_lo:"")
  116. }
  117. show_motd(id,message,"STEAMOS Jatekosok")
  118. return PLUGIN_HANDLED
  119. }
  120. public hook_say(id)
  121. {
  122. read_args (message, 191)
  123. remove_quotes (message)
  124.  
  125. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  126.  
  127. return PLUGIN_CONTINUE
  128.  
  129.  
  130. new name[32]
  131. get_user_name (id, name, 31)
  132.  
  133. new bool:steam = false
  134.  
  135. if (is_user_steam(id))
  136. steam = true
  137.  
  138.  
  139. new isAlive
  140.  
  141. if (is_user_alive (id))
  142. {
  143. isAlive = 1
  144. alive = "^x01"
  145. }
  146. else
  147. {
  148. isAlive = 0
  149. alive = "^x01"
  150. }
  151.  
  152. static color[10]
  153.  
  154.  
  155.  
  156. if (steam)
  157. {
  158. switch (get_pcvar_num (g_NameColor))
  159. {
  160. case 1:
  161. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  162.  
  163. case 2:
  164. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  165.  
  166. case 3:
  167. {
  168. color = "SPECTATOR"
  169. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  170. }
  171.  
  172. case 4:
  173. {
  174. color = "CT"
  175. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  176. }
  177.  
  178. case 5:
  179. {
  180. color = "TERRORIST"
  181. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  182. }
  183.  
  184. case 6:
  185. {
  186. get_user_team (id, color, 9)
  187.  
  188. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  189. }
  190. }
  191.  
  192. switch (get_pcvar_num (g_MessageColor))
  193. {
  194. case 1: // Yellow
  195. format (strText, 191, "%s", message)
  196.  
  197. case 2: // Green
  198. format (strText, 191, "^x04%s", message)
  199.  
  200. case 3: // White
  201. {
  202. copy (color, 9, "SPECTATOR")
  203. format (strText, 191, "^x03%s", message)
  204. }
  205.  
  206. case 4: // Blue
  207. {
  208. copy (color, 9, "CT")
  209. format (strText, 191, "^x03%s", message)
  210. }
  211.  
  212. case 5: // Red
  213. {
  214. copy (color, 9, "TERRORIST")
  215. format (strText, 191, "^x03%s", message)
  216. }
  217. }
  218. }
  219.  
  220. else
  221. {
  222. get_user_team (id, color, 9)
  223.  
  224. format (strName, 191, "%s^x03%s", alive, name)
  225.  
  226. format (strText, 191, "%s", message)
  227. }
  228.  
  229. format (message, 191, "%s^x01: %s", strName, strText)
  230.  
  231. sendMessage (color, isAlive)
  232.  
  233. return PLUGIN_CONTINUE
  234. }
  235.  
  236.  
  237. public hook_teamsay(id)
  238. {
  239. new playerTeam = get_user_team(id)
  240. new playerTeamName[19]
  241.  
  242. switch (playerTeam)
  243. {
  244. case 1:
  245. copy (playerTeamName, 11, "Terrorists")
  246.  
  247. case 2:
  248. copy (playerTeamName, 18, "Counter-Terrorists")
  249.  
  250. default:
  251. copy (playerTeamName, 9, "Spectator")
  252. }
  253.  
  254. read_args (message, 191)
  255. remove_quotes (message)
  256.  
  257. if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  258.  
  259. return PLUGIN_CONTINUE
  260.  
  261.  
  262. new name[32]
  263. get_user_name (id, name, 31)
  264.  
  265. new bool:steam = false
  266.  
  267. if (is_user_steam(id))
  268. steam = true
  269.  
  270.  
  271. new isAlive
  272.  
  273. if (is_user_alive (id))
  274. {
  275. isAlive = 1
  276. alive = "^x01"
  277. }
  278. else
  279. {
  280. isAlive = 0
  281. alive = "^x01"
  282. }
  283.  
  284. static color[10]
  285.  
  286.  
  287.  
  288. if (steam)
  289. {
  290. switch (get_pcvar_num (g_NameColor))
  291. {
  292. case 1:
  293. format (strName, 191, "%s^x03%s ^x04[STEAM]", alive, name)
  294.  
  295. case 2:
  296. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  297.  
  298. case 3:
  299. {
  300. color = "SPECTATOR"
  301. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  302. }
  303.  
  304. case 4:
  305. {
  306. color = "CT"
  307. format (strName, 191, "%s^x03%s ^x04[STEAM]", alive, name)
  308. }
  309.  
  310. case 5:
  311. {
  312. color = "TERRORIST"
  313. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  314. }
  315.  
  316. case 6:
  317. {
  318. get_user_team (id, color, 9)
  319.  
  320. format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name)
  321. }
  322. }
  323.  
  324. switch (get_pcvar_num (g_MessageColor))
  325. {
  326. case 1: // Yellow
  327. format (strText, 191, "%s", message)
  328.  
  329. case 2: // Green
  330. format (strText, 191, "^x04%s", message)
  331.  
  332. case 3: // White
  333. {
  334. copy (color, 9, "SPECTATOR")
  335. format (strText, 191, "^x03%s", message)
  336. }
  337.  
  338. case 4: // Blue
  339. {
  340. copy (color, 9, "CT")
  341. format (strText, 191, "^x03%s", message)
  342. }
  343.  
  344. case 5: // Red
  345. {
  346. copy (color, 9, "TERRORIST")
  347. format (strText, 191, "^x03%s", message)
  348. }
  349. }
  350. }
  351.  
  352. else
  353. {
  354. get_user_team (id, color, 9)
  355.  
  356. format (strName, 191, "%s^x03%s", alive, name)
  357.  
  358. format (strText, 191, "%s", message)
  359. }
  360.  
  361. format (message, 191, "%s^x01: %s", strName, strText)
  362.  
  363. sendTeamMessage (color, isAlive, playerTeam)
  364.  
  365. return PLUGIN_CONTINUE
  366. }
  367.  
  368.  
  369. public set_color (id, level, cid)
  370. {
  371. if (!cmd_access(id, level, cid, 2))
  372. return PLUGIN_HANDLED
  373.  
  374. new arg[1], newColor
  375. read_argv (1, arg, 1)
  376.  
  377. newColor = str_to_num (arg)
  378.  
  379. if (newColor >= 1 && newColor <= 5)
  380. {
  381. set_cvar_num ("amx_color", newColor)
  382. set_pcvar_num (g_MessageColor, newColor)
  383.  
  384. if (get_pcvar_num (g_NameColor) != 1 &&
  385. ((newColor == 3 && get_pcvar_num (g_NameColor) != 3)
  386. || (newColor == 4 && get_pcvar_num (g_NameColor) != 4)
  387. || (newColor == 5 && get_pcvar_num (g_NameColor) != 5)))
  388. {
  389. set_cvar_num ("amx_namecolor", 2)
  390. set_pcvar_num (g_NameColor, 2)
  391. }
  392. }
  393.  
  394. return PLUGIN_HANDLED
  395. }
  396.  
  397.  
  398. public set_name_color (id, level, cid)
  399. {
  400. if (!cmd_access(id, level, cid, 2))
  401. return PLUGIN_HANDLED
  402.  
  403. new arg[1], newColor
  404. read_argv (1, arg, 1)
  405.  
  406. newColor = str_to_num (arg)
  407.  
  408. if (newColor >= 1 && newColor <= 6)
  409. {
  410. set_cvar_num ("amx_namecolor", newColor)
  411. set_pcvar_num (g_NameColor, newColor)
  412.  
  413. if ((get_pcvar_num (g_MessageColor) != 1
  414. && ((newColor == 3 && get_pcvar_num (g_MessageColor) != 3)
  415. || (newColor == 4 && get_pcvar_num (g_MessageColor) != 4)
  416. || (newColor == 5 && get_pcvar_num (g_MessageColor) != 5)))
  417. || get_pcvar_num (g_NameColor) == 6)
  418. {
  419. set_cvar_num ("amx_color", 2)
  420. set_pcvar_num (g_MessageColor, 2)
  421. }
  422. }
  423.  
  424. return PLUGIN_HANDLED
  425. }
  426.  
  427.  
  428. public set_listen (id, level, cid)
  429. {
  430. if (!cmd_access(id, level, cid, 2))
  431. return PLUGIN_HANDLED
  432.  
  433. new arg[1], newListen
  434. read_argv(1, arg, 1)
  435.  
  436. newListen = str_to_num (arg)
  437.  
  438. set_cvar_num ("amx_listen", newListen)
  439. set_pcvar_num (g_AdminListen, newListen)
  440.  
  441. return PLUGIN_HANDLED
  442. }
  443.  
  444.  
  445. public sendMessage (color[], alive)
  446. {
  447. new teamName[10]
  448.  
  449. for (new player = 1; player < maxPlayers; player++)
  450. {
  451. if (!is_user_connected(player))
  452. continue
  453.  
  454. if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  455. {
  456. get_user_team (player, teamName, 9)
  457.  
  458. changeTeamInfo (player, color)
  459.  
  460. writeMessage (player, message)
  461.  
  462. changeTeamInfo (player, teamName)
  463. }
  464. }
  465. }
  466.  
  467.  
  468. public sendTeamMessage (color[], alive, playerTeam)
  469. {
  470. new teamName[10]
  471.  
  472. for (new player = 1; player < maxPlayers; player++)
  473. {
  474. if (!is_user_connected(player))
  475. continue
  476.  
  477. if (get_user_team(player) == playerTeam || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  478. {
  479. if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN)
  480. {
  481. get_user_team (player, teamName, 9)
  482.  
  483. changeTeamInfo (player, color)
  484.  
  485. writeMessage (player, message)
  486.  
  487. changeTeamInfo (player, teamName)
  488. }
  489. }
  490. }
  491. }
  492.  
  493.  
  494. public changeTeamInfo (player, team[])
  495. {
  496. message_begin (MSG_ONE, teamInfo, _, player)
  497. write_byte (player)
  498. write_string (team)
  499. message_end()
  500. }
  501.  
  502.  
  503. public writeMessage (player, message[])
  504. {
  505. message_begin (MSG_ONE, sayText, {0, 0, 0}, player)
  506. write_byte (player)
  507. write_string (message)
  508. message_end ()
  509. }
  510. stock bool:is_user_steam(id)
  511. {
  512. static dp_pointer;
  513.  
  514. if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
  515. {
  516. server_cmd("dp_clientinfo %d", id);
  517. server_exec();
  518. return (get_pcvar_num(dp_pointer) == 2) ? true : false;
  519. }
  520.  
  521. return false;
  522. }
  523.  

Ha azt szeretnéd, hogy ne írjon 2x akkor vedd ki az admin_chat_colors plugint és mindent ami chatet használ :D

Admin előtag:
SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2. Copyright 2011 - 2012, m0skVi4a ;]
  3. Plugin created in Rousse, Bulgaria
  4.  
  5.  
  6. Plugin thread 1:
  7.  
  8. Plugin thread 2:
  9.  
  10. Original posted by m0skVi4a ;]
  11.  
  12.  
  13.  
  14. Description:
  15. With this plugin you can set prefixes to Admins with special flags. Also Admins can put custom prefixes to them or to other players if they want, but only if they have the required flag.
  16.  
  17.  
  18.  
  19. Commands:
  20.  
  21. ap_reload_prefixes
  22. Reloads Prefixes' file from console without restarting the server.
  23.  
  24. ap_reload_badprefixes
  25. Reloads Bad Prefixes' file from console without restarting the server.
  26.  
  27. ap_put "prefix"
  28. Puts your prefix if you have the special flag. Or if there is no prefix typed, removes the prefix which you have.
  29.  
  30. ap_put_player "name" "prefix"
  31. Puts prefix to the name you type if you have the special flag. Or if there is no prefix typed, removes the prefix which the player has.
  32.  
  33.  
  34.  
  35. CVARS:
  36.  
  37. "ap_bad_prefixes" - Is the Bad Prefixes option on(1) or off(0). Default: 1
  38. "ap_listen" - Is the Admin Listen option on(1) or off(0). Default: 1
  39. "ap_listen_flag" - The flag, needed for Listen option. Default: a
  40. "ap_custom_current" - Is the Custom Prefix option for each Admin is on(1) or off(0). Default: 1
  41. "ap_custom_current_flag" - The flag, needed for setting custom prefix. Default: b
  42. "ap_custom_others" - Is the Custom Prefix Change option is on(1) or off(0). Default: 1
  43. "ap_custom_others_flag" - The flag, needed for setting custom prefix to other players. Default: c
  44. "ap_say_characters" - Is the Start Say Characters option on(1) or off(0). Default: 1
  45. "ap_prefix_characters" - Is the Checker for Characters in Custom Prefixes' Options on(1) or off(0). Default: 1
  46.  
  47. All CVARS are without quotes
  48.  
  49.  
  50.  
  51. Credits:
  52.  
  53. m0skVi4a ;] - for the idea, making and testing the plugin
  54. SpeeDeeR - for little help with the plugin
  55. Ant1Lamer - for testing the plugin
  56. Vasilii-Zaicev - for testing the plugin
  57.  
  58.  
  59.  
  60. Changelog:
  61.  
  62. April 22, 2012 - V1.0:
  63. - First Release
  64.  
  65. May 19, 2012 - V2.0:
  66. - Full optimization
  67. - Added Bad Prefixes' file
  68. - Added Multi-Lingual file
  69. - Added IP and Name support in ap_prefixes.ini
  70. - Added Forbidden Say characters
  71. - New CVARS for setting the flags for each of the options
  72.  
  73. May 29, 2012 - V2.1:
  74. - Fixed bug with some say or say_team commands are not executed
  75.  
  76. June 26, 2012 - V2.2:
  77. - Fixed bug which blocks the default name change message in CS
  78. - Fixed bug with the white chat plugin which does not worked
  79.  
  80. Visit:
  81.  
  82.  
  83. Contact me on:
  84. SKYPE: pa7ohin
  85. */
  86.  
  87.  
  88. #include <amxmodx>
  89. #include <amxmisc>
  90. #include <nvault>
  91.  
  92. #define FLAG_LOAD ADMIN_CFG
  93. #define MAX_PREFIXES 33
  94. #define MAX_BAD_PREFIXES 100
  95.  
  96. new g_bad_prefix, g_listen, g_listen_flag, g_custom_current, g_custom_current_flag, g_custom_others, g_custom_others_flag, g_say_characters, g_prefix_characters;
  97. new pre_ips_count = 0, pre_names_count = 0, pre_flags_count = 0, bad_prefix_count = 0, i, temp_cvar[2];
  98. new configs_dir[64], file[128], text[128], prefix[32], type[2], acc_type[32], length, line = 0, error[256];
  99. new g_saytxt, g_maxplayers, g_nvault, g_team;
  100. new g_typed[192], g_message[192], g_name[32], typed_prefix[33];
  101. new pre_ips_collect[MAX_PREFIXES][33], ips_collect[MAX_PREFIXES][32], pre_names_collect[MAX_PREFIXES][33], names_collect[MAX_PREFIXES][33], pre_flags_collect[MAX_PREFIXES][33], flags_collect[MAX_PREFIXES][2], bad_prefixes_collect[MAX_BAD_PREFIXES][33], client_prefix[33][33];
  102.  
  103. new const forbidden_say_symbols[] = {
  104. "/",
  105. "!",
  106. "%",
  107. "$"
  108. }
  109.  
  110. new const forbidden_prefixes_symbols[] = {
  111. "/",
  112. "\",
  113. "%",
  114. "$",
  115. ".",
  116. ":",
  117. "?",
  118. "!",
  119. "@",
  120. "#",
  121. "%"
  122. }
  123.  
  124. new const separator[] = "************************************************"
  125. new const in_prefix[] = "[AdminPrefixes]"
  126.  
  127. public plugin_init()
  128. {
  129. register_plugin("Admin Prefixes", "2.2", "m0skVi4a ;]")
  130.  
  131. g_bad_prefix = register_cvar("ap_bad_prefixes", "1")
  132. g_listen = register_cvar("ap_listen", "1")
  133. g_listen_flag = register_cvar("ap_listen_flag", "a")
  134. g_custom_current = register_cvar("ap_custom_current", "1")
  135. g_custom_current_flag = register_cvar("ap_custom_current_flag", "b")
  136. g_custom_others = register_cvar("ap_custom_others", "1")
  137. g_custom_others_flag = register_cvar("ap_custom_others_flag", "c")
  138. g_say_characters = register_cvar("ap_say_characters", "1")
  139. g_prefix_characters = register_cvar("ap_prefix_characters", "1")
  140.  
  141. g_saytxt = get_user_msgid ("SayText")
  142. g_maxplayers = get_maxplayers()
  143. g_nvault = nvault_open("CustomAdminPrefixes")
  144.  
  145. register_concmd("ap_reload_prefixes", "LoadPrefixes")
  146. register_concmd("ap_reload_badprefixes", "LoadBadPrefixes")
  147. register_concmd("ap_put", "SetPrefix")
  148. register_concmd("ap_put_player", "SetPlayerPrefix")
  149. register_clcmd("say", "HookSay")
  150. register_clcmd("say_team", "HookSayTeam")
  151.  
  152. register_dictionary("admin_prefixes.txt")
  153.  
  154. get_configsdir(configs_dir, charsmax(configs_dir))
  155.  
  156. LoadPrefixes(0)
  157. LoadBadPrefixes(0)
  158. }
  159.  
  160. public LoadPrefixes(id)
  161. {
  162. if(!(get_user_flags(id) & FLAG_LOAD))
  163. {
  164. console_print(id, "%L", LANG_SERVER, "PREFIX_PERMISSION", in_prefix)
  165. return PLUGIN_HANDLED
  166. }
  167.  
  168. line = 0, pre_flags_count = 0, pre_ips_count = 0, pre_names_count = 0;
  169. formatex(file, charsmax(file), "%s/ap_prefixes.ini", configs_dir)
  170.  
  171. if(!file_exists(file))
  172. {
  173. formatex(error, charsmax(error), "%L", LANG_SERVER, "PREFIX_NOT_FOUND", in_prefix, file)
  174. set_fail_state(error)
  175. }
  176.  
  177. server_print(separator)
  178.  
  179. while(read_file(file, line++ , text, charsmax(text), length) && pre_flags_count <= MAX_PREFIXES)
  180. {
  181. if(!text[0] || text[0] == '^n' || text[0] == ';')
  182. continue
  183.  
  184. parse(text, type, charsmax(type), prefix, charsmax(prefix), acc_type, charsmax(acc_type))
  185. trim(prefix)
  186.  
  187. if(!type[0] || !prefix[0] || !acc_type[0])
  188. continue
  189.  
  190. replace_all(prefix, charsmax(prefix), "!g", "^x04")
  191. replace_all(prefix, charsmax(prefix), "!t", "^x03")
  192. replace_all(prefix, charsmax(prefix), "!n", "^x01")
  193.  
  194. switch(type[0])
  195. {
  196. case 'i':
  197. {
  198. pre_ips_count++
  199. pre_ips_collect[pre_ips_count] = prefix
  200. ips_collect[pre_ips_count] = acc_type
  201. server_print("%L", LANG_SERVER, "PREFIX_LOAD_IP", in_prefix, prefix, acc_type)
  202. }
  203. case 'n':
  204. {
  205. pre_names_count++
  206. pre_names_collect[pre_names_count] = prefix
  207. names_collect[pre_names_count] = acc_type
  208. server_print("%L", LANG_SERVER, "PREFIX_LOAD_NAME", in_prefix, prefix, acc_type)
  209. }
  210. case 'f':
  211. {
  212. pre_flags_count++
  213. pre_flags_collect[pre_flags_count] = prefix
  214. flags_collect[pre_flags_count][0] = acc_type[0]
  215. server_print("%L", LANG_SERVER, "PREFIX_LOAD_FLAG", in_prefix, prefix, acc_type[0])
  216. }
  217. default:
  218. {
  219. continue
  220. }
  221. }
  222. }
  223.  
  224. if(pre_flags_count <= 0 && pre_ips_count <= 0 && pre_names_count <= 0)
  225. {
  226. server_print("%L", LANG_SERVER, "PREFIX_NO", in_prefix)
  227. }
  228.  
  229. get_user_name(id, g_name, charsmax(g_name))
  230. server_print("%L", LANG_SERVER, "PREFIX_LOADED_BY", in_prefix, g_name)
  231. console_print(id, "%L", LANG_SERVER, "PREFIX_LOADED", in_prefix)
  232.  
  233. server_print(separator)
  234.  
  235. for(new i = 1; i <= g_maxplayers; i++)
  236. {
  237. client_prefix[id] = ""
  238. CheckNvaultPrefix(i)
  239. }
  240.  
  241. return PLUGIN_HANDLED
  242. }
  243.  
  244. public LoadBadPrefixes(id)
  245. {
  246. if(!get_pcvar_num(g_bad_prefix))
  247. {
  248. console_print(id, "%L", LANG_SERVER, "BADP_OFF", in_prefix)
  249. return PLUGIN_HANDLED
  250. }
  251.  
  252. if(!(get_user_flags(id) & FLAG_LOAD))
  253. {
  254. console_print(id, "%L", LANG_SERVER, "BADP_PERMISSION", in_prefix)
  255. return PLUGIN_HANDLED
  256. }
  257.  
  258. line = 0, bad_prefix_count = 0;
  259.  
  260. formatex(file, charsmax(file), "%s/ap_bad_prefixes.ini", configs_dir)
  261.  
  262. if(!file_exists(file))
  263. {
  264. console_print(id, "%L", LANG_SERVER, "BADP_NOT_FOUND", in_prefix, file)
  265. return PLUGIN_HANDLED
  266. }
  267.  
  268.  
  269. server_print(separator)
  270.  
  271. while(read_file(file, line++ , text, charsmax(text), length) && bad_prefix_count <= MAX_BAD_PREFIXES)
  272. {
  273. if(!text[0] || text[0] == '^n' || text[0] == ';')
  274. continue
  275.  
  276. parse(text, prefix, charsmax(prefix))
  277.  
  278. if(!prefix[0])
  279. continue
  280.  
  281. bad_prefix_count++
  282. bad_prefixes_collect[bad_prefix_count] = prefix
  283. server_print("%L", LANG_SERVER, "BADP_LOAD", in_prefix, prefix)
  284. }
  285.  
  286. if(bad_prefix_count <= 0)
  287. {
  288. server_print("%L", LANG_SERVER, "BADP_LOAD", in_prefix)
  289. }
  290.  
  291. get_user_name(id, g_name, charsmax(g_name))
  292. server_print("%L", LANG_SERVER, "BADP_LOADED_BY", in_prefix, g_name)
  293. console_print(id, "%L", LANG_SERVER, "BADP_LOADED", in_prefix)
  294.  
  295. server_print(separator)
  296.  
  297. for(new i = 1; i <= g_maxplayers; i++)
  298. {
  299. CheckNvaultPrefix(i)
  300. }
  301.  
  302. return PLUGIN_HANDLED
  303. }
  304.  
  305. public client_putinserver(id)
  306. {
  307. client_prefix[id] = ""
  308. CheckNvaultPrefix(id)
  309. }
  310.  
  311. public HookSay(id)
  312. {
  313. read_args(g_typed, charsmax(g_typed))
  314. remove_quotes(g_typed)
  315.  
  316. if(equal(g_typed, "") || !is_user_connected(id))
  317. return PLUGIN_HANDLED_MAIN
  318.  
  319. if((client_prefix[id][0] && get_pcvar_num(g_say_characters) == 1) || (!client_prefix[id][0] && get_pcvar_num(g_say_characters) == 2) || get_pcvar_num(g_say_characters) == 3)
  320. {
  321. if(check_say_characters(g_typed))
  322. return PLUGIN_HANDLED_MAIN
  323. }
  324.  
  325. get_user_name(id, g_name, charsmax(g_name))
  326.  
  327. g_team = get_user_team(id)
  328.  
  329. new const team_info[2][][] = {
  330. {"*SPEC* ", "*DEAD* ", "*DEAD* ", "*SPEC* "},
  331. {"", "", "", ""}
  332. }
  333.  
  334. if(client_prefix[id][0])
  335. {
  336. formatex(g_message, charsmax(g_message), "^1%s^4%s^3 %s :^4 %s", team_info[is_user_alive(id)][g_team], client_prefix[id], g_name, g_typed)
  337. }
  338. else
  339. {
  340. formatex(g_message, charsmax(g_message), "^1%s^3%s :^1 %s", team_info[is_user_alive(id)][g_team], g_name, g_typed)
  341. }
  342.  
  343. get_pcvar_string(g_listen_flag, temp_cvar, charsmax(temp_cvar))
  344.  
  345. for(new i = 1; i <= g_maxplayers; i++)
  346. {
  347. if(!is_user_connected(i))
  348. continue
  349.  
  350. if(is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar))
  351. {
  352. send_message(g_message, id, i)
  353. }
  354. }
  355.  
  356. return PLUGIN_HANDLED_MAIN
  357. }
  358.  
  359. public HookSayTeam(id)
  360. {
  361. read_args(g_typed, charsmax(g_typed))
  362. remove_quotes(g_typed)
  363.  
  364. if(equal(g_typed, "") || !is_user_connected(id))
  365. return PLUGIN_HANDLED_MAIN
  366.  
  367. if((client_prefix[id][0] && get_pcvar_num(g_say_characters) == 1) || (!client_prefix[id][0] && get_pcvar_num(g_say_characters) == 2) || get_pcvar_num(g_say_characters) == 3)
  368. {
  369. if(check_say_characters(g_typed))
  370. return PLUGIN_HANDLED_MAIN
  371. }
  372.  
  373. get_user_name(id, g_name, charsmax(g_name))
  374.  
  375. g_team = get_user_team(id)
  376.  
  377. new const team_info[2][][] = {
  378. {"(Spectator) ", "*DEAD*(Terrorist) ", "*DEAD*(Counter-Terrorist) ", "(Spectator) "},
  379. {"(Spectator) ", "(Terrorist) ", "(Counter-Terrorist) ", "(Spectator) "}
  380. }
  381.  
  382. if(client_prefix[id][0])
  383. {
  384. formatex(g_message, charsmax(g_message), "^1%s^4%s^3 %s :^4 %s", team_info[is_user_alive(id)][g_team], client_prefix[id], g_name, g_typed)
  385. }
  386. else
  387. {
  388. formatex(g_message, charsmax(g_message), "^1%s^3%s :^1 %s", team_info[is_user_alive(id)][g_team], g_name, g_typed)
  389. }
  390.  
  391. get_pcvar_string(g_listen_flag, temp_cvar, charsmax(temp_cvar))
  392.  
  393. for(new i = 1; i <= g_maxplayers; i++)
  394. {
  395. if(!is_user_connected(i))
  396. continue
  397.  
  398. if(get_user_team(id) == get_user_team(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar))
  399. {
  400. if(is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar))
  401. {
  402. send_message(g_message, id, i)
  403. }
  404. }
  405. }
  406.  
  407. return PLUGIN_HANDLED_MAIN
  408. }
  409.  
  410. public SetPrefix(id)
  411. {
  412. if(!get_pcvar_num(g_custom_current) || !get_pcvar_string(g_custom_current_flag, temp_cvar, charsmax(temp_cvar)))
  413. {
  414. console_print(id, "%L", LANG_SERVER, "CUSTOM_OFF", in_prefix)
  415. return PLUGIN_HANDLED
  416. }
  417.  
  418. if(!(get_user_flags(id) & read_flags(temp_cvar)))
  419. {
  420. console_print(id, "%L", LANG_SERVER, "CUSTOM_PERMISSION", in_prefix)
  421. return PLUGIN_HANDLED
  422. }
  423.  
  424. read_args(typed_prefix, charsmax(typed_prefix))
  425. remove_quotes(typed_prefix)
  426. trim(typed_prefix)
  427.  
  428. if(get_pcvar_num(g_bad_prefix) && is_bad_prefix(typed_prefix))
  429. {
  430. console_print(id, "%L", LANG_SERVER, "CUSTOM_FORBIDDEN", in_prefix, typed_prefix)
  431. return PLUGIN_HANDLED
  432. }
  433.  
  434. if(get_pcvar_num(g_prefix_characters) && check_prefix_characters(typed_prefix))
  435. {
  436. console_print(id, "%L", LANG_SERVER, "CUSTOM_SYMBOL", in_prefix, typed_prefix, forbidden_prefixes_symbols[i])
  437. return PLUGIN_HANDLED
  438. }
  439.  
  440. get_user_name(id, g_name, charsmax(g_name))
  441.  
  442. if(equal(typed_prefix, ""))
  443. {
  444. nvault_remove(g_nvault, g_name)
  445. console_print(id, "%L", LANG_SERVER, "CUSTOM_REMOVE", in_prefix)
  446. server_print("%L", LANG_SERVER, "CUSTOM_REMOVE_INFO", in_prefix, g_name)
  447. PutPrefix(id)
  448.  
  449. return PLUGIN_HANDLED
  450. }
  451.  
  452. nvault_set(g_nvault, g_name, typed_prefix)
  453.  
  454. client_prefix[id] = typed_prefix
  455.  
  456. console_print(id, "%L", LANG_SERVER, "CUSTOM_CHANGE", in_prefix, typed_prefix)
  457. server_print("%L", LANG_SERVER, "CUSTOM_CHANGE_INFO", in_prefix, g_name, typed_prefix)
  458.  
  459. return PLUGIN_HANDLED
  460. }
  461.  
  462. public SetPlayerPrefix(id)
  463. {
  464. if(!get_pcvar_num(g_custom_current) || !get_pcvar_string(g_custom_current_flag, temp_cvar, charsmax(temp_cvar)) || !get_pcvar_num(g_custom_others) || !get_pcvar_string(g_custom_others_flag, temp_cvar, charsmax(temp_cvar)))
  465. {
  466. console_print(id, "%L", LANG_SERVER, "CO_OFF", in_prefix)
  467. return PLUGIN_HANDLED
  468. }
  469.  
  470. if(!(get_user_flags(id) & read_flags(temp_cvar)))
  471. {
  472. console_print(id, "%L", LANG_SERVER, "CO_FORBIDDEN", in_prefix)
  473. return PLUGIN_HANDLED
  474. }
  475.  
  476. new name_tag[64], typed_name[32];
  477.  
  478. read_args(name_tag, charsmax(name_tag))
  479. remove_quotes(name_tag)
  480. parse(name_tag, typed_name, charsmax(typed_name), typed_prefix, charsmax(typed_prefix))
  481. trim(typed_prefix)
  482.  
  483. if(get_pcvar_num(g_bad_prefix) && is_bad_prefix(typed_prefix))
  484. {
  485. console_print(id, "%L", LANG_SERVER, "CUSTOM_FORBIDDEN", in_prefix, typed_prefix)
  486. return PLUGIN_HANDLED
  487. }
  488.  
  489. if(get_pcvar_num(g_prefix_characters) && check_prefix_characters(typed_prefix))
  490. {
  491. console_print(id, "%L", LANG_SERVER, "CUSTOM_SYMBOL", in_prefix, typed_prefix, forbidden_prefixes_symbols[i])
  492. return PLUGIN_HANDLED
  493. }
  494.  
  495. get_user_name(id, g_name, charsmax(g_name))
  496.  
  497. new target = cmd_target(id, typed_name, 1)
  498.  
  499. if(!target)
  500. return PLUGIN_HANDLED
  501.  
  502. if(equal(typed_prefix, ""))
  503. {
  504. nvault_remove(g_nvault, typed_name)
  505. console_print(id, "%L", LANG_SERVER, "CO_REMOVE", in_prefix, typed_name)
  506. server_print("%L", LANG_SERVER, "CO_REMOVE_INFO", in_prefix, g_name, typed_name)
  507. PutPrefix(target)
  508.  
  509. return PLUGIN_HANDLED
  510. }
  511.  
  512. nvault_set(g_nvault, typed_name, typed_prefix)
  513.  
  514. client_prefix[id] = typed_prefix
  515.  
  516. console_print(id, "%L", LANG_SERVER, "CO_CHANGE", in_prefix, typed_name, typed_prefix)
  517. server_print("%L", LANG_SERVER, "CO_CHANGE_INFO", in_prefix, g_name, typed_name, typed_prefix)
  518.  
  519. return PLUGIN_HANDLED
  520. }
  521.  
  522. public client_infochanged(id)
  523. {
  524. if(!is_user_connected(id))
  525. return PLUGIN_CONTINUE
  526.  
  527. new g_old_name[32];
  528.  
  529. get_user_info(id, "name", g_name, charsmax(g_name))
  530. get_user_name(id, g_old_name, charsmax(g_old_name))
  531.  
  532. if(!equal(g_name, g_old_name))
  533. {
  534. client_prefix[id] = ""
  535. set_task(0.5, "CheckNvaultPrefix", id)
  536. return PLUGIN_HANDLED
  537. }
  538.  
  539. return PLUGIN_CONTINUE
  540. }
  541.  
  542. public CheckNvaultPrefix(const id)
  543. {
  544. new nvault_prefix[33];
  545. get_user_name(id, g_name, charsmax(g_name))
  546. get_pcvar_string(g_custom_current_flag, temp_cvar, charsmax(temp_cvar))
  547.  
  548. new data = nvault_get(g_nvault, g_name, nvault_prefix, charsmax(nvault_prefix))
  549.  
  550. if(data && get_pcvar_num(g_custom_current) && get_user_flags(id) & read_flags(temp_cvar))
  551. {
  552. if((get_pcvar_num(g_bad_prefix) && is_bad_prefix(nvault_prefix)) || (get_pcvar_num(g_prefix_characters) && check_prefix_characters(nvault_prefix)))
  553. {
  554. PutPrefix(id)
  555. return PLUGIN_HANDLED
  556. }
  557. client_prefix[id] = nvault_prefix
  558. return PLUGIN_HANDLED
  559. }
  560. else
  561. {
  562. PutPrefix(id)
  563. return PLUGIN_HANDLED
  564. }
  565. return PLUGIN_HANDLED
  566. }
  567.  
  568. stock PutPrefix(const id)
  569. {
  570. new temp_ip[16];
  571.  
  572. get_user_ip(id, temp_ip, charsmax(temp_ip), 1)
  573.  
  574. for(new i = 0; i <= pre_ips_count; i++)
  575. {
  576. if(equal(temp_ip, ips_collect[i]))
  577. {
  578. client_prefix[id] = pre_ips_collect[i]
  579.  
  580. return PLUGIN_HANDLED
  581. }
  582. }
  583.  
  584. get_user_name(id, g_name, charsmax(g_name))
  585.  
  586. for(new i = 0; i <= pre_names_count; i++)
  587. {
  588. if(equal(g_name, names_collect[i]))
  589. {
  590. client_prefix[id] = pre_names_collect[i]
  591.  
  592. return PLUGIN_HANDLED
  593. }
  594. }
  595.  
  596. for(new i = 0; i <= pre_flags_count; i++)
  597. {
  598. if(get_user_flags(id) & read_flags(flags_collect[i]))
  599. {
  600. client_prefix[id] = pre_flags_collect[i]
  601.  
  602. return PLUGIN_HANDLED
  603. }
  604. }
  605. return PLUGIN_HANDLED
  606. }
  607.  
  608. stock send_message(const message[], const id, const i)
  609. {
  610. message_begin(MSG_ONE, g_saytxt, {0, 0, 0}, i)
  611. write_byte(id)
  612. write_string(message)
  613. message_end()
  614. }
  615.  
  616. bool:check_say_characters(const check_message[])
  617. {
  618. for(new i = 0; i < charsmax(forbidden_say_symbols); i++)
  619. {
  620. if(check_message[0] == forbidden_say_symbols[i])
  621. {
  622. return true
  623. }
  624. }
  625. return false
  626. }
  627.  
  628. bool:check_prefix_characters(const check_prefix[])
  629. {
  630. for(i = 0; i < charsmax(forbidden_prefixes_symbols); i++)
  631. {
  632. if(containi(check_prefix, forbidden_prefixes_symbols[i]) != -1)
  633. {
  634. return true
  635. }
  636. }
  637. return false
  638. }
  639.  
  640. bool:is_bad_prefix(const check_prefix[])
  641. {
  642. for(new i = 0; i <= bad_prefix_count; i++)
  643. {
  644. if(equali(check_prefix, bad_prefixes_collect[i]))
  645. {
  646. return true
  647. }
  648. }
  649. return false
  650. }
  651.  


Gomb jöhet :D


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Előtagok
HozzászólásElküldve: 2013.08.27. 18:01 
Offline
Őskövület
Avatar

Csatlakozott: 2012.03.22. 18:22
Hozzászólások: 2978
Megköszönt másnak: 115 alkalommal
Megköszönték neki: 368 alkalommal
Ez jobb: (iniben lehet adni prefixet névre,steamid-re,ip-re.)

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

_________________
Blasenkampfwagen

https://discord.gg/uBYnNnZP
GTA:PURSUIT MTA


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Előtagok
HozzászólásElküldve: 2013.08.27. 23:14 
Offline
Tud valamit
Avatar

Csatlakozott: 2013.05.14. 21:07
Hozzászólások: 117
Megköszönt másnak: 39 alkalommal
Megköszönték neki: 1 alkalommal
ultraibolya írta:
Ez jobb: (iniben lehet adni prefixet névre,steamid-re,ip-re.)

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

A kettő ugyan az csak én nem linket hanem forráskódot adtam ;)


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 19 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