Config a private msg for people comming in


(hellreturn) #21

Thanks valkyr and crapshoot. It will help me to spam some 2.55 players. :slight_smile:


(valkyr) #22

I setup a NQ server to test it…

protocol is actually there on ClientConnect but gets stripped out somewhere between then and ClientBegin (I kinda thought it must be, otherwise how would the server know to reject a client with a protocol mismatch?).

Not that I’m sure it’ll actually work, like you say, but anyway.


(UJERebel) #23

et_ClientConnect isn’t an optimal solution solution in my eyes. On many first connects the player has to dowload maps or custom pk3s. I’m not sure if cpm is displayed if the client triggers a download …

 If the mod accepts the connection, it should return nil. Otherwise, the mod should return a string describing the reason the client connection was rejected. 

So this function is called at the very bginning of a connect, so i wonder indeed if a clien would be able to see this message tough…
But since the cpm isn’t created yet ( i suppose) the message can’t be printed, someone has to test if it will be placed in a queue en be displayed when it is possible, or just never displayed…

Grtz

Rebel


(valkyr) #24

I tested it with downloading a map on connecting and it still works.


(UJERebel) #25

Nice!!

So now we have to wait if ThaMasta thinks that this is what he wanted =D

Congratz to evryone:D

Grtz


(valkyr) #26

The reason it works is because, like you say, commands are normally sent into a queue (buffer) :

et.trap_SendConsoleCommand( when, command ) takes when the command is executed as an argument, from the list of predefined constants :

[ul]
[li]et.EXEC_NOW
[/li][li]et.EXEC_INSERT
[/li][li]et.EXEC_APPEND
[/li][/ul]

and this documentation on the Quake 3 source, tells us that EXEC_APPEND is the ā€œnormal caseā€ (commands get added to the end of the buffer)… So et.trap_SendServerCommand will use that method.


(UJERebel) #27

A. Thx for sharing, nice to know :wink:


(crapshoot) #28

[QUOTE=valkyr;227805]
protocol is actually there on ClientConnect but gets stripped out somewhere between then and ClientBegin (I kinda thought it must be, otherwise how would the server know to reject a client with a protocol mismatch?).

Not that I’m sure it’ll actually work, like you say, but anyway.[/QUOTE]

oops, my mistake. you are correct. it is there until ClientUserinfoChanged is called.

here is basically a merge of both of our scripts:

-- command to deliver the text
printCommand = "cpm"

-- greeting text for 2.60 users. note the string is followed by username
greetingText = "Welcome to the server"

-- a message for users on old versions
upgradeText = "Please upgrade to version 2.60"

function et_ClientConnect( clientNum, firstTime, isBot )
	if firstTime == 0 or isBot == 1
		then return nil
	end

	-- get the clients userinfo string
	local userInfo = et.trap_GetUserinfo(clientNum)

	-- welcome users using the latest protocol
	if et.Info_ValueForKey( userInfo, "protocol" ) == "84" then
		et.trap_SendServerCommand(clientNum, string.format("%s \" %s %s", printCommand, greetingText, et.Info_ValueForKey( userInfo, "name" )))
		return nil
	end

	-- ask the others to update (or whatever)
	et.trap_SendServerCommand(clientNum, string.format("%s \" %s", printCommand, upgradeText))

	return nil
end

(zstarsales04) #29

Hello, everybody, I am new here. Here is something might be helpful for you.www.zstar.hk www.edgei-ds.cn (many movies to download)www.tigersupermall.com