- Added natives: PrintToChat() and PrintCenterText()
- Bit of reorganization with moving some natives from sourcemod.inc to halflife.inc --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40879
This commit is contained in:
parent
1ab452c897
commit
6c17b9f37b
@ -15,6 +15,7 @@
|
|||||||
#include "HalfLife2.h"
|
#include "HalfLife2.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
|
#include "UserMessages.h"
|
||||||
|
|
||||||
CHalfLife2 g_HL2;
|
CHalfLife2 g_HL2;
|
||||||
bool g_IsOriginalEngine = false;
|
bool g_IsOriginalEngine = false;
|
||||||
@ -81,6 +82,11 @@ void CHalfLife2::OnSourceModStartup(bool late)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::OnSourceModAllInitialized()
|
||||||
|
{
|
||||||
|
m_MsgTextMsg = g_UserMsgs.GetMessageIndex("TextMsg");
|
||||||
|
}
|
||||||
|
|
||||||
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||||
{
|
{
|
||||||
return engine->GetChangeAccessor( (const edict_t *)this );
|
return engine->GetChangeAccessor( (const edict_t *)this );
|
||||||
@ -236,3 +242,14 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
|||||||
pEdict->m_fStateFlags |= FL_EDICT_CHANGED;
|
pEdict->m_fStateFlags |= FL_EDICT_CHANGED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||||
|
{
|
||||||
|
bf_write *pBitBuf = NULL;
|
||||||
|
cell_t players[] = {client};
|
||||||
|
|
||||||
|
pBitBuf = g_UserMsgs.StartMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE);
|
||||||
|
pBitBuf->WriteByte(dest);
|
||||||
|
pBitBuf->WriteString(msg);
|
||||||
|
g_UserMsgs.EndMessage();
|
||||||
|
}
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
#include <sh_tinyhash.h>
|
#include <sh_tinyhash.h>
|
||||||
#include "sm_trie.h"
|
#include "sm_trie.h"
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "dt_send.h"
|
#include <dt_send.h>
|
||||||
#include "server_class.h"
|
#include <server_class.h>
|
||||||
#include "datamap.h"
|
#include <datamap.h>
|
||||||
#include "edict.h"
|
#include <edict.h>
|
||||||
|
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
|
|
||||||
@ -45,18 +45,21 @@ public:
|
|||||||
~CHalfLife2();
|
~CHalfLife2();
|
||||||
public:
|
public:
|
||||||
void OnSourceModStartup(bool late);
|
void OnSourceModStartup(bool late);
|
||||||
|
void OnSourceModAllInitialized();
|
||||||
/*void OnSourceModAllShutdown();*/
|
/*void OnSourceModAllShutdown();*/
|
||||||
public:
|
public:
|
||||||
SendProp *FindInSendTable(const char *classname, const char *offset);
|
SendProp *FindInSendTable(const char *classname, const char *offset);
|
||||||
ServerClass *FindServerClass(const char *classname);
|
ServerClass *FindServerClass(const char *classname);
|
||||||
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
|
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
|
||||||
void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
|
void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
|
||||||
|
void TextMsg(int client, int dest, const char *msg);
|
||||||
private:
|
private:
|
||||||
DataTableInfo *_FindServerClass(const char *classname);
|
DataTableInfo *_FindServerClass(const char *classname);
|
||||||
private:
|
private:
|
||||||
Trie *m_pClasses;
|
Trie *m_pClasses;
|
||||||
List<DataTableInfo *> m_Tables;
|
List<DataTableInfo *> m_Tables;
|
||||||
THash<datamap_t *, DataMapTrie> m_Maps;
|
THash<datamap_t *, DataMapTrie> m_Maps;
|
||||||
|
int m_MsgTextMsg;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CHalfLife2 g_HL2;
|
extern CHalfLife2 g_HL2;
|
||||||
|
@ -625,7 +625,7 @@ static cell_t sm_ClientCommand(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
g_SourceMod.FormatString(buffer, sizeof(buffer)-1, pContext, params, 2);
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
|
||||||
|
|
||||||
engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
|
engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "PlayerManager.h"
|
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
|
#include "PlayerManager.h"
|
||||||
|
#include "HalfLife2.h"
|
||||||
|
#include <shareddefs.h>
|
||||||
|
|
||||||
IServerPluginCallbacks *g_VSP = NULL;
|
IServerPluginCallbacks *g_VSP = NULL;
|
||||||
|
|
||||||
@ -244,7 +246,7 @@ static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
g_SourceMod.FormatString(buffer, sizeof(buffer)-1, pContext, params, 2);
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
|
||||||
|
|
||||||
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
|
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
|
||||||
|
|
||||||
@ -279,6 +281,52 @@ static cell_t smn_CreateDialog(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
int client = params[1];
|
||||||
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
|
|
||||||
|
if (!pPlayer)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Player %d is not a valid player", params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pPlayer->IsConnected())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Player %d is not connected", params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[256];
|
||||||
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
|
||||||
|
|
||||||
|
g_HL2.TextMsg(client, HUD_PRINTTALK, buffer);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t PrintCenterText(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
int client = params[1];
|
||||||
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
|
|
||||||
|
if (!pPlayer)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Player %d is not a valid player", params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pPlayer->IsConnected())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Player %d is not connected", params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[256];
|
||||||
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
|
||||||
|
|
||||||
|
g_HL2.TextMsg(client, HUD_PRINTCENTER, buffer);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static HalfLifeNatives s_HalfLifeNatives;
|
static HalfLifeNatives s_HalfLifeNatives;
|
||||||
|
|
||||||
REGISTER_NATIVES(halflifeNatives)
|
REGISTER_NATIVES(halflifeNatives)
|
||||||
@ -306,5 +354,7 @@ REGISTER_NATIVES(halflifeNatives)
|
|||||||
{"IsSoundPrecached", IsSoundPrecached},
|
{"IsSoundPrecached", IsSoundPrecached},
|
||||||
{"FakeClientCommand", FakeClientCommand},
|
{"FakeClientCommand", FakeClientCommand},
|
||||||
{"CreateDialog", smn_CreateDialog},
|
{"CreateDialog", smn_CreateDialog},
|
||||||
|
{"PrintToChat", PrintToChat},
|
||||||
|
{"PrintCenterText", PrintCenterText},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#define _datapack_included
|
#define _datapack_included
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new data pack.
|
* Creates a new data pack.
|
||||||
*
|
*
|
||||||
|
@ -452,4 +452,3 @@ native SQL_BindParamString(Handle:statement, param, const String:value[], bool:c
|
|||||||
* @error Invalid statement Handle.
|
* @error Invalid statement Handle.
|
||||||
*/
|
*/
|
||||||
native bool:SQL_Execute(Handle:statement);
|
native bool:SQL_Execute(Handle:statement);
|
||||||
|
|
||||||
|
231
plugins/include/halflife.inc
Normal file
231
plugins/include/halflife.inc
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* ===============================================================
|
||||||
|
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
||||||
|
* ===============================================================
|
||||||
|
*
|
||||||
|
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used
|
||||||
|
* or modified under the Terms and Conditions of its License Agreement, which is found
|
||||||
|
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
|
||||||
|
* may change at any time. To view the latest information, see:
|
||||||
|
* http://www.sourcemod.net/license.php
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined _halflife_included
|
||||||
|
#endinput
|
||||||
|
#endif
|
||||||
|
#define _halflife_included
|
||||||
|
|
||||||
|
enum DialogType
|
||||||
|
{
|
||||||
|
DialogType_Msg = 0, /**< just an on screen message */
|
||||||
|
DialogType_Menu, /**< an options menu */
|
||||||
|
DialogType_Text, /**< a richtext dialog */
|
||||||
|
DialogType_Entry /**< an entry box */
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs a generic message to the HL2 logs.
|
||||||
|
*
|
||||||
|
* @param format String format.
|
||||||
|
* @param ... Format arguments.
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
native LogToGame(const String:format[], any:...);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the seed value for the global Half-Life 2 Random Stream
|
||||||
|
*
|
||||||
|
* @param seed Seed value.
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
native SetRandomSeed(seed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a random floating point number from the Half-Life 2 Random Stream
|
||||||
|
*
|
||||||
|
* @param fMin Minimum random bound.
|
||||||
|
* @param fMax Maximum random bound.
|
||||||
|
* @return A random number between (inclusive) fMin and fMax.
|
||||||
|
*/
|
||||||
|
native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a random number from the Half-Life 2 Random Stream
|
||||||
|
*
|
||||||
|
* @param nmin Minimum random bound.
|
||||||
|
* @param nmax Maximum random bound.
|
||||||
|
* @return A random number between (inclusive) nmin and nmax.
|
||||||
|
*/
|
||||||
|
native GetRandomInt(nmin, nmax);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a map is valid or not.
|
||||||
|
*
|
||||||
|
* @param Map name, excluding .bsp extension.
|
||||||
|
* @return True if valid, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:IsMapValid(const String:map[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the server is dedicated.
|
||||||
|
*
|
||||||
|
* @return True if dedicated, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:IsDedicatedServer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a high-precision time value for profiling the engine.
|
||||||
|
*
|
||||||
|
* @return A floating point time value.
|
||||||
|
*/
|
||||||
|
native Float:GetEngineTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game time based on the game tick.
|
||||||
|
*
|
||||||
|
* @return Game tick time.
|
||||||
|
*/
|
||||||
|
native Float:GetGameTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game description from the mod.
|
||||||
|
*
|
||||||
|
* @param buffer Buffer to store the description.
|
||||||
|
* @param maxlength Maximum size of the buffer.
|
||||||
|
* @param original If true, retrieves the original game description,
|
||||||
|
* ignoring any potential hooks from plugins.
|
||||||
|
* @return Number of bytes written to the buffer (UTF-8 safe).
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* @param buffer Buffer to store map name.
|
||||||
|
* @param maxlength Maximum length of buffer.
|
||||||
|
* @return Number of bytes written (UTF-8 safe).
|
||||||
|
*/
|
||||||
|
native GetCurrentMap(String:buffer[], maxlength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Precaches a given model.
|
||||||
|
*
|
||||||
|
* @param model Name of the model to precache.
|
||||||
|
* @param preload If preload is true the file will be precached before level startup.
|
||||||
|
* @return Returns the model index, 0 for error.
|
||||||
|
*/
|
||||||
|
native PrecacheModel(const String:model[], bool:preload=false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Precaches a given sentence file.
|
||||||
|
*
|
||||||
|
* @param file Name of the sentence file to precache.
|
||||||
|
* @param preload If preload is true the file will be precached before level startup.
|
||||||
|
* @return Returns a sentence file index.
|
||||||
|
*/
|
||||||
|
native PrecacheSentenceFile(const String:file[], bool:preload=false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Precaches a given decal.
|
||||||
|
*
|
||||||
|
* @param decal Name of the decal to precache.
|
||||||
|
* @param preload If preload is true the file will be precached before level startup.
|
||||||
|
* @return Returns a decal index.
|
||||||
|
*/
|
||||||
|
native PrecacheDecal(const String:decal[], bool:preload=false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Precaches a given generic file.
|
||||||
|
*
|
||||||
|
* @param generic Name of the generic file to precache.
|
||||||
|
* @param preload If preload is true the file will be precached before level startup.
|
||||||
|
* @return Returns a generic file index.
|
||||||
|
*/
|
||||||
|
native PrecacheGeneric(const String:generic[], bool:preload=false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if a given model is precached.
|
||||||
|
*
|
||||||
|
* @param model Name of the model to check.
|
||||||
|
* @return True if precached, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:IsModelPrecached(const String:model[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if a given decal is precached.
|
||||||
|
*
|
||||||
|
* @param decal Name of the decal to check.
|
||||||
|
* @return True if precached, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:IsDecalPrecached(const String:decal[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if a given generic file is precached.
|
||||||
|
*
|
||||||
|
* @param decal Name of the generic file to check.
|
||||||
|
* @return True if precached, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:IsGenericPrecached(const String:generic[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Precaches a given sound.
|
||||||
|
*
|
||||||
|
* @param sound Name of the sound to precache.
|
||||||
|
* @param preload If preload is true the file will be precached before level startup.
|
||||||
|
* @return True if successfully precached, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:PrecacheSound(const String:sound[], bool:preload=false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if a given sound is precached.
|
||||||
|
*
|
||||||
|
* @param sound Name of the sound to check.
|
||||||
|
* @return True if precached, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool:IsSoundPrecached(const String:sound[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates different types of ingame messages.
|
||||||
|
*
|
||||||
|
* @param client Index of the client.
|
||||||
|
* @param kv KeyValues handle to set the menu keys and options. (Check iserverplugin.h for more information).
|
||||||
|
* @param type Message type to display ingame.
|
||||||
|
* @noreturn
|
||||||
|
* @error Invalid client index, or client not connected.
|
||||||
|
*/
|
||||||
|
native CreateDialog(client, Handle:kv, DialogType:type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints a message in a client's chat area.
|
||||||
|
*
|
||||||
|
* @param client Player index.
|
||||||
|
* @param format Formatting rules.
|
||||||
|
* @param ... Variable number of format parameters.
|
||||||
|
* @noreturn
|
||||||
|
* @error If the client is not connected an error will be thrown.
|
||||||
|
*/
|
||||||
|
native PrintToChat(client, const String:format[], any:...);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints a message in the center of a client's screen.
|
||||||
|
*
|
||||||
|
* @param client Player index.
|
||||||
|
* @param format Formatting rules.
|
||||||
|
* @param ... Variable number of format parameters.
|
||||||
|
* @noreturn
|
||||||
|
* @error If the client is not connected an error will be thrown.
|
||||||
|
*/
|
||||||
|
native PrintCenterText(client, const String:format[], any:...);
|
@ -32,27 +32,21 @@ struct Plugin
|
|||||||
|
|
||||||
#include <core>
|
#include <core>
|
||||||
#include <float>
|
#include <float>
|
||||||
#include <handles>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <admin>
|
#include <handles>
|
||||||
#include <files>
|
|
||||||
#include <console>
|
|
||||||
#include <bitbuffer>
|
|
||||||
#include <sorting>
|
|
||||||
#include <clients>
|
|
||||||
#include <usermessages>
|
|
||||||
#include <events>
|
|
||||||
#include <functions>
|
#include <functions>
|
||||||
|
#include <files>
|
||||||
#include <timers>
|
#include <timers>
|
||||||
|
#include <admin>
|
||||||
#include <dbi>
|
#include <dbi>
|
||||||
|
#include <sorting>
|
||||||
enum DialogType
|
#include <halflife>
|
||||||
{
|
#include <clients>
|
||||||
DialogType_Msg = 0, /**< just an on screen message */
|
#include <console>
|
||||||
DialogType_Menu, /**< an options menu */
|
#include <events>
|
||||||
DialogType_Text, /**< a richtext dialog */
|
#include <bitbuffer>
|
||||||
DialogType_Entry /**< an entry box */
|
#include <usermessages>
|
||||||
};
|
#include <menus>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare this as a struct in your plugin to expose its information.
|
* Declare this as a struct in your plugin to expose its information.
|
||||||
@ -236,15 +230,6 @@ native SetFailState(const String:string[]);
|
|||||||
*/
|
*/
|
||||||
native ThrowError(const String:fmt[], any:...);
|
native ThrowError(const String:fmt[], any:...);
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a generic message to the HL2 logs.
|
|
||||||
*
|
|
||||||
* @param format String format.
|
|
||||||
* @param ... Format arguments.
|
|
||||||
* @noreturn
|
|
||||||
*/
|
|
||||||
native LogToGame(const String:format[], any:...);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a plugin message to the SourceMod logs.
|
* Logs a plugin message to the SourceMod logs.
|
||||||
*
|
*
|
||||||
@ -271,179 +256,6 @@ native LogError(const String:format[], any:...);
|
|||||||
*/
|
*/
|
||||||
native GetTime(bigStamp[2]={0,0});
|
native GetTime(bigStamp[2]={0,0});
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the seed value for the global Half-Life 2 Random Stream
|
|
||||||
*
|
|
||||||
* @param seed Seed value.
|
|
||||||
* @noreturn
|
|
||||||
*/
|
|
||||||
native SetRandomSeed(seed);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a random floating point number from the Half-Life 2 Random Stream
|
|
||||||
*
|
|
||||||
* @param fMin Minimum random bound.
|
|
||||||
* @param fMax Maximum random bound.
|
|
||||||
* @return A random number between (inclusive) fMin and fMax.
|
|
||||||
*/
|
|
||||||
native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a random number from the Half-Life 2 Random Stream
|
|
||||||
*
|
|
||||||
* @param nmin Minimum random bound.
|
|
||||||
* @param nmax Maximum random bound.
|
|
||||||
* @return A random number between (inclusive) nmin and nmax.
|
|
||||||
*/
|
|
||||||
native GetRandomInt(nmin, nmax);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether a map is valid or not.
|
|
||||||
*
|
|
||||||
* @param Map name, excluding .bsp extension.
|
|
||||||
* @return True if valid, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool:IsMapValid(const String:map[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the server is dedicated.
|
|
||||||
*
|
|
||||||
* @return True if dedicated, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool:IsDedicatedServer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a high-precision time value for profiling the engine.
|
|
||||||
*
|
|
||||||
* @return A floating point time value.
|
|
||||||
*/
|
|
||||||
native Float:GetEngineTime();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the game time based on the game tick.
|
|
||||||
*
|
|
||||||
* @return Game tick time.
|
|
||||||
*/
|
|
||||||
native Float:GetGameTime();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the game description from the mod.
|
|
||||||
*
|
|
||||||
* @param buffer Buffer to store the description.
|
|
||||||
* @param maxlength Maximum size of the buffer.
|
|
||||||
* @param original If true, retrieves the original game description,
|
|
||||||
* ignoring any potential hooks from plugins.
|
|
||||||
* @return Number of bytes written to the buffer (UTF-8 safe).
|
|
||||||
*/
|
|
||||||
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.
|
|
||||||
*
|
|
||||||
* @param buffer Buffer to store map name.
|
|
||||||
* @param maxlength Maximum length of buffer.
|
|
||||||
* @return Number of bytes written (UTF-8 safe).
|
|
||||||
*/
|
|
||||||
native GetCurrentMap(String:buffer[], maxlength);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Precaches a given model.
|
|
||||||
*
|
|
||||||
* @param model Name of the model to precache.
|
|
||||||
* @param preload If preload is true the file will be precached before level startup.
|
|
||||||
* @return Returns the model index, 0 for error.
|
|
||||||
*/
|
|
||||||
native PrecacheModel(const String:model[], bool:preload=false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Precaches a given sentence file.
|
|
||||||
*
|
|
||||||
* @param file Name of the sentence file to precache.
|
|
||||||
* @param preload If preload is true the file will be precached before level startup.
|
|
||||||
* @return Returns a sentence file index.
|
|
||||||
*/
|
|
||||||
native PrecacheSentenceFile(const String:file[], bool:preload=false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Precaches a given decal.
|
|
||||||
*
|
|
||||||
* @param decal Name of the decal to precache.
|
|
||||||
* @param preload If preload is true the file will be precached before level startup.
|
|
||||||
* @return Returns a decal index.
|
|
||||||
*/
|
|
||||||
native PrecacheDecal(const String:decal[], bool:preload=false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Precaches a given generic file.
|
|
||||||
*
|
|
||||||
* @param generic Name of the generic file to precache.
|
|
||||||
* @param preload If preload is true the file will be precached before level startup.
|
|
||||||
* @return Returns a generic file index.
|
|
||||||
*/
|
|
||||||
native PrecacheGeneric(const String:generic[], bool:preload=false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if a given model is precached.
|
|
||||||
*
|
|
||||||
* @param model Name of the model to check.
|
|
||||||
* @return True if precached, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool:IsModelPrecached(const String:model[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if a given decal is precached.
|
|
||||||
*
|
|
||||||
* @param decal Name of the decal to check.
|
|
||||||
* @return True if precached, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool:IsDecalPrecached(const String:decal[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if a given generic file is precached.
|
|
||||||
*
|
|
||||||
* @param decal Name of the generic file to check.
|
|
||||||
* @return True if precached, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool:IsGenericPrecached(const String:generic[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Precaches a given sound.
|
|
||||||
*
|
|
||||||
* @param sound Name of the sound to precache.
|
|
||||||
* @param preload If preload is true the file will be precached before level startup.
|
|
||||||
* @return True if successfully precached, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool:PrecacheSound(const String:sound[], bool:preload=false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if a given sound is precached.
|
|
||||||
*
|
|
||||||
* @param sound Name of the sound to check.
|
|
||||||
* @return True if precached, false otherwise.
|
|
||||||
*/
|
|
||||||
native bool:IsSoundPrecached(const String:sound[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates different types of ingame messages.
|
|
||||||
*
|
|
||||||
* @param client Index of the client.
|
|
||||||
* @param kv KeyValues handle to set the menu keys and options. (Check iserverplugin.h for more information).
|
|
||||||
* @param type Message type to display ingame.
|
|
||||||
* @noreturn
|
|
||||||
* @error Invalid client index, or client not connected.
|
|
||||||
*/
|
|
||||||
native CreateDialog(client, Handle:kv, DialogType:type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a game config file.
|
* Loads a game config file.
|
||||||
*
|
*
|
||||||
@ -475,4 +287,3 @@ native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[],
|
|||||||
|
|
||||||
#include <helpers>
|
#include <helpers>
|
||||||
#include <entity>
|
#include <entity>
|
||||||
#include <menus>
|
|
Loading…
Reference in New Issue
Block a user