Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › How to supress Servermessage?
10 posts, 5 people · 1,168 views Thread Rating: ★★★★★
closedHow to supress Servermessage?
Started by nachtcomet on 07-31-2007, 07:54 AM
N nachtcomet
started this thread
Posts: 4
Threads: 1
Joined: Jul 2007
07-31-2007, 07:54 AM #1

Hi there,rnrnI'am new with scriptings Plugins for HL:DoD. Now I tried to write a Plugin which will do the following:rnrn- there is a File called "reserved.ini" in the config folder, in which are STEAMIDs and Names("STEAMIDxxxxxxx" "aReservedName" and so on)rnrn- If someone connecteds with a reserved Name, the clients STEAMID is checked against the File - If the Client has not the correct SteamID the client will be renamed (NiceNickButWrongSTEAMID) and there will be a public Chatmessage.rnrn- If someone trys to change the Name, the Clients STEAMID will be checked against the file too - If the Clients STEAMID isn't correct, the Client will be renamed back to the old Name BUT (now the Problem) the Server always say "XYZ has change his Name to ZYX"rnrnHow to supress this Message (or otherwise) who to post a Messege after the Server Announcement?rnrn

rn{rnclient_cmd(0, "spk fvox/alert")rnclient_print(0,print_chat,"+++ [RName] %s hat versucht einen geschuetzen Namen zu benutzen +++",name)rnset_user_info(id,"name",name)rnengclient_cmd (id,"name",name)	rnclient_cmd(id,"name ",name)rn}rn
rnrnthis is the part of the code in which I try to rename the Client back - but how torn- supress the Servers Namechange Annoucement ORrn- how to post a Chatmessage AFTER the Annoucement?rnrnsorry for my bad english ;)

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
07-31-2007, 12:53 PM #2

something like this in the plugin_init:n

register_event("TextMsg","change_name","a","1=3","2=#game_changed_name")
then add this function to the plugin:n
public change_name()n{n    return PLUGIN_HANDLEDn}
that will block the name change chat text (at least i think..idk i just did this real quick)nnof course you would have to add a little more to it according to your other code to determine if it should be blocked or allowed or whatevernnand if you need to get the user names & id in the change_name fucntion you can use this in it:n
new old_name[32], new_name[32]nread_data(3,old_name,31)nread_data(4,new_name,31)nnew userID = get_user_index(old_name)
so you could probably use something with that to check if the name is valid for the steamid right from that function, might make it easier to block/allow the chat printnnand to print a chat message with that data could be something like:n
client_print(0, print_chat, "%s has changed their name to %s", old_name, new_name)
Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
07-31-2007, 05:38 PM #3

Also, check out a similar plugin that Tatsu made for reference:rnhttp://dodplugins.net/forums/showthread.php?t=660

N nachtcomet
started this thread
Posts: 4
Threads: 1
Joined: Jul 2007
07-31-2007, 05:56 PM #4

Sure, there is more Code.nnI used public client_infochanged(id) {} to check if a Namechange was done.nn

n//Datei_STEAMID[] and Datei_Name[] are read from reservednicks.ininpublic client_infochanged(id){n	if (is_user_connected(id)){n		new STEAMID[32], NeuerName[32], Name[32]n		new Fertig=0n		get_user_info(id, "name", NeuerName,31)n		get_user_authid(id,STEAMID,31)n		get_user_name(id,Name,31)n		for (new i = 0; i < numPlayers; i++) {n			if(equal(Datei_Name, NeuerName))n			{n				if(!equal(Datei_STEAMID[i], STEAMID) && !Fertig)n				{n					client_print(0,print_chat,"+++ [RName] %s hat versucht den reservierten Namen %s zu benutzen +++",Name,NeuerName)n					set_user_info(id,"name",Name)	n					engclient_cmd (id,"name",Name)n					client_cmd(id,"name ",Name)n					Fertig=1n				}n			}n		}n
nnThis Code do to trick (rename to old Name to prevent using a registered Name) but Server will show "XYZ has change his Name to ZXY" under the Warning of RName (the desired name of this plugin).nnThis "register_event("TextMsg","change_name","a","1=3","2=#game_changed_name")" nthis will do what?nnNotice the Server that all Nickchange-Text-Event will go through my Plugin? so "client_infochanged" wont be necessary anymore?

