AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [REQ] Change/delete "Player has left the game" (https://forums.alliedmods.net/showthread.php?t=282768)

Joce93 05-16-2016 12:56

[REQ] Change/delete "Player has left the game"
 
Hello guys.

Firstly, sorry if i'm in the wrong section.

I need help to change or delete the quote "Player has left the game" when someone leaves the server. (I don't need to change anything about the joining message, it's ok)

I know it's possible,i've seen this before on a server. I want to replace the original quote, not adding another line with a plugin.

I'm playing on Sven Coop (HL1 mod).

Thanks :)

gabuch2 05-16-2016 13:44

Re: [REQ] Change/delete "Player has left the game"
 
I have the same request, but I want to erase the original Player Join message to replace it with my own.

fysiks 05-16-2016 22:38

Re: [REQ] Change/delete "Player has left the game"
 
Here is a plugin that is able to block those messages. (dodplugins.net is down at the moment so I couldn't find the original post/code)

Joce93 05-17-2016 14:38

Re: [REQ] Change/delete "Player has left the game"
 
Quote:

Originally Posted by fysiks (Post 2419612)
Here is a plugin that is able to block those messages. (dodplugins.net is down at the moment so I couldn't find the original post/code)

I tryed on Sven Co-op but it's not working.

Can somebody help me ?

abdobiskra 05-18-2016 02:09

Re: [REQ] Change/delete "Player has left the game"
 
something like that !

im not tested

PHP Code:

#include <amxmodx>

public plugin_init() {

    
register_message(get_user_msgid("TextMsg"),    "msgTextMsg");
}
public 
msgTextMsg(msgidmsgdestmsgent) {
    
        new 
sz[80]
        
get_msg_arg_string(2sz79)
        if(
containi(sz"has left the game") != -1)
                return 
PLUGIN_HANDLED
        
return PLUGIN_CONTINUE



SpannerSpammer 05-18-2016 05:12

Re: [REQ] Change/delete "Player has left the game"
 
Joce93, the default HL disconnect message is sent via a SayText MSG.

Try hooking that before trying TextMsg. If that doesn't work then try hooking
different messages until you find the right one: HudText , HudTextPro etc.

_____________________________________________ _________________________

Shattered Heart Lynx. The default HL connect message is sent via TextMsg,
hook that and use set_msg_arg_string() to modify it.

Now bear in mind that different MODs might use different messages than the default HL
ones to send connect/disconnect messages.

fysiks 05-18-2016 09:07

Re: [REQ] Change/delete "Player has left the game"
 
You could always hook the messages and write all of them to a file and you should be able to find the message you are looking for.

Joce93 05-19-2016 14:01

Re: [REQ] Change/delete "Player has left the game"
 
Quote:

Originally Posted by SpannerSpammer (Post 2419882)
Joce93, the default HL disconnect message is sent via a SayText MSG.

Try hooking that before trying TextMsg. If that doesn't work then try hooking
different messages until you find the right one: HudText , HudTextPro etc.

_____________________________________________ _________________________

Shattered Heart Lynx. The default HL connect message is sent via TextMsg,
hook that and use set_msg_arg_string() to modify it.

Now bear in mind that different MODs might use different messages than the default HL
ones to send connect/disconnect messages.



Can you help me for the script ? I used abdobiskra's code replacing "TextMsg" by "SayText" but it does not work:

PHP Code:

#include <amxmodx>

public plugin_init() {

    
register_message(get_user_msgid("SayText"),    "msgSayText");
}
public 
msgSayText(msgidmsgdestmsgent) {
    
        new 
sz[80]
        
get_msg_arg_string(2sz79)
        if(
containi(sz"example message") != -1)
                return 
PLUGIN_HANDLED
        
return PLUGIN_CONTINUE



SpannerSpammer 05-19-2016 19:01

Re: [REQ] Change/delete "Player has left the game"
 
Here you go, this is just an example of what to do. The type and usage of Connect/Disconnect messages
may depend on The MOD. For instance, TFC sends a TextMsg Disconnect message with a localized string
for the 2nd (string) parameter and the disconnecting player name for the 3rd (string) parameter.

The code is set to override the connect/disconnect message witha custom one,
to just block the messages, comment out the line: #define OVERRIDE

Spoiler

SpannerSpammer 05-20-2016 14:59

Re: [REQ] Change/delete "Player has left the game"
 
Forgot to add: If the MOD uses a titles.txt file, check and see if there is a
localized text entry for a connection message ( %s has joined the game ) etc.

For TFC it looks like:
Code:

Game_playerjoin
{
%s has joined the game
}

This is sent via a TextMsg message as the 2nd parameter, all localized strings are preceded
with the # chracter so the string is sent as: #Game_playerjoin. The 3rd parameter
of the message is the player name.


All times are GMT -4. The time now is 18:33.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.