Page 1 of 1

Changing game description

Posted: Thu Apr 28, 2016 9:55 pm
by VinciT
Is there a way to change a server's game description with SP? It's the string found in the 'Game' tab on the server browser:

Image

SourceMod has 'OnGetGameDescription' for this, is there a way to achieve the same thing with SP?

Re: Changing game description

Posted: Fri Apr 29, 2016 6:45 am
by Ayuto
It requires a hook. For which game do you want this?

Re: Changing game description

Posted: Fri Apr 29, 2016 1:15 pm
by VinciT
Half Life 2: Deathmatch

Re: Changing game description

Posted: Sat Apr 30, 2016 10:04 am
by Ayuto
With version 319 you will be able to use this little snippet.

Syntax: Select all

from memory import get_virtual_function
from memory.hooks import PreHook

from engines.server import server_game_dll

@PreHook(get_virtual_function(server_game_dll, 'GetGameDescription'))
def pre_get_game_description(args):
return 'Your description'

Re: Changing game description

Posted: Sat Apr 30, 2016 10:09 am
by iPlayer
I looked at how SM (SteamWorks extension) does it, and it uses SetGameDescription from ISteamGameServer.
Isn't that better to use the function that is meant to set game description anyway?

https://github.com/KyleSanderson/SteamWorks/blob/master/Extension/gsnatives.cpp#L91
https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/public/steam/isteamgameserver.h#L38

Re: Changing game description

Posted: Sat Apr 30, 2016 10:24 am
by Ayuto
Yeah :D I didn't know that method exists.

However, getting this to work requires more work, because the ISteamGameServer header is missing (at least in CS:S). We should create a PR for that. For now the snippet should suffice. :P

Re: Changing game description

Posted: Sat Apr 30, 2016 3:43 pm
by VinciT
Works great, thank you so much Ayuto.