N nachtcomet
started this thread
Posts: 4
Threads: 1
Joined: Jul 2007
09-24-2007, 05:10 PM #5

sorry to pop in again, but i dont get it.rnrnthis is what i wrote since last postrn(got a break because of the family - so now i am on it again)rnrn

rn#include <amxmodx>rn#include <amxmisc>rnrnnew DateiSteamID[500][32]rnnew DateiSpielername[500][32]rnnew AnzahlSpielerrnrnpublic plugin_init()rn	{rn		register_event("TextMsg","change_name","a","1=3","2=#game_changed_name")	rn		register_plugin("R(e)Name", "0.1", "nachtmacher")rn		register_cvar("dod_R(e)Name_plugin", "Version 0.1", FCVAR_SERVER|FCVAR_SPONLY)  	rn	rn		new Dateiname[64]rn		get_configsdir(Dateiname , 63)rn		format(Dateiname, 63, "%s/reservednicks.ini", Dateiname)rn		ladeSpieler(Dateiname) rn		return PLUGIN_CONTINUErn	}rn	rnladeSpieler(Dateiname[])rn	{rn		if (!file_exists(Dateiname)) rn			{rn				log_message("R(e)Name - Fehler - %s nicht gefunden",Dateiname)rn			}rn		elsern			{rn				new text[256]rn				new line = 0rn				new textLenrn				while (read_file(Dateiname,line++,text,255,textLen)) rn					{         rn						if (text[0] == ';') continuern						parse(text, DateiSteamID[AnzahlSpieler],31,DateiSpielername[AnzahlSpieler], 31)rn						++AnzahlSpielerrn					}rn				log_message("R(e)Name - %s gelesen - %s Eintraege gefunden",Dateiname,AnzahlSpieler)rn			}rn		return 1rn	}rn		rnrnpublic client_connect(id)rn	{rn		new SteamID[32], Name[32]rn		new Fertig=0rn		get_user_authid(id,SteamID,31)rn		get_user_name(id,Name,31)	rn		for (new i = 0; i < AnzahlSpieler; i++) rn			{rn				if(equal(SteamID, DateiSteamID[i])) rn					{	rn						client_print(0,print_chat,"+++ [R(e)Name] Spieler %s wurde entsprechend der Clanrules umbenannt in %s +++",Name,DateiSpielername[i])rn						set_user_info(id,"name",DateiSpielername[i])			rn						Fertig=1rn					}rn			}rn		if (!Fertig)rn			{rn				for (new i = 0; i < AnzahlSpieler; i++) rn					{rn						if(equal(Name, DateiSpielername[i])) rn							{rn								if (!equal(SteamID,DateiSteamID[i])) rn									{rn										client_print(0,print_chat,"+++ [R(e)Name] Spieler %s hat versucht mit einem reservierten Namen (%s) zu joinen +++",SteamID, Name)											rn										set_user_info(id,"name","Nice Nick but wrong STEAM ID")				rn										Fertig=1rn									}rn							}rn					}	rn			}rn		return PLUGIN_CONTINUE 			rn	}	rn	rnpublic client_infochanged(id)rn	{rn		if (is_user_connected(id))rn			{rn				new NeuerName[32], AlterName[32], SteamID[32]rn				new Fertig=0rn				get_user_info (id, "name", NeuerName, 31)rn				get_user_authid (id, SteamID, 31)rn				get_user_name (id, AlterName, 31)		rn				for (new i = 0; i < AnzahlSpieler; i++) rn					{rn						if(equal(SteamID, DateiSteamID[i]) && !Fertig) rn							{rn								if(!equal(DateiSpielername[i], NeuerName))rn									{rn										client_print(0,print_chat,"+++ [R(e)Name] Spieler %s hat unerlaubterweise versucht seinen Namen nach %s zu aendern +++",AlterName,NeuerName)					rn										set_user_info(id,"name",AlterName)	rn										Fertig=1rn									}rn							}rn					}rn				if (!Fertig)rn					{rn						for (new i = 0; i < AnzahlSpieler; i++) rn							{rn								if(equal(DateiSpielername[i], NeuerName)) rn									{rn										if (!equal(SteamID, DateiSteamID[i])) rn											{rn												client_print(0,print_chat,"+++ [R(e)Name] Spieler %s hat versucht einen geschuetzten Namen (%s) zu benutzen +++",AlterName,NeuerName)											rn												set_user_info(id,"name",AlterName)							rn												Fertig=1rn											}rn									}rn							}		rn					}	rn				if (!Fertig) rn					{rn						if (!equal(NeuerName,AlterName))rn							{rn								client_print(0, print_chat, "+++ [R(e)Name] Spieler %s hat sich umbenannt in %s",AlterName,NeuerName)rn							}rn					}rn			}rn		return PLUGIN_CONTINUE			rn	}rn	rnpublic change_name()rn	{	rn		return PLUGIN_HANDLEDrn	}	rn		rn
rnrnthe plugin does the trick.rn- if you are in reservednicks.ini - you cant connect with every nick - but you get renamed (clanrules - admins have to play with the right nick).rn- if you try to connect with a reserved name without the right steamid - you got renamed to "nice nick but wrong steam id"rn- if you try to rename yourself to a reserved nick - you will be noticed to have the wrong streamid.rn- if you try to rename yourself and you are on the list - you will be notice that this is forbiddenrnrnBUTrnrnthis lousy servermessage "X has changed his name to Y" is everytime written into public chat (even if you are forbidden to change your name).rnrnon a german AMXX it looks like this (testerchen is a reserved name)rnrn+++ [R(e)Name] Spieler test hat versucht einen geschuetzten Namen (testerchen) zu benutzen +++rn* test hat Namen zu testerchen geƤndertrnrnthe bold one is the one i dont want to show.rnrnany further comments? i tried to find out more about "register_event", but all i found out was not very helpfull (where to find all possible "TextMsg" events? as a example).rnrnsorry for the bad english

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
09-24-2007, 06:55 PM #6

