Raised This Month: $ Target: $400
 0% 

[CSGO] Get game dir


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OfficialSikari
Junior Member
Join Date: Aug 2017
Location: /dev/null
Old 09-15-2017 , 07:40   [CSGO] Get game dir
Reply With Quote #1

Hey! I saw a few guys asking how to get the full game path to sourcemod
This might also work on other games

Code:
#include <sourcemod>

public void OnPluginStart()
{
	HookEvent("server_spawn", ServerSpawn);
}


public Action ServerSpawn(Event event, const char[] name, bool dontBroadcast)
{
        //Outputs G:\steamcmd\steamapps\common\Counter-Strike Global Offensive Beta - Dedicated Server\csgo
	char game[256];
	event.GetString("game", game, sizeof(game));
        
	char sm_path[128];
	BuildPath(Path_SM, sm_path, sizeof(sm_path), "");
	
	char full_path[400];
	Format(full_path, sizeof(full_path), "%s\\%s", game, sm_path);
	PrintToServer("Full Path: %s", full_path);
	//Output:  Full Path: G:\steamcmd\steamapps\common\Counter-Strike Global Offensive Beta - Dedicated Server\csgo\addons\sourcemod\

	UnhookEvent("server_spawn", ServerSpawn);
}

Last edited by OfficialSikari; 01-14-2019 at 16:00.
OfficialSikari is offline
Ermert1992
Member
Join Date: Jan 2012
Location: Germany
Old 10-23-2017 , 03:30   Re: [CSGO] Get game dir
Reply With Quote #2

Cool. Thank you!
Ermert1992 is offline
Reply


Thread Tools
Display Modes

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 13:15.


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