hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.06.04. 16:33



Jelenlévő felhasználók

Jelenleg 127 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 126 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  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Mit csinál ez a rész?
HozzászólásElküldve: 2015.05.12. 19:22 
Offline
Jómunkásember
Avatar

Csatlakozott: 2015.04.18. 17:14
Hozzászólások: 454
Megköszönt másnak: 48 alkalommal
Megköszönték neki: 32 alkalommal
Csáó! mit csinál ez a rész? [mire való , mire szokták használni?]

Ez van a plugin elején :
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <nvault>
  4. #include <fakemeta>
  5. #include <cstrike>
  6. #if defined _colorchat_included
  7. #endinput
  8. #endif
  9. #define _colorchat_included
  10.  
  11. /* ColorChat Support */
  12. #define NORMAL DontChange
  13. #define GREEN DontChange
  14. #define RED Red
  15. #define BLUE Blue
  16. #define GREY Grey
  17. #define ColorChat client_print_color
  18.  
  19. #define MAX_TRANSLATION_LENGTH 2048
  20.  
  21. enum {
  22. DontChange = 0,
  23. Grey = -1,
  24. Red = -2,
  25. Blue = -3
  26. };
  27.  
  28. #define print_team_default DontChange
  29. #define print_team_grey Grey
  30. #define print_team_red Red
  31. #define print_team_blue Blue
  32.  
  33. stock client_print_color(id, sender, const fmt[], any:...)
  34. {
  35. // check if id is different from 0
  36. if (id && !is_user_connected(id))
  37. {
  38. return 0;
  39. }
  40.  
  41. if (sender < Blue || sender > 32)
  42. {
  43. sender = DontChange;
  44. }
  45. else if (sender < DontChange)
  46. {
  47. sender = -sender + 32; // align indexes to the TeamInfo ones
  48. }
  49.  
  50. static const szTeamName[][] =
  51. {
  52. "",
  53. "TERRORIST",
  54. "CT"
  55. };
  56.  
  57. new szMessage[191];
  58.  
  59. new iParams = numargs();
  60.  
  61. // Specific player code
  62. if (id)
  63. {
  64. if (iParams == 3)
  65. {
  66. copy(szMessage, charsmax(szMessage), fmt); // copy so message length doesn't exceed critical 192 value
  67. }
  68. else
  69. {
  70. vformat(szMessage, charsmax(szMessage), fmt, 4);
  71. }
  72.  
  73. if (sender > (32 - Grey))
  74. {
  75. if (sender > (32 - Blue))
  76. {
  77. sender = id;
  78. }
  79. else
  80. {
  81. _CC_TeamInfo(id, sender, szTeamName[sender - (32 - Grey)]);
  82. }
  83. }
  84. _CC_SayText(id, sender, szMessage);
  85. }
  86.  
  87. // Send message to all players
  88. else
  89. {
  90. // Figure out if at least 1 player is connected
  91. // so we don't execute useless useless code if not
  92. new iPlayers[32], iNum;
  93. get_players(iPlayers, iNum, "ch");
  94. if (!iNum)
  95. {
  96. return 0;
  97. }
  98.  
  99. new iMlNumber, i, j;
  100. new Array:aStoreML = ArrayCreate();
  101. if (iParams >= 5) // ML can be used
  102. {
  103. for (j = 3; j < iParams; j++)
  104. {
  105. // retrieve original param value and check if it's LANG_PLAYER value
  106. if (getarg(j) == LANG_PLAYER)
  107. {
  108. i = 0;
  109. // as LANG_PLAYER == -1, check if next parm string is a registered language translation
  110. while ((szMessage[i] = getarg(j + 1, i++))) {}
  111. if (GetLangTransKey(szMessage) != TransKey_Bad)
  112. {
  113. // Store that arg as LANG_PLAYER so we can alter it later
  114. ArrayPushCell(aStoreML, j++);
  115.  
  116. // Update ML array saire so we'll know 1st if ML is used,
  117. // 2nd how many args we have to alterate
  118. iMlNumber++;
  119. }
  120. }
  121. }
  122. }
  123.  
  124. // If arraysize == 0, ML is not used
  125. // we can only send 1 MSG_ALL message if sender != 0
  126. if (!iMlNumber)
  127. {
  128. if (iParams == 3)
  129. {
  130. copy(szMessage, charsmax(szMessage), fmt);
  131. }
  132. else
  133. {
  134. vformat(szMessage, charsmax(szMessage), fmt, 4);
  135. }
  136. if (0 < sender < (32 - Blue)) // if 0 is passed, need to loop
  137. {
  138. if (sender > (32 - Grey))
  139. {
  140. _CC_TeamInfo(0, sender, szTeamName[sender - (32 - Grey)]);
  141. }
  142. _CC_SayText(0, sender, szMessage);
  143. return 1;
  144. }
  145. }
  146.  
  147. if (sender > (32 - Blue))
  148. {
  149. sender = 0; // use receiver index
  150. }
  151.  
  152. for (--iNum; iNum >= 0; iNum--)
  153. {
  154. id = iPlayers[iNum];
  155.  
  156. if (iMlNumber)
  157. {
  158. for (j = 0; j < iMlNumber; j++)
  159. {
  160. // Set all LANG_PLAYER args to player index ( = id )
  161. // so we can format the text for that specific player
  162. setarg(ArrayGetCell(aStoreML, j), _, id);
  163. }
  164.  
  165. // format string for specific player
  166. vformat(szMessage, charsmax(szMessage), fmt, 4);
  167. }
  168.  
  169. if (sender > (32 - Grey))
  170. {
  171. _CC_TeamInfo(id, sender, szTeamName[sender - (32 - Grey)]);
  172. }
  173. _CC_SayText(id, sender, szMessage);
  174. }
  175.  
  176. ArrayDestroy(aStoreML);
  177. }
  178. return 1;
  179. }
  180.  
  181. stock _CC_TeamInfo(iReceiver, iSender, szTeam[])
  182. {
  183. static iTeamInfo = 0;
  184. if (!iTeamInfo)
  185. {
  186. iTeamInfo = get_user_msgid("TeamInfo");
  187. }
  188. message_begin(iReceiver ? MSG_ONE : MSG_ALL, iTeamInfo, _, iReceiver);
  189. write_byte(iSender);
  190. write_string(szTeam);
  191. message_end();
  192. }
  193.  
  194. stock _CC_SayText(iReceiver, iSender, szMessage[])
  195. {
  196. static iSayText = 0;
  197. if (!iSayText)
  198. {
  199. iSayText = get_user_msgid("SayText");
  200. }
  201.  
  202. // Prevent sending format and localization strings via chat
  203. for (new i = 0; i < 192; i++)
  204. {
  205. if (szMessage[i] == 0) break;
  206. if (szMessage[i] == '%' ||
  207. szMessage[i] == '#')
  208. szMessage[i] = ' ';
  209. }
  210.  
  211. message_begin(iReceiver ? MSG_ONE : MSG_ALL, iSayText, _, iReceiver);
  212. write_byte(iSender ? iSender : iReceiver);
  213. if (szMessage[0] > 4)
  214. {
  215. write_byte(1);
  216. szMessage[192 - 2 - 1] = 0; // Two write_byte + string terminator
  217. write_string(szMessage);
  218. }
  219. else
  220. {
  221. szMessage[192 - 1 - 1] = 0; // One write_byte + string terminator
  222. write_string(szMessage);
  223. }
  224. message_end();
  225. }
  226.  
  227. new _translation_szBuffer[MAX_TRANSLATION_LENGTH];
  228.  
  229. stock register_dictionary_colored(const filename[])
  230. {
  231. if (!register_dictionary(filename))
  232. {
  233. return 0;
  234. }
  235.  
  236. new szFileName[256];
  237. get_localinfo("amxx_datadir", szFileName, charsmax(szFileName));
  238. format(szFileName, charsmax(szFileName), "%s/lang/%s", szFileName, filename);
  239. new fp = fopen(szFileName, "rt");
  240. if (!fp)
  241. {
  242. log_amx("Failed to open %s", szFileName);
  243. return 0;
  244. }
  245.  
  246. new szLang[3], szKey[64], TransKey:iKey;
  247.  
  248. while (!feof(fp))
  249. {
  250. fgets(fp, _translation_szBuffer, charsmax(_translation_szBuffer));
  251. trim(_translation_szBuffer);
  252.  
  253. if (_translation_szBuffer[0] == '[')
  254. {
  255. strtok(_translation_szBuffer[1], szLang, charsmax(szLang), _translation_szBuffer, 1, ']');
  256. }
  257. else if (_translation_szBuffer[0])
  258. {
  259. strbreak(_translation_szBuffer, szKey, charsmax(szKey), _translation_szBuffer, charsmax(_translation_szBuffer));
  260. iKey = GetLangTransKey(szKey);
  261. if (iKey != TransKey_Bad)
  262. {
  263. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "!g", "^4");
  264. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "!t", "^3");
  265. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "!n", "^1");
  266. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^4", "^4");
  267. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^3", "^3");
  268. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^1", "^1");
  269. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^n", "^n");
  270. replace_all(_translation_szBuffer, charsmax(_translation_szBuffer), "^^t", "^t");
  271. AddTranslation(szLang, iKey, _translation_szBuffer[2]);
  272. }
  273. }
  274. }
  275.  
  276. fclose(fp);
  277. return 1;
  278. }
  279.  
  280. /* ML from AMXX 1.8.3 support */
  281. #define register_dictionary register_dictionary_colored
  282. #include <fakemeta_util>

_________________
Nem Toretto vagyok!!! hanem s[T]* Levii (És le lehet szállni a Torreto-zásról)

Ts3 Ip: ts.beathost.ml:10005


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Mit csinál ez a rész?
HozzászólásElküldve: 2015.05.12. 19:29 
Offline
Nagyúr
Avatar

Csatlakozott: 2014.04.10. 15:32
Hozzászólások: 776
Megköszönt másnak: 122 alkalommal
Megköszönték neki: 60 alkalommal
Ha jól tudom ez helyettesíti a colorchat.inc-t ,de javítsatok ki ha nem

_________________
Kép


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


Ki van itt

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