Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85.
#include <amxmodx> #include <orpheu> #include <orpheu_stocks> new msgVal[256], msgID; new bool:catch=false, bool:stop=false; new msgPlayer, maxPlayers; public plugin_init(){ register_plugin("Prefix replacer", "0.2", "DarkGL & benio101"); new OrpheuFunction:WriteString=OrpheuGetEngineFunction("pfnWriteString", "WriteString"); new OrpheuFunction:MessageBegin=OrpheuGetEngineFunction("pfnMessageBegin", "MessageBegin"); new OrpheuFunction:MessageEnd=OrpheuGetEngineFunction("pfnMessageEnd", "MessageEnd"); new OrpheuFunction:WriteByte=OrpheuGetEngineFunction("pfnWriteByte", "WriteByte"); OrpheuRegisterHook(WriteString, "WriteStringf", OrpheuHookPre); OrpheuRegisterHook(MessageBegin, "MessageBeginf", OrpheuHookPre); OrpheuRegisterHook(MessageEnd, "MessageEndf", OrpheuHookPost); OrpheuRegisterHook(WriteByte, "WriteBytef", OrpheuHookPre); } public plugin_cfg(){ maxPlayers=get_maxplayers(); } public OrpheuHookReturn:WriteBytef(val){ return ((catch && stop) ? OrpheuSupercede : OrpheuIgnored); } public OrpheuHookReturn:WriteStringf(str[]){ if(catch){ if(stop){ copy(msgVal, 255, str); return OrpheuSupercede; } if(!msgPlayer){ new tmp[256]; copy(tmp, 255, str); if(containi(tmp, "[PREFIX]")!=-1){ replace_all(tmp, 255, "[PREFIX]", "[HNS]"); OrpheuSetParam(1, tmp); } } } return OrpheuIgnored; } public OrpheuHookReturn:MessageBeginf(msgDest, msgType, Float:origin[], idDest){ catch=stop=false; msgID=0; msgVal=""; switch(msgType){ case 23, 76, 77:{ catch=true; msgPlayer=idDest; if(msgType!=23 && (!msgPlayer || msgDest==MSG_ALL)){ msgID=msgType; stop=true; } } } } public OrpheuHookReturn:MessageEndf(){ msgPlayer=0; if(stop){ new msg[256]; copy(msg, 255, msgVal); msgVal=""; switch(msgID){ case 76, 77:{ for(new id=1; id<=maxPlayers; ++id){ if(is_user_connected(id)){ message_begin(MSG_ONE_UNRELIABLE, msgID, {0, 0, 0}, id); write_byte(id) write_string(msg); message_end(); } } } } } msgID=0; }
Dodanych wklejek: 12215
Powered By (Pav32) Pastebin © 2011