Hi, I want to know how to create a config that will sent a message privately to the person who would connect to my server.
You know a website where I could find interesting to add more config to my server?
Thank you!
ThaMasta 
Hi, I want to know how to create a config that will sent a message privately to the person who would connect to my server.
You know a website where I could find interesting to add more config to my server?
Thank you!
ThaMasta 
It should be pretty easy to do with LUA - something along the lines of :
function [et_ClientBegin()](http://wolfwiki.anime.net/index.php/ETPro:Lua_Mod_API#client_management)
et.trap_SendServerCommand( -1, "m \"Welcome to server\"" )
end
et_ClientConnect is another option for LUA. the ability to know if it is a first time connection may be useful here.
I am not clever at all with the Lua thing, in fact I have never work with lua ā¦
Where i should put this command?
the same time, someone could tell me how to do a rotation of 20 maps please? Or tell me where I can find a tutorial? I dont want to open 30 post for all of my question loll !!
Thanks
ThaMasta
Hereās a 10 map objective cycle example config
It does the following
[ul]
[li]Cycles through 10 maps (adding more just means looking at the ād01ā ād02ā variables and increasing them accordingly)
[/li][li]Sets a ā.Nextmapā CVAR which can be seen in server browsers
[/li][li]Shows a ānext mapā banner on every map
[/li][li]Sets the hostname (the name of the server) and MOTD - the info that shows up in the bottom right box when connecting to the server / changing maps
[/li][/ul]
The banner CVAR is probably different for NQ, so if you want the banners youāll need to change b_banner to whatever NQ uses.
To run the cycle youād do :
exec cycle_RTCW_objective
from e.g., your server.cfg.
[QUOTE=ThaMasta;227506]I am not clever at all with the Lua thing, in fact I have never work with lua ā¦
Where i should put this command?[/QUOTE]
OK, this should work :
--Called when a client enters the game
function et_ClientBegin(clientNum)
--Get client's name
pers_netname = et.gentity_get(clientNum, "pers.netname")
--Greeting
greeting = "\"HELLO\""
--Console command
conCommand = "msg " .. pers_netname .. greeting
--Send command
et.trap_SendConsoleCommand(et.EXEC_NOW, conCommand)
end
Change HELLO to whatever you want the message to be.
Put that in a file called āprivate-greeting.luaā (for example) then add it to the list of LUA modules to be loaded in your NQ config.
this is exactly what i have now and why i want to change for maprotation⦠but normaly we cant have more than 10 map in maprotation i think⦠i want to make a 20 rotation map , but in maprotation
i want maprotation, not objectivecycle⦠i want to see all Button + map name in the ācamp_map.tgaā you know what i mean ? and see the list of map rotation in the camp_side.tga
sorry for my bad english lol
Ohhh cool thanks Valkyr !!!
Ah right. So you need 2 x 10 map campaigns.
Thereās plenty of threads about making campaigns, like this one : http://www.splashdamage.com/forums/showthread.php?t=18833
Basically you need :
[ul]
[li]A campaign cycle cfg. (4 campaign example).
[/li][li].campaign file(s) with the campaign definitions (example) (these go in the /scripts folder of a PK3 file)
[/li][/ul]
[QUOTE=valkyr;227523]OK, this should work :
[/QUOTE]
Can you expand your LUA if possible so that it PMās user who are connecting from 2.55 ?
Alrightā¦
That just means checking the cg_etVersion key value in the userinfo string for ā2.55ā before sending the messageā¦
--Called when a client enters the game
function et_ClientBegin(clientNum)
--Get client's name
pers_netname = et.gentity_get(clientNum, "pers.netname")
[B] --Get client's game version
userinfo = et.trap_GetUserinfo(clientNum)
etVersionValue = et.Info_ValueForKey(userinfo, "cg_etVersion")[/B]
--Greeting
greeting = "\"HELLO\""
--Console command
conCommand = "msg " .. pers_netname .. greeting
--Send command if version matches
[B] if string.find(etVersionValue, "2.55") ~= nil
then[/B] et.trap_SendConsoleCommand(et.EXEC_NOW, conCommand)
end
end
I couldnāt get that to work for some reasonā¦
The only downside of et_ClientBegin is that it happens at the end of warm-up and also on shuffles too I think.
hmm, wonder if itās different in ETPro. this quick test works for me in the current NQ (1.2.8 beta)
function et_ClientConnect( clientNum, firstTime, isBot )
-- welcome them on initial connection
if firstTime == 1 then
et.trap_SendServerCommand(clientNum, "cpm \"" .. "Welcome to the server" )
end
return nil
end
Ah right⦠et.trap_SendConsoleCommand doesnāt seem to work at all in the et_ClientConnect callback function. Maybe it gets sent before the client can receive it and gets lost or something, I dunno. Anyway, et.trap_SendServerCommand does work, but doesnāt let you send private messages, so some other type of message has to be used.
So hereās an updated version of the original script :
--Configuration :
--Where to print the message to
printCommand = "b 8"
--Greeting
greeting = "HELLO"
--Called when a client enters the game
function et_ClientConnect(clientNum, firstTime, isBot)
--Construct command
conCommand = printCommand .. " " .. "\"" .. greeting .. "\""
--Send command if first time
if firstTime == 1
then et.trap_SendServerCommand(clientNum, conCommand)
end
end
ā¦and with the 2.55 version check :
--Configuration :
--Where to print the message to
printCommand = "b 8 "
--Greeting
greeting = "HELLO"
--Called when a client enters the game
function et_ClientConnect(clientNum, firstTime, isBot)
--Get client's name
pers_netname = et.gentity_get(clientNum, "pers.netname")
--Get client's game protocol
userinfo = et.trap_GetUserinfo(clientNum)
protocolValue = et.Info_ValueForKey(userinfo, "protocol")
--Construct command
conCommand = printCommand .. " " .. pers_netname .. "\"" .. greeting .. "\""
--Send command if protocol matches 82 (2.55) and is first time
if string.find(protocolValue, "82") ~= nil and firstTime == 1
then et.trap_SendServerCommand(clientNum, conCommand)
end
end
The type of message can be customised by changing :
printCommand = "b 8"
To one of the printing types.
Version canāt actually be checked for on et.ClientConnect, since cg_etVersion isnāt present in the userinfo string until ClientBegin, so now it checks for protocol 82 (which is version 2.55)
[QUOTE=crapshoot;227739]hmm, wonder if itās different in ETPro. this quick test works for me in the current NQ (1.2.8 beta)
function et_ClientConnect( clientNum, firstTime, isBot )
-- welcome them on initial connection
if firstTime == 1 then
et.trap_SendServerCommand(clientNum, "cpm \"" .. "Welcome to the server" )
end
return nil
end
[/QUOTE]
Nice one =)
But when i looked at the code, i saw that you get āIsBotā as a argument toā¦
Wouldnāt it be usefull if you didnāt send this messages to bots to? or will the check be more demanding then sending the message⦠?
for NQ, itās a bit more challenging than that as niether cg_etVersion or protocol appear in the userinfo string. i donāt think NQ allows older versions to connect anyway, so itās probably not necessary.
yeah, good point. updated:
function et_ClientConnect( clientNum, firstTime, isBot )
if firstTime == 0 or isBot == 1
then return nil
end
et.trap_SendServerCommand(clientNum, "cpm \"" .. "Welcome to the server " .. et.Info_ValueForKey( et.trap_GetUserinfo( clientNum ), "name" ))
return nil
end
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 ā¦
uhh, the only other option that i can see is client begin and unless youāre going to store some external vars for tracking whether or not a client has been welcomed or not, its going to send it every time a level loads or team is switched. itās a welcome message, i canāt see anything āoptimalā about creating some overly complicated script to deliver it. use server_motd# vars if you want to guarantee some text for the client when they connect.
p.s. DIE! 