Try changing the PLUGIN_CONTINUE to a PLUGIN_HANDLED in the 2nd to last function.rnrnIf that doesn't work, perhaps you'll have to block the TextMsg message.

N nachtcomet
started this thread
Posts: 4
Threads: 1
Joined: Jul 2007
09-24-2007, 08:16 PM #7

i have tried it - but isn't working.ncan you tell me how to "block" the TextMsg?nnthx in advance

Wilson [29th ID]
posted here
Posts: 623
Threads: 57
Joined: Oct 2005
09-24-2007, 09:52 PM #8

Check out dod STEAMID MSG for an example and better understanding of how to hook that.

FeuerSturm
posted here
Posts: 166
Threads: 15
Joined: Jun 2007
09-25-2007, 01:41 AM #9

you can take a look at my "personal" name force plugin as i force myrnclan members to play with their predefined nicknames as well whilernblocking the name change message:

=|[76AD]|= TatsuSaisei
posted here
Posts: 794
Threads: 54
Joined: May 2005
09-25-2007, 10:32 PM #10
;7021']Also, check out a similar plugin that Tatsu made for reference:nhttp://dodplugins.net/forums/showthread.php?t=660
n nYikes !! A forgottten plugin... I never got around to "completing" this... I have a personal version that has half of what I wanted to publicly include, but never "officially" made any such plugin for public use as of yet...n nbut thanx for the mention Wilson...

Archive › Old Forum Threads › Help › Scripting Help › How to supress Servermessage?
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC