hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.23. 12:55



Jelenlévő felhasználók

Jelenleg 165 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 165 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  [ 1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Chat Színek
HozzászólásElküldve: 2014.02.27. 06:57 
Offline
Senior Tag
Avatar

Csatlakozott: 2013.12.06. 18:38
Hozzászólások: 229
Megköszönt másnak: 15 alkalommal
Megköszönték neki: 16 alkalommal
Sziasztok meg írnátok nekem ezt a plugint úgy hogy a T írása Piros legyen a Ct-é meg kék

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define MAXSLOTS 32
  5.  
  6. enum Color
  7. {
  8. YELLOW = 1, // Yellow
  9. GREEN, // Green Color
  10. TEAM_COLOR, // Red, grey, blue
  11. GREY, // grey
  12. RED, // Red
  13. BLUE, // Blue
  14. }
  15.  
  16. new TeamInfo;
  17. new SayText;
  18. new MaxSlots;
  19.  
  20. new bool:IsConnected[MAXSLOTS + 1];
  21.  
  22. new TeamName[][] =
  23. {
  24. "",
  25. "TERRORIST",
  26. "CT",
  27. "SPECTATOR"
  28. }
  29.  
  30. new ColorMode;
  31.  
  32. public plugin_init() {
  33. register_plugin("Color Chat", "1.03", "MaTTe");
  34.  
  35. ColorMode = register_cvar("colorchat_mode", "1");
  36.  
  37. register_clcmd("say", "hook_say");
  38. register_clcmd("say_team", "hook_team_say");
  39.  
  40. TeamInfo = get_user_msgid("TeamInfo");
  41. SayText = get_user_msgid("SayText");
  42. MaxSlots = get_maxplayers();
  43. }
  44.  
  45. public client_putinserver(player)
  46. {
  47. IsConnected[player] = true;
  48. }
  49.  
  50. public client_disconnect(player)
  51. {
  52. IsConnected[player] = false;
  53. }
  54.  
  55. public hook_say(id) {
  56. if(!get_pcvar_num(ColorMode))
  57. return PLUGIN_CONTINUE;
  58.  
  59. static text2[200];
  60. read_args(text2, 199);
  61. remove_quotes(text2);
  62. trim(text2);
  63.  
  64. new name[32];
  65. get_user_name(id, name, 31);
  66.  
  67. if(equal(text2, ""))
  68. return PLUGIN_HANDLED;
  69.  
  70. switch(get_pcvar_num(ColorMode)) {
  71. case 1:
  72. {
  73. if(is_user_alive(id))
  74. ColorChat(0, RED, "^x01%s : ^x03%s", name, text2);
  75. else
  76. ColorChat(0, RED, "^x01*HALOTT* %s : ^x03%s", name, text2);
  77. }
  78. case 2:
  79. {
  80. if(is_user_alive(id))
  81. ColorChat(0, GREEN, "^x01%s : ^x04%s", name, text2);
  82. else
  83. ColorChat(0, GREEN, "^x01*HALOTT* %s : ^x04%s", name, text2);
  84. }
  85. case 3:
  86. {
  87. if(is_user_alive(id))
  88. ColorChat(0, BLUE, "^x01%s : ^x03%s", name, text2);
  89. else
  90. ColorChat(0, BLUE, "^x01*HALOTT* %s : ^x03%s", name, text2);
  91. }
  92. }
  93.  
  94. return PLUGIN_HANDLED;
  95. }
  96.  
  97. public hook_team_say(id) {
  98. if(!get_pcvar_num(ColorMode))
  99. return PLUGIN_CONTINUE;
  100.  
  101. static text2[200];
  102. read_args(text2, 199);
  103. remove_quotes(text2);
  104. trim(text2);
  105.  
  106. new name[32];
  107. get_user_name(id, name, 31);
  108.  
  109. if(equal(text2, ""))
  110. return PLUGIN_HANDLED;
  111.  
  112. switch(get_pcvar_num(ColorMode)) {
  113. case 1:
  114. {
  115. if((is_user_alive(id) == 0))
  116. ColorChat(0, RED, "^x01*HALOTT* %s : ^x03%s", name, text2);
  117. else
  118. ColorChat(0, RED, "%s : %s", name, text2);
  119. }
  120. case 2:
  121. {
  122. if((is_user_alive(id) == 0))
  123. ColorChat(0, GREEN, "^x01*HALOTT* %s : ^x04%s", name, text2);
  124. else
  125. ColorChat(0, GREEN, "%s : %s", name, text2);
  126. }
  127. case 3:
  128. {
  129. if((is_user_alive(id) == 0))
  130. ColorChat(0, BLUE, "^x01*HALOTT* %s : ^x03%s", name, text2);
  131. else
  132. ColorChat(0, BLUE, "%s : %s", name, text2);
  133. }
  134. }
  135.  
  136. return PLUGIN_HANDLED;
  137. }
  138.  
  139. public ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  140. {
  141. static message[256];
  142.  
  143. switch(type)
  144. {
  145. case YELLOW: // Yellow
  146. {
  147. message[0] = 0x01;
  148. }
  149. case GREEN: // Green
  150. {
  151. message[0] = 0x04;
  152. }
  153. default: // White, Red, Blue
  154. {
  155. message[0] = 0x03;
  156. }
  157. }
  158.  
  159. vformat(message[1], 251, msg, 4);
  160.  
  161. // Make sure message is not longer than 192 character. Will crash the server.
  162. message[192] = '^0';
  163.  
  164. new team, ColorChange, index, MSG_Type;
  165.  
  166. if(!id)
  167. {
  168. index = FindPlayer();
  169. MSG_Type = MSG_ALL;
  170.  
  171. } else {
  172. MSG_Type = MSG_ONE;
  173. index = id;
  174. }
  175.  
  176. team = get_user_team(index);
  177. ColorChange = ColorSelection(index, MSG_Type, type);
  178.  
  179. ShowColorMessage(index, MSG_Type, message);
  180.  
  181. if(ColorChange)
  182. {
  183. Team_Info(index, MSG_Type, TeamName[team]);
  184. }
  185. }
  186.  
  187. ShowColorMessage(id, type, message[])
  188. {
  189. emessage_begin(type, SayText, _, id);
  190. ewrite_byte(id)
  191. ewrite_string(message);
  192. emessage_end();
  193. }
  194.  
  195. Team_Info(id, type, team[])
  196. {
  197. emessage_begin(type, TeamInfo, _, id);
  198. ewrite_byte(id);
  199. ewrite_string(team);
  200. emessage_end();
  201.  
  202. return 1;
  203. }
  204.  
  205. ColorSelection(index, type, Color:Type)
  206. {
  207. switch(Type)
  208. {
  209. case RED:
  210. {
  211. return Team_Info(index, type, TeamName[1]);
  212. }
  213. case BLUE:
  214. {
  215. return Team_Info(index, type, TeamName[2]);
  216. }
  217. case GREY:
  218. {
  219. return Team_Info(index, type, TeamName[0]);
  220. }
  221. }
  222.  
  223. return 0;
  224. }
  225.  
  226. FindPlayer()
  227. {
  228. new i = -1;
  229.  
  230. while(i <= MaxSlots)
  231. {
  232. if(IsConnected[++i])
  233. {
  234. return i;
  235. }
  236. }
  237.  
  238. return -1;
  239. }
  240.  


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


Ki van itt

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