GetStoreLocation: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;">
This function was added in v1.8 beta 4  and will not work on previous versions.
</poem>
{{Welcome|desc=Gets the relative path where the store-files are downloaded|
{{Welcome|desc=Gets the relative path where the store-files are downloaded|
params=<source>NoParams</source>|
params=<source>NoParams</source>|
retvals=The relative path of the hostname:port directory  (eg. "127.0.0.1-8192" )  in which store-files (script/main.nut, vehicles/carcols.xml) are downloaded if npc was connected with -d or -D switch. Otherwise, null is returned (store-files are not downloaded i.e. skipped )|
retvals=The relative path of the hostname:port directory  (eg. "127.0.0.1-8192" )  in which store-files (script/main.nut, vehicles/carcols.xml) are downloaded if npc was connected with -d or -D switch. Otherwise, null is returned (store-files are not downloaded i.e. skipped )|
example=<source>
example=<source lang=lua>
local path_to_main_nut=GetStoreLocation();
function OnStoreDownloadComplete()
if(path_to_main_nut)
{
{
path_to_main_nut+="script/main.nut";
local path=GetStoreLocation();
if(path)
{
path+="script/main.nut";
print(path);
}
}
}
...
</source>
</source>|
<source inline>C:/Users/UName/AppData/Roaming/VCMP/04beta/store/127.0.0.1-8192/script/main.nut</source>|
}}
}}

Revision as of 00:39, 13 October 2024

This function was added in v1.8 beta 4 and will not work on previous versions.


Description:
Gets the relative path where the store-files are downloaded


Parameters:

NoParams


Return Values:
The relative path of the hostname:port directory (eg. "127.0.0.1-8192" ) in which store-files (script/main.nut, vehicles/carcols.xml) are downloaded if npc was connected with -d or -D switch. Otherwise, null is returned (store-files are not downloaded i.e. skipped )


Example

function OnStoreDownloadComplete()
{
	local path=GetStoreLocation();
	if(path)
	{
		path+="script/main.nut";
		
		print(path);
	}
}

C:/Users/UName/AppData/Roaming/VCMP/04beta/store/127.0.0.1-8192/script/main.nut