Added GetGameFolderName() native

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40727
This commit is contained in:
Scott Ehlert 2007-05-02 19:33:51 +00:00
parent 5c6ba68e4b
commit 3cdd3c0d0d
2 changed files with 21 additions and 0 deletions

View File

@ -140,6 +140,16 @@ static cell_t GetGameDescription(IPluginContext *pContext, const cell_t *params)
return numBytes; return numBytes;
} }
static cell_t GetGameFolderName(IPluginContext *pContext, const cell_t *params)
{
const char *name = g_SourceMod.GetModFolderName();
size_t numBytes;
pContext->StringToLocalUTF8(params[1], params[2], name, &numBytes);
return numBytes;
}
static cell_t GetCurrentMap(IPluginContext *pContext, const cell_t *params) static cell_t GetCurrentMap(IPluginContext *pContext, const cell_t *params)
{ {
size_t bytes; size_t bytes;
@ -277,6 +287,7 @@ REGISTER_NATIVES(halflifeNatives)
{"GetCurrentMap", GetCurrentMap}, {"GetCurrentMap", GetCurrentMap},
{"GetEngineTime", GetEngineTime}, {"GetEngineTime", GetEngineTime},
{"GetGameDescription", GetGameDescription}, {"GetGameDescription", GetGameDescription},
{"GetGameFolderName", GetGameFolderName},
{"GetGameTime", GetGameTime}, {"GetGameTime", GetGameTime},
{"GetRandomFloat", GetRandomFloat}, {"GetRandomFloat", GetRandomFloat},
{"GetRandomInt", GetRandomInt}, {"GetRandomInt", GetRandomInt},

View File

@ -314,6 +314,16 @@ native Float:GetGameTime();
*/ */
native GetGameDescription(String:buffer[], maxlength, bool:original=false); native GetGameDescription(String:buffer[], maxlength, bool:original=false);
/**
* Returns the name of the game's directory.
*
* @param buffer Buffer to store the directory name.
* @param maxlength Maximum size of the buffer.
*
* return Number of bytes written to the buffer (UTF-8 safe).
*/
native GetGameFolderName(String:buffer[], maxlength);
/** /**
* Returns the current map name. * Returns the current map name.
* *