Raised This Month: $51 Target: $400
 12% 

So I don't understand how to use GetMapDisplayName...


Post New Thread Reply   
 
Thread Tools Display Modes
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-23-2017 , 19:02   Re: So I don't understand how to use GetMapDisplayName...
Reply With Quote #11

Quote:
Originally Posted by BoosterGold View Post
It's Windows, but I don't know what version. I rent it from a 3rd-party service.
OK, so I'm the one who wrote GetMapDisplayName.

When I wrote it, the various game/OS combinations only recognized certain path types as valid maps:
  • TF2 on all platforms recognized workshop/cp_map.ugc12345678
  • CS:GO on Linux recognized workshop/12345678/de_map
  • CS:GO on Windows recognized workshop\12345678\de_map

As such, GetMapDisplayName treats each of these 3 situations differently.

Note: workshop/12345678 and workshop\12345678 also work because GetMapDisplayName uses FindMap internally to do resolution to the longer format.

I haven't kept up to date with game updates as I haven't really done any development on server plugins in almost a year, so I don't know if CS:GO was updated to allow / on all platforms. If it has, you can always file a bug to have it fixed.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
BoosterGold
Member
Join Date: Nov 2016
Old 02-23-2017 , 19:58   Re: So I don't understand how to use GetMapDisplayName...
Reply With Quote #12

Quote:
Originally Posted by Totenfluch View Post
PHP Code:
#include <map_workshop_functions>
...
    
char sRawMap[PLATFORM_MAX_PATH];
    
char sMap[64];
    
GetCurrentMap(sRawMapsizeof(sRawMap));
    
RemoveMapPath(sRawMapsMapsizeof(sMap));
... 
Thanks! So here's what I put into advertisements.sp:

PHP Code:
    if (StrContains(sText"{currentmapname}"false) != -1) {
        
char sRawMap[PLATFORM_MAX_PATH];
        
char sMap[64];
        
GetCurrentMap(sRawMapsizeof(sRawMap));
        
RemoveMapPath(sRawMapsMapsizeof(sMap));
        
ReplaceString(sTextsizeof(sText), "{currentmapname}"sMapfalse);
    } 
And here's what we get:



Quote:
Originally Posted by Powerlord View Post
I don't know if CS:GO was updated to allow / on all platforms. If it has, you can always file a bug to have it fixed.
Where would I check / who would I ask if CS:GO was updated that way? To whom would I file the bug report with?

Last edited by BoosterGold; 02-23-2017 at 20:02.
BoosterGold is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-24-2017 , 05:52   Re: So I don't understand how to use GetMapDisplayName...
Reply With Quote #13

Quote:
Originally Posted by BoosterGold View Post
Where would I check / who would I ask if CS:GO was updated that way? To whom would I file the bug report with?
Just try this in the server console and see if it works:

PHP Code:
changelevel workshop/126446777/de_seaside 
If it does, then CS:GO has been updated to accept / for both Linux and Windows and GetMapDisplayName needs to be updated to deal with that as well.

(I took that map from your first post, so I'm assuming it's on your server)

As for where to file bugs, AlliedModders has a bugtracker set up. Note that the login for the bugtracker is the email address for your forum account rather than its username.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-24-2017 at 05:55.
Powerlord is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-03-2017 , 22:42   Re: So I don't understand how to use GetMapDisplayName...
Reply With Quote #14

On a side note, CS:GO has updated its behavior, at least it has on Windows. It now supports both / and \ in workshop paths.

I have submitted a pull request to fix GetMapDisplayName, but I currently don't have a Visual Studio version old enough (or a Linux machine at all) to test if it's compiling correctly.

Still, it's not a very complex change.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-03-2017 at 22:52.
Powerlord is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode