1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/plugins/include/halflife.inc Fri Jun 01 06:33:54 2007 +0000
1.3 @@ -0,0 +1,231 @@
1.4 +/**
1.5 + * vim: set ts=4 :
1.6 + * ===============================================================
1.7 + * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
1.8 + * ===============================================================
1.9 + *
1.10 + * This file is part of the SourceMod/SourcePawn SDK. This file may only be used
1.11 + * or modified under the Terms and Conditions of its License Agreement, which is found
1.12 + * in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
1.13 + * may change at any time. To view the latest information, see:
1.14 + * http://www.sourcemod.net/license.php
1.15 + *
1.16 + * Version: $Id$
1.17 + */
1.18 +
1.19 +#if defined _halflife_included
1.20 + #endinput
1.21 +#endif
1.22 +#define _halflife_included
1.23 +
1.24 +enum DialogType
1.25 +{
1.26 + DialogType_Msg = 0, /**< just an on screen message */
1.27 + DialogType_Menu, /**< an options menu */
1.28 + DialogType_Text, /**< a richtext dialog */
1.29 + DialogType_Entry /**< an entry box */
1.30 +};
1.31 +
1.32 +/**
1.33 + * Logs a generic message to the HL2 logs.
1.34 + *
1.35 + * @param format String format.
1.36 + * @param ... Format arguments.
1.37 + * @noreturn
1.38 + */
1.39 +native LogToGame(const String:format[], any:...);
1.40 +
1.41 +/**
1.42 + * Sets the seed value for the global Half-Life 2 Random Stream
1.43 + *
1.44 + * @param seed Seed value.
1.45 + * @noreturn
1.46 + */
1.47 +native SetRandomSeed(seed);
1.48 +
1.49 +/**
1.50 + * Returns a random floating point number from the Half-Life 2 Random Stream
1.51 + *
1.52 + * @param fMin Minimum random bound.
1.53 + * @param fMax Maximum random bound.
1.54 + * @return A random number between (inclusive) fMin and fMax.
1.55 + */
1.56 +native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0);
1.57 +
1.58 +/**
1.59 + * Returns a random number from the Half-Life 2 Random Stream
1.60 + *
1.61 + * @param nmin Minimum random bound.
1.62 + * @param nmax Maximum random bound.
1.63 + * @return A random number between (inclusive) nmin and nmax.
1.64 + */
1.65 +native GetRandomInt(nmin, nmax);
1.66 +
1.67 +/**
1.68 + * Returns whether a map is valid or not.
1.69 + *
1.70 + * @param Map name, excluding .bsp extension.
1.71 + * @return True if valid, false otherwise.
1.72 + */
1.73 +native bool:IsMapValid(const String:map[]);
1.74 +
1.75 +/**
1.76 + * Returns whether the server is dedicated.
1.77 + *
1.78 + * @return True if dedicated, false otherwise.
1.79 + */
1.80 +native bool:IsDedicatedServer();
1.81 +
1.82 +/**
1.83 + * Returns a high-precision time value for profiling the engine.
1.84 + *
1.85 + * @return A floating point time value.
1.86 + */
1.87 +native Float:GetEngineTime();
1.88 +
1.89 +/**
1.90 + * Returns the game time based on the game tick.
1.91 + *
1.92 + * @return Game tick time.
1.93 + */
1.94 +native Float:GetGameTime();
1.95 +
1.96 +/**
1.97 + * Returns the game description from the mod.
1.98 + *
1.99 + * @param buffer Buffer to store the description.
1.100 + * @param maxlength Maximum size of the buffer.
1.101 + * @param original If true, retrieves the original game description,
1.102 + * ignoring any potential hooks from plugins.
1.103 + * @return Number of bytes written to the buffer (UTF-8 safe).
1.104 + */
1.105 +native GetGameDescription(String:buffer[], maxlength, bool:original=false);
1.106 +
1.107 +/**
1.108 + * Returns the name of the game's directory.
1.109 + *
1.110 + * @param buffer Buffer to store the directory name.
1.111 + * @param maxlength Maximum size of the buffer.
1.112 + *
1.113 + * return Number of bytes written to the buffer (UTF-8 safe).
1.114 + */
1.115 +native GetGameFolderName(String:buffer[], maxlength);
1.116 +
1.117 +/**
1.118 + * Returns the current map name.
1.119 + *
1.120 + * @param buffer Buffer to store map name.
1.121 + * @param maxlength Maximum length of buffer.
1.122 + * @return Number of bytes written (UTF-8 safe).
1.123 + */
1.124 +native GetCurrentMap(String:buffer[], maxlength);
1.125 +
1.126 +/**
1.127 + * Precaches a given model.
1.128 + *
1.129 + * @param model Name of the model to precache.
1.130 + * @param preload If preload is true the file will be precached before level startup.
1.131 + * @return Returns the model index, 0 for error.
1.132 + */
1.133 +native PrecacheModel(const String:model[], bool:preload=false);
1.134 +
1.135 +/**
1.136 + * Precaches a given sentence file.
1.137 + *
1.138 + * @param file Name of the sentence file to precache.
1.139 + * @param preload If preload is true the file will be precached before level startup.
1.140 + * @return Returns a sentence file index.
1.141 + */
1.142 +native PrecacheSentenceFile(const String:file[], bool:preload=false);
1.143 +
1.144 +/**
1.145 + * Precaches a given decal.
1.146 + *
1.147 + * @param decal Name of the decal to precache.
1.148 + * @param preload If preload is true the file will be precached before level startup.
1.149 + * @return Returns a decal index.
1.150 + */
1.151 +native PrecacheDecal(const String:decal[], bool:preload=false);
1.152 +
1.153 +/**
1.154 + * Precaches a given generic file.
1.155 + *
1.156 + * @param generic Name of the generic file to precache.
1.157 + * @param preload If preload is true the file will be precached before level startup.
1.158 + * @return Returns a generic file index.
1.159 + */
1.160 +native PrecacheGeneric(const String:generic[], bool:preload=false);
1.161 +
1.162 +/**
1.163 + * Returns if a given model is precached.
1.164 + *
1.165 + * @param model Name of the model to check.
1.166 + * @return True if precached, false otherwise.
1.167 + */
1.168 +native bool:IsModelPrecached(const String:model[]);
1.169 +
1.170 +/**
1.171 + * Returns if a given decal is precached.
1.172 + *
1.173 + * @param decal Name of the decal to check.
1.174 + * @return True if precached, false otherwise.
1.175 + */
1.176 +native bool:IsDecalPrecached(const String:decal[]);
1.177 +
1.178 +/**
1.179 + * Returns if a given generic file is precached.
1.180 + *
1.181 + * @param decal Name of the generic file to check.
1.182 + * @return True if precached, false otherwise.
1.183 + */
1.184 +native bool:IsGenericPrecached(const String:generic[]);
1.185 +
1.186 +/**
1.187 + * Precaches a given sound.
1.188 + *
1.189 + * @param sound Name of the sound to precache.
1.190 + * @param preload If preload is true the file will be precached before level startup.
1.191 + * @return True if successfully precached, false otherwise.
1.192 + */
1.193 +native bool:PrecacheSound(const String:sound[], bool:preload=false);
1.194 +
1.195 +/**
1.196 + * Returns if a given sound is precached.
1.197 + *
1.198 + * @param sound Name of the sound to check.
1.199 + * @return True if precached, false otherwise.
1.200 + */
1.201 +native bool:IsSoundPrecached(const String:sound[]);
1.202 +
1.203 +/**
1.204 + * Creates different types of ingame messages.
1.205 + *
1.206 + * @param client Index of the client.
1.207 + * @param kv KeyValues handle to set the menu keys and options. (Check iserverplugin.h for more information).
1.208 + * @param type Message type to display ingame.
1.209 + * @noreturn
1.210 + * @error Invalid client index, or client not connected.
1.211 + */
1.212 +native CreateDialog(client, Handle:kv, DialogType:type);
1.213 +
1.214 +/**
1.215 + * Prints a message in a client's chat area.
1.216 + *
1.217 + * @param client Player index.
1.218 + * @param format Formatting rules.
1.219 + * @param ... Variable number of format parameters.
1.220 + * @noreturn
1.221 + * @error If the client is not connected an error will be thrown.
1.222 + */
1.223 +native PrintToChat(client, const String:format[], any:...);
1.224 +
1.225 +/**
1.226 + * Prints a message in the center of a client's screen.
1.227 + *
1.228 + * @param client Player index.
1.229 + * @param format Formatting rules.
1.230 + * @param ... Variable number of format parameters.
1.231 + * @noreturn
1.232 + * @error If the client is not connected an error will be thrown.
1.233 + */
1.234 +native PrintCenterText(client, const String:format[], any:...);