added request amb80 (system time)
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40601
This commit is contained in:
parent
d51ea0695f
commit
c2f106d4c6
@ -11,6 +11,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
|
|
||||||
@ -28,8 +29,20 @@ static cell_t ThrowError(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t GetTime(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
time_t t = time(NULL);
|
||||||
|
cell_t *addr;
|
||||||
|
pContext->LocalToPhysAddr(params[1], &addr);
|
||||||
|
|
||||||
|
*(time_t *)addr = t;
|
||||||
|
|
||||||
|
return static_cast<cell_t>(t);
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(coreNatives)
|
REGISTER_NATIVES(coreNatives)
|
||||||
{
|
{
|
||||||
|
{"GetTime", GetTime},
|
||||||
{"ThrowError", ThrowError},
|
{"ThrowError", ThrowError},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -146,6 +146,14 @@ native LogMessage(const String:format[], {Handle,Float,String,_}:...);
|
|||||||
*/
|
*/
|
||||||
native LogError(const String:format[], {Handle,Float,String,_}:...);
|
native LogError(const String:format[], {Handle,Float,String,_}:...);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the system time as a unix timestamp.
|
||||||
|
*
|
||||||
|
* @param bigStamp Optional array to store the 64bit timestamp in.
|
||||||
|
* @return 32bit timestamp (number of seconds since unix epoch).
|
||||||
|
*/
|
||||||
|
native GetTime(bigStamp[2]={0,0});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the seed value for the global Half-Life 2 Random Stream
|
* Sets the seed value for the global Half-Life 2 Random Stream
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user