[ANY] Game Desc Override

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

[ANY] Game Desc Override

Postby Painkiller » Mon Feb 06, 2017 9:43 pm

Hello,
Could someone write a plugin for game desc override.


Example:

gamedir ---> hl2mp
and
gamename ---> Half-Life 2 Deathmatch

Thanks in Advance
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [ANY] Game Desc Override

Postby satoon101 » Mon Feb 06, 2017 9:45 pm

Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [ANY] Game Desc Override

Postby Painkiller » Tue Feb 07, 2017 1:57 am

Thanks you

How can I apply it to different maps

Is there a command for my mapconfig plugin? (cvar)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [ANY] Game Desc Override

Postby satoon101 » Tue Feb 07, 2017 2:48 am

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.
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [ANY] Game Desc Override

Postby Painkiller » Tue Feb 07, 2017 2:59 am

oO this crasht my server.
I set this in config
game_description PoSt@L
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [ANY] Game Desc Override

Postby Ayuto » Tue Feb 07, 2017 6:01 am

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.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [ANY] Game Desc Override

Postby Painkiller » Tue Feb 07, 2017 9:04 am

Can you do that?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [ANY] Game Desc Override

Postby satoon101 » Tue Feb 07, 2017 2:01 pm

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
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [ANY] Game Desc Override

Postby Painkiller » Tue Feb 07, 2017 3:08 pm

[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
Last edited by Painkiller on Tue Feb 14, 2017 6:57 pm, edited 1 time in total.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [ANY] Game Desc Override

Postby Painkiller » Sun Feb 12, 2017 4:21 pm

There is now a new solution or variant
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [ANY] Game Desc Override

Postby Ayuto » Sat Feb 18, 2017 5:56 pm

Build 553 should fix your crash:
https://github.com/Source-Python-Dev-Te ... 60b7b6d1ca

Though, I just did a few tests and noticed that the description for the server browser is only retrieved once.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [ANY] Game Desc Override

Postby Painkiller » Mon Feb 20, 2017 9:00 pm

The Problem is now: Starting Discription
(in server.cfg stand : game_description PoSt@L by RocKs

Image
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [ANY] Game Desc Override

Postby Ayuto » Mon Feb 20, 2017 9:03 pm

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.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [ANY] Game Desc Override

Postby Painkiller » Mon Feb 20, 2017 9:19 pm

Thanks, now it works.

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 3 guests