Page 1 of 1
[ANY] Game Desc Override
Posted: Mon Feb 06, 2017 9:43 pm
by Painkiller
Hello,
Could someone write a plugin for game desc override.
Example:
gamedir ---> hl2mp
and
gamename ---> Half-Life 2 Deathmatch
Thanks in Advance
Re: [ANY] Game Desc Override
Posted: Mon Feb 06, 2017 9:45 pm
by satoon101
Re: [ANY] Game Desc Override
Posted: Tue Feb 07, 2017 1:57 am
by Painkiller
Thanks you
How can I apply it to different maps
Is there a command for my mapconfig plugin? (cvar)
Re: [ANY] Game Desc Override
Posted: Tue Feb 07, 2017 2:48 am
by satoon101
Well, if you want to use a ConVar to set the value, you might try this (untested):
Syntax: Select all
from cvars import ConVar
from engines.server import server_game_dll
from memory import get_virtual_function
from memory.hooks import PreHook
game_description = ConVar(
name='game_description',
value='Starting description',
)
@PreHook(get_virtual_function(server_game_dll, 'GetGameDescription'))
def pre_get_game_description(args):
return game_description.get_string()
Then, just set the
game_description ConVar to whatever you want in any cfg file.
Re: [ANY] Game Desc Override
Posted: Tue Feb 07, 2017 2:59 am
by Painkiller
oO this crasht my server.
I set this in config
game_description PoSt@L
Re: [ANY] Game Desc Override
Posted: Tue Feb 07, 2017 6:01 am
by Ayuto
I guess we need to keep a reference to the return value of get_string(). The easiest way would be to assign it to a global variable and then return that instead.
Re: [ANY] Game Desc Override
Posted: Tue Feb 07, 2017 9:04 am
by Painkiller
Can you do that?
Re: [ANY] Game Desc Override
Posted: Tue Feb 07, 2017 2:01 pm
by satoon101
Ayuto wrote:I guess we need to keep a reference to the return value of get_string().
Oh yeah, that makes sense. Try this then (untested):
Syntax: Select all
from cvars import ConVar
from cvars.flags import ConVarFlags
from engines.server import server_game_dll
from events import Event
from memory import get_virtual_function
from memory.hooks import PreHook
game_description_convar = ConVar(
name='game_description',
value='Starting description',
flags=ConVarFlags.NOTIFY,
)
game_description = game_description_convar.get_string()
@Event('server_cvar')
def server_cvar(game_event):
global game_description
if game_event['cvarname'] == game_description_convar.name:
game_description = game_event['cvarvalue']
@PreHook(get_virtual_function(server_game_dll, 'GetGameDescription'))
def pre_get_game_description(args):
return game_description
Re: [ANY] Game Desc Override
Posted: Tue Feb 07, 2017 3:08 pm
by Painkiller
[SP] Loading plugin 'gamedesc'...
crash_20170207160603_1.dmp[30301]: Uploading dump (out-of-process)
/tmp/dumps/crash_20170207160603_1.dmp
crash_20170207160603_1.dmp[30301]: Finished uploading minidump (out-of-process): success = no
crash_20170207160603_1.dmp[30301]: error: libcurl.so: cannot open shared object file: No such file or directory
crash_20170207160603_1.dmp[30301]: file ''/tmp/dumps/crash_20170207160603_1.dmp'
', upload no: ''libcurl.so: cannot open shared object file: No such file or directory''
Segmentation fault (core dumped)
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
Di 7. Feb 16:06:07 CET 2017: Server restart in 10 seconds
Re: [ANY] Game Desc Override
Posted: Sun Feb 12, 2017 4:21 pm
by Painkiller
There is now a new solution or variant
Re: [ANY] Game Desc Override
Posted: Sat Feb 18, 2017 5:56 pm
by Ayuto
Build 553 should fix your crash:
https://github.com/Source-Python-Dev-Te ... 60b7b6d1caThough, I just did a few tests and noticed that the description for the server browser is only retrieved once.
Re: [ANY] Game Desc Override
Posted: Mon Feb 20, 2017 9:00 pm
by Painkiller
The Problem is now: Starting Discription
(in server.cfg stand : game_description PoSt@L by RocKs
Re: [ANY] Game Desc Override
Posted: Mon Feb 20, 2017 9:03 pm
by Ayuto
Ayuto wrote:Though, I just did a few tests and noticed that the description for the server browser is only retrieved once.
With a GetGameDescription hook, you can only set it once via autoexec.cfg.
Re: [ANY] Game Desc Override
Posted: Mon Feb 20, 2017 9:19 pm
by Painkiller
Thanks, now it works.