init, taken from ardestani since old gitea instance was purged without saving branch
This commit is contained in:
@@ -0,0 +1,208 @@
|
||||
2.01
|
||||
*Added Top 15 Pro/Noob (With and without Checkpoints* -> Later added GoChecks count)
|
||||
*Added milliseconds function (end message and top15 in format: mm:ss.msms - 01:23.45)
|
||||
*Fixed bug in top15 that saves you every time you finish a map (and is top15 entry). You can now go only if you beat your old time
|
||||
*Changed the semi-clip and fixed the teleport-stuck-into-other-player-bug :D
|
||||
|
||||
2.02
|
||||
*Added GoChecks count
|
||||
*Added HUD/Chat messages (for CP/TP/start etc.) kz_chatorhud 0/1/2 (No messages/Chat messages/HUD messages)
|
||||
|
||||
2.03
|
||||
*Added ColorChat functions (Green and Team Color for most of messages) - If kz_chatorhud is 1
|
||||
*Added HUD color CVar for HUD Messages (Structure kz_hud_color "green red blue" values 1-255 ) - If kz_chatorhud is 2
|
||||
|
||||
2.04
|
||||
*Added Spec/CT function and respawn if you die
|
||||
*Added Kz Menu (wth CP/TP/Top15/Invis/Spec-CT and Reset timer functions) CVar: kz_spawn_mainmenu 0/1, Command: /men
|
||||
|
||||
2.05
|
||||
*Added /start command and auto-start creator when pressing start button (if the start location doesn't exist)
|
||||
*Fixed the start bug (doesn't start unless you aim the timer before pressing it)
|
||||
|
||||
2.06
|
||||
*Added /weapons (and fixed possible bugs for climbing time)
|
||||
*Added CVar kz_show_timer 0/1 - to show kz timer in HUD message (format mm:ss)
|
||||
|
||||
2.07
|
||||
*Removed some not necessarily codes
|
||||
2.08
|
||||
*Added hook as prize and CVar kz_hook_prize 0/1
|
||||
*Added possibility to drop weapons. CVar kz_drop_weapons 0/1
|
||||
|
||||
2.09
|
||||
*Included hook into the plugin (no longer needed prokreedz_hook)
|
||||
*Fixed kz_hook_prize
|
||||
*Fixed reset time if you use hook
|
||||
*Changed hook colors
|
||||
*Fixed finish messages (sometimes it didn't show new place)
|
||||
*Trying /setstart and /delstart
|
||||
*Deleted NightVision to avoid "You already have one message"
|
||||
*Added /start function and Checkpoints+GoChecks count on Kz-Menu
|
||||
|
||||
2.10 - 14.04.2010 (N/A)
|
||||
*Fixed /setstart and /delstart
|
||||
|
||||
2.11 - 16.04.2010 (37)
|
||||
*Fixed some codes
|
||||
*Added CVar kz_use_radio
|
||||
*Added CVar kz_hud_coords <x y> to change the coordinates of the HUD Messages
|
||||
*You cannot spam anymore "Spec/CT" function in KZ-Menu to avoid a bug
|
||||
*Removed kz_hud_coords because of breaking all HUD Messages. For a foreign reason i cannot have both integral and float variables in same function in AMXX :o
|
||||
|
||||
2.12 - 24.04.2010 (35)
|
||||
*Added /scout command
|
||||
*Added NightVision + CVars kz_nvg <0/1> and
|
||||
kz_nvg_colors <r g b>
|
||||
*Fixed some codes - Thanks to SchlumPF
|
||||
2.13 - 01.05.2010 (85)
|
||||
*Changed delay_duck function
|
||||
*Removed admin_gravty and admin_teleport
|
||||
|
||||
*Added Pause function. Cvars: kz_pause <0/1>. Command: /pause.
|
||||
2.14 - 23.05.2010 (68)
|
||||
*Added /showkeys command. CVar: kz_showkeys <0/1>
|
||||
*Added VIP in scoreboard for admins (ADMIN_KICK, like for hook). CVar: kz_vip <0/1>
|
||||
*Removed admin_laser
|
||||
*Added Water Invis
|
||||
*Added Invis Menu (/invis) and /pinvis (for manually player invis) / /winvis (for manually water invis)
|
||||
*Fixed the spam bug with hook while being dead
|
||||
|
||||
2.15 - 05.06.2010 (30)
|
||||
*Changed the block commands function
|
||||
*Players (not admins) can now use noclip. If kz_cheatdetect is 1 the timer resets. It disappears automatically if you start a new run.
|
||||
*Players don't lose hook anymore when they start a new run (if they already got one by finishing the map), but the timer resets if kz_cheatdetect is set to 1
|
||||
*Added /usp command which gives you usp/knife, but you will still be added in Noob top for using scout
|
||||
*Removed /help command (going to add a menu for newbies with MOTDs)
|
||||
2.16 - 11.06.2010 (34)
|
||||
|
||||
*Added auto remove weapon if it's dropped (to avoid cheats or abuses). CVar: kz_remove_drops <0/1>
|
||||
*Fixed top15 (codes from kz-arg)
|
||||
*Added /knife (same as /usp)
|
||||
*Added CVar kz_semiclip, to enable or not the semiclip
|
||||
*Note: Please move your start folder into /kz/start
|
||||
2.17 - 19.06.2010 (21)
|
||||
|
||||
*Added player command "/timer" for kz_show_timer "1", to see or not the HUD timer
|
||||
*Added commands /demo or /legal, for plugin to be safe for recording and /public or /reload for executing kreedz.cfg
|
||||
*Added auto-heal if the map has healer
|
||||
*Auto creates folders for addons/kz, addons/kz/start and addons/kz/top15 for the plugin to work corectly
|
||||
*Changed start and finish detection (used xj_timer code)
|
||||
*Changed Checkpoints system
|
||||
2.18 - 22.06.2010 (106)
|
||||
|
||||
*Changed HUD timer and added CPs / GCs near timer for kz_show_timer "1"
|
||||
*Added Show Timer (/timer command) and Pause into Main Menu
|
||||
*Changed pyramidal codes :D
|
||||
*Changed the Night-Vision
|
||||
*Fixed block buys
|
||||
*Added stats of the player you are spectating(Name,Time, CPs, GCs), you can turn it off by command /timer
|
||||
*Fixed Noob 15 update and Top15 design (lifted up as default becuase it doesn't support so many values)
|
||||
|
||||
2.19 - 16.07.2010 (246)
|
||||
*Removed some unnecesarly codes (AdminGlow and some other stuff)
|
||||
*Fixed showkeys
|
||||
*Fixed semiclip
|
||||
*Added CVar kz_respawn_ct, to either respawn or not CTs
|
||||
*Changed switch to spec function: Saves the spot you go to spec and moves you there when you go back to CT. Saves your Time if it's started and you go spec. CVar: kz_spec_saves 0/1
|
||||
2.20 - 03.08.2010 (305)
|
||||
|
||||
*Fixed Top15 for a better work because it couldn't handle all #15 places sometimes
|
||||
*Fixed a Spec-Pause bug
|
||||
*Fixed a bug with Timer show on Spectator
|
||||
*Fixed a bug that you couldn't spectate players while having invis turned on
|
||||
*Deleted HP show when targeting a player to fix a HP Bug show for 50,000 HP
|
||||
*Removed ShowKeys, SpecInfo plugin can handle it
|
||||
|
||||
2.21 - 19.08.2010 (330)
|
||||
*You cannot pick up weapons when the timer is started
|
||||
*Fixed a bug with spectating
|
||||
*Changed the detection of starting weapons. Added CVar: kz_strip_other_weapons to strip or not other weapons (Top 15 is updated only for usp/knife and scout)
|
||||
*Added Custom start points and fix bug with duck stuck. CVar: kz_save_autostart
|
||||
*Removed Cstrike and Fun modules
|
||||
*Fixed/Improved a couple of codes
|
||||
|
||||
2.22 - 09.09.2010 (199)
|
||||
*Added command /respawn that works like start and changed a little the start function (if there is not start position it respawns you)
|
||||
*Added a message when you target a player like VIP if the targeted player is admin or Player if it's not
|
||||
*Fixed a bug with pause
|
||||
*Fixed a bug with godmode
|
||||
*Fixed a Spec bug (Re-added Cstrike moule)
|
||||
*Fixed a bug with Hook
|
||||
|
||||
2.23 - 24.09.2010 (390)
|
||||
*Changed setstart function to save all positions into only one file
|
||||
*Fixed the bug that didn't show the ljstats on spectator mode
|
||||
*Fixed hook and start exploit. Added CVar: kz_hook_speed (300 default)
|
||||
*Removed Amxmisc, Engine
|
||||
|
||||
2.24 - 13.10.2010 (808)
|
||||
*Added Timer Show into Round Time (see /timer)
|
||||
*Added kz_reload_weapons 0/1 , to reload the weapons when starting timer (like Kz-Arg)
|
||||
*Changed /timer command, created a menu for Show Timer methods
|
||||
*Added CVar kz_showtime_start - to set the normal showtime method ( 0 - Disabled , 1- HUD, 2-RoundTime). You can change it ingame by command /timer.
|
||||
*Deleted /demo and /pub commands (created a new plugin for it - prokreedz_demo)
|
||||
|
||||
2.25 - 01.12.2010 (536)
|
||||
*No steam users won't get to top anymore
|
||||
*Changed top15 for top10 (to fix MOTD bugs... use SQL version for working top15)
|
||||
*Optimized the plugin
|
||||
*prokreedz_name is no longer needed, Steam ID is better. You can use the steam id version for non-steam clients, you will just not get into top
|
||||
|
||||
2.26c - 15.01.2011 (1048)
|
||||
*Added Cvar kz_pick_weapons 0 - default for public servers; 1 - default for recording demos
|
||||
*Added command /god for godmode (resets your time if you use it)
|
||||
*Readded failed/improved times messages for non SQL version
|
||||
*Deleted cvar kz_showtimer_start, use kz_show_timer instead. 0 - for disabling , 1 - for HUd , 2 - for roduntimer. This is only for default, players can modify it by /timer command.
|
||||
*Optimized the plugin a little
|
||||
*Added CVar kz_top15_authid 0/1 - 0 for Top sort by names (used mostly for non-steam servers), 1 for sorting by authid (aka steam id)
|
||||
|
||||
2.27 - 18.07.2011 (3411)
|
||||
*Changed a little the finish message
|
||||
*Fixed little CP/TP bug
|
||||
|
||||
2.28 - 16.04.2012 (149)
|
||||
*Fixed Connor's requests. Plugin should be more optimal now.
|
||||
*Fixed other little tweaks and did minor changes.
|
||||
*Added /savepos command (check above at players commands)
|
||||
|
||||
2.29 - 22.04.2012 (74)
|
||||
*CPs can be done on ladders
|
||||
*Added CVar kz_semiclip_transparency <0-255> - The amount of transparency between players when kz_semiclip is 1
|
||||
*Added CVar kz_chat_prefix <message> - Default it's [KZ]
|
||||
*Changed the way I register commands. All commands now work with say(_team) /command, say(_team) .command
|
||||
*Fixed a top15 bug (used to show wrong values at 'improved your time by:' and 'slower than your time by:' messages). Added scout check in Noob 15.
|
||||
*Fixed pause & savepos bugs as well as other combinations between functions
|
||||
*Scout is not longer removed if you hold it when you start the timer also fixed some scout bugs
|
||||
*Added Multi Language. All translations are welcome!
|
||||
**SQL version is now in the same plugin with the motd version. To use SQL remove the "//" from "//#define USE_SQL" (in the source of the plugin)
|
||||
|
||||
2.30 - 27.04.2012 (164)
|
||||
*Added /guns (same as /weapons) due to request
|
||||
*Fixed some ML stuff ( I couldn't do it the usual way because I had to overcomplicate it, so I tried an easier approach)
|
||||
*Fixed a Save Pos bug
|
||||
*Fixed a message bug
|
||||
*Fixed some weapons bugs
|
||||
*Pause now work while in air, as well
|
||||
*/scout command now works even if timer is not started
|
||||
|
||||
2.31 - 12.05.2012 (??)
|
||||
*Added command /chatorhud. Players will now be able to switch between showing messages on chat, on hud, or not show them at all. At spawn, they will be decided by CVar.
|
||||
*Fixed problems with pause and godmode/noclip
|
||||
*Fixed a problem with not going to pro15 even if you use usp/knife
|
||||
*Changed noclip function when paused: Your timer will not reset if you are paused, so you can fly around, but when you type again /noclip you will be teleported to where you paused. (Useful if you don't know the map and you want to look around for next jump, but you don't want to lose your current timer). CVar kz_noclip_paused 0/1
|
||||
*Added CVar kz_save_pos_gochecks <0/1> - Whether or not to add +1 Gochecks after reloading old run. Default 1 (no Pro 15 even if you had 0 GCs when you saved)
|
||||
*Now you get scout back if you used it in the previous run (so there are no bugs with pro15 and scout if kz_save_pos_gochecks is 0)
|
||||
|
||||
|
||||
[SQL]
|
||||
*Fixed the PHP files a little
|
||||
*Fixed bugs with server crash, bad saving the time or not saving at all
|
||||
*Fixed some messages and fixed the PHP files completly
|
||||
*Readded flags for countries and fixed a bug with them
|
||||
*Changed the Top saving to be saved with just 2 decimals
|
||||
*Redesigned the PHP files
|
||||
*Fixed the bug that was saving CPs as GCs and GCs as CPs (in DB). Command for SQL vesrion is /prorecords (in chat)
|
||||
*Added Pro Records reading into PHP files.
|
||||
*Added in /top15 menu for SQL vesrion Players Rankings and Maps statistic option
|
||||
*Added a function that updates your name in all the records you have with the one you join at the moment.
|
||||
@@ -0,0 +1,866 @@
|
||||
/* AMX Mod X script.
|
||||
* Admin Base Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
// Uncomment for SQL version
|
||||
// #define USING_SQL
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
#if defined USING_SQL
|
||||
#include <sqlx>
|
||||
#endif
|
||||
|
||||
//new Vector:AdminList;
|
||||
|
||||
new AdminCount;
|
||||
|
||||
new PLUGINNAME[] = "AMX Mod X"
|
||||
|
||||
#define ADMIN_LOOKUP (1<<0)
|
||||
#define ADMIN_NORMAL (1<<1)
|
||||
#define ADMIN_STEAM (1<<2)
|
||||
#define ADMIN_IPADDR (1<<3)
|
||||
#define ADMIN_NAME (1<<4)
|
||||
|
||||
new g_cmdLoopback[16]
|
||||
new bool:g_CaseSensitiveName[33];
|
||||
|
||||
// pcvars
|
||||
new amx_mode;
|
||||
new amx_password_field;
|
||||
new amx_default_access;
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
#if defined USING_SQL
|
||||
register_plugin("Admin Base (SQL)", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
#else
|
||||
register_plugin("Admin Base", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
#endif
|
||||
register_dictionary("admin.txt")
|
||||
register_dictionary("common.txt")
|
||||
amx_mode=register_cvar("amx_mode", "1")
|
||||
amx_password_field=register_cvar("amx_password_field", "_pw")
|
||||
amx_default_access=register_cvar("amx_default_access", "")
|
||||
|
||||
register_cvar("amx_vote_ratio", "0.02")
|
||||
register_cvar("amx_vote_time", "10")
|
||||
register_cvar("amx_vote_answers", "1")
|
||||
register_cvar("amx_vote_delay", "60")
|
||||
register_cvar("amx_last_voting", "0")
|
||||
register_cvar("amx_show_activity", "2")
|
||||
register_cvar("amx_votekick_ratio", "0.40")
|
||||
register_cvar("amx_voteban_ratio", "0.40")
|
||||
register_cvar("amx_votemap_ratio", "0.40")
|
||||
|
||||
set_cvar_float("amx_last_voting", 0.0)
|
||||
|
||||
#if defined USING_SQL
|
||||
register_srvcmd("amx_sqladmins", "adminSql")
|
||||
register_cvar("amx_sql_table", "admins")
|
||||
#endif
|
||||
register_cvar("amx_sql_host", "127.0.0.1")
|
||||
register_cvar("amx_sql_user", "root")
|
||||
register_cvar("amx_sql_pass", "")
|
||||
register_cvar("amx_sql_db", "amx")
|
||||
register_cvar("amx_sql_type", "mysql")
|
||||
|
||||
register_concmd("amx_reloadadmins", "cmdReload", ADMIN_CFG)
|
||||
register_concmd("amx_addadmin", "addadminfn", ADMIN_RCON, "<playername|auth> <accessflags> [password] [authtype] - add specified player as an admin to users.ini")
|
||||
|
||||
format(g_cmdLoopback, 15, "amxauth%c%c%c%c", random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'))
|
||||
|
||||
register_clcmd(g_cmdLoopback, "ackSignal")
|
||||
|
||||
remove_user_flags(0, read_flags("z")) // Remove 'user' flag from server rights
|
||||
|
||||
new configsDir[64]
|
||||
get_configsdir(configsDir, 63)
|
||||
|
||||
server_cmd("exec %s/amxx.cfg", configsDir) // Execute main configuration file
|
||||
server_cmd("exec %s/sql.cfg", configsDir)
|
||||
|
||||
// Create a vector of 5 cells to store the info.
|
||||
//AdminList=vector_create(5);
|
||||
|
||||
|
||||
#if defined USING_SQL
|
||||
server_cmd("amx_sqladmins")
|
||||
#else
|
||||
format(configsDir, 63, "%s/users.ini", configsDir)
|
||||
loadSettings(configsDir) // Load admins accounts
|
||||
#endif
|
||||
}
|
||||
public client_connect(id)
|
||||
{
|
||||
g_CaseSensitiveName[id] = false;
|
||||
}
|
||||
public addadminfn(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 3))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new idtype = ADMIN_STEAM | ADMIN_LOOKUP
|
||||
|
||||
if (read_argc() >= 5)
|
||||
{
|
||||
new t_arg[16]
|
||||
read_argv(4, t_arg, 15)
|
||||
|
||||
if (equali(t_arg, "steam") || equali(t_arg, "steamid") || equali(t_arg, "auth"))
|
||||
{
|
||||
idtype = ADMIN_STEAM
|
||||
}
|
||||
else if (equali(t_arg, "ip"))
|
||||
{
|
||||
idtype = ADMIN_IPADDR
|
||||
}
|
||||
else if (equali(t_arg, "name") || equali(t_arg, "nick"))
|
||||
{
|
||||
idtype = ADMIN_NAME
|
||||
|
||||
if (equali(t_arg, "name"))
|
||||
idtype |= ADMIN_LOOKUP
|
||||
} else {
|
||||
console_print(id, "[%s] Unknown id type ^"%s^", use one of: steamid, ip, name", PLUGINNAME, t_arg)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
}
|
||||
|
||||
new arg[33]
|
||||
read_argv(1, arg, 32)
|
||||
new player = -1
|
||||
|
||||
if (idtype & ADMIN_STEAM)
|
||||
{
|
||||
if (containi(arg, "STEAM_0:") == -1)
|
||||
{
|
||||
idtype |= ADMIN_LOOKUP
|
||||
player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS)
|
||||
} else {
|
||||
new _steamid[44]
|
||||
static _players[32], _num, _pv
|
||||
get_players(_players, _num)
|
||||
for (new _i=0; _i<_num; _i++)
|
||||
{
|
||||
_pv = _players[_i]
|
||||
get_user_authid(_pv, _steamid, sizeof(_steamid)-1)
|
||||
if (!_steamid[0])
|
||||
continue
|
||||
if (equal(_steamid, arg))
|
||||
{
|
||||
player = _pv
|
||||
break
|
||||
}
|
||||
}
|
||||
if (player < 1)
|
||||
{
|
||||
idtype &= ~ADMIN_LOOKUP
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (idtype & ADMIN_NAME)
|
||||
{
|
||||
player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS)
|
||||
|
||||
if (player)
|
||||
idtype |= ADMIN_LOOKUP
|
||||
else
|
||||
idtype &= ~ADMIN_LOOKUP
|
||||
}
|
||||
else if (idtype & ADMIN_IPADDR)
|
||||
{
|
||||
new len = strlen(arg)
|
||||
new dots, chars
|
||||
|
||||
for (new i = 0; i < len; i++)
|
||||
{
|
||||
if (arg[i] == '.')
|
||||
{
|
||||
if (!chars || chars > 3)
|
||||
break
|
||||
|
||||
if (++dots > 3)
|
||||
break
|
||||
|
||||
chars = 0
|
||||
} else {
|
||||
chars++
|
||||
}
|
||||
|
||||
if (dots != 3 || !chars || chars > 3)
|
||||
{
|
||||
idtype |= ADMIN_LOOKUP
|
||||
player = find_player("dh", arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (idtype & ADMIN_LOOKUP && !player)
|
||||
{
|
||||
console_print(id, "%L", id, "CL_NOT_FOUND")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new flags[64]
|
||||
read_argv(2, flags, 63)
|
||||
|
||||
new password[64]
|
||||
if (read_argc() >= 4)
|
||||
read_argv(3, password, 63)
|
||||
|
||||
new auth[33]
|
||||
new Comment[33]; // name of player to pass to comment field
|
||||
if (idtype & ADMIN_LOOKUP)
|
||||
{
|
||||
get_user_name(player, Comment, sizeof(Comment)-1)
|
||||
if (idtype & ADMIN_STEAM)
|
||||
{
|
||||
get_user_authid(player, auth, 32)
|
||||
}
|
||||
else if (idtype & ADMIN_IPADDR)
|
||||
{
|
||||
get_user_ip(player, auth, 32)
|
||||
}
|
||||
else if (idtype & ADMIN_NAME)
|
||||
{
|
||||
get_user_name(player, auth, 32)
|
||||
}
|
||||
} else {
|
||||
copy(auth, 32, arg)
|
||||
}
|
||||
|
||||
new type[16], len
|
||||
|
||||
if (idtype & ADMIN_STEAM)
|
||||
len += format(type[len], 15-len, "c")
|
||||
else if (idtype & ADMIN_IPADDR)
|
||||
len += format(type[len], 15-len, "d")
|
||||
|
||||
if (strlen(password) > 0)
|
||||
len += format(type[len], 15-len, "a")
|
||||
else
|
||||
len += format(type[len], 15-len, "e")
|
||||
|
||||
AddAdmin(id, auth, flags, password, type, Comment)
|
||||
cmdReload(id, ADMIN_CFG, 0)
|
||||
|
||||
if (player > 0)
|
||||
{
|
||||
new name[32]
|
||||
get_user_info(player, "name", name, 31)
|
||||
accessUser(player, name)
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
AddAdmin(id, auth[], accessflags[], password[], flags[], comment[]="")
|
||||
{
|
||||
#if defined USING_SQL
|
||||
new error[128], errno
|
||||
|
||||
new Handle:info = SQL_MakeStdTuple()
|
||||
new Handle:sql = SQL_Connect(info, errno, error, 127)
|
||||
|
||||
if (sql == Empty_Handle)
|
||||
{
|
||||
server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error)
|
||||
//backup to users.ini
|
||||
#endif
|
||||
// Make sure that the users.ini file exists.
|
||||
new configsDir[64]
|
||||
get_configsdir(configsDir, 63)
|
||||
format(configsDir, 63, "%s/users.ini", configsDir)
|
||||
|
||||
if (!file_exists(configsDir))
|
||||
{
|
||||
console_print(id, "[%s] File ^"%s^" doesn't exist.", PLUGINNAME, configsDir)
|
||||
return
|
||||
}
|
||||
|
||||
// Make sure steamid isn't already in file.
|
||||
new line = 0, textline[256], len
|
||||
const SIZE = 63
|
||||
new line_steamid[SIZE + 1], line_password[SIZE + 1], line_accessflags[SIZE + 1], line_flags[SIZE + 1], parsedParams
|
||||
|
||||
// <name|ip|steamid> <password> <access flags> <account flags>
|
||||
while ((line = read_file(configsDir, line, textline, 255, len)))
|
||||
{
|
||||
if (len == 0 || equal(textline, ";", 1))
|
||||
continue // comment line
|
||||
|
||||
parsedParams = parse(textline, line_steamid, SIZE, line_password, SIZE, line_accessflags, SIZE, line_flags, SIZE)
|
||||
|
||||
if (parsedParams != 4)
|
||||
continue // Send warning/error?
|
||||
|
||||
if (containi(line_flags, flags) != -1 && equal(line_steamid, auth))
|
||||
{
|
||||
console_print(id, "[%s] %s already exists!", PLUGINNAME, auth)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// If we came here, steamid doesn't exist in users.ini. Add it.
|
||||
new linetoadd[512]
|
||||
|
||||
if (comment[0]==0)
|
||||
{
|
||||
formatex(linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, password, accessflags, flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
formatex(linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ; %s", auth, password, accessflags, flags, comment)
|
||||
}
|
||||
console_print(id, "Adding:^n%s", linetoadd)
|
||||
|
||||
if (!write_file(configsDir, linetoadd))
|
||||
console_print(id, "[%s] Failed writing to %s!", PLUGINNAME, configsDir)
|
||||
#if defined USING_SQL
|
||||
}
|
||||
|
||||
new table[32]
|
||||
|
||||
get_cvar_string("amx_sql_table", table, 31)
|
||||
|
||||
new Handle:query = SQL_PrepareQuery(sql, "SELECT * FROM `%s` WHERE (`auth` = '%s')", table, auth)
|
||||
|
||||
if (!SQL_Execute(query))
|
||||
{
|
||||
SQL_QueryError(query, error, 127)
|
||||
server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
|
||||
console_print(id, "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
|
||||
} else if (SQL_NumResults(query)) {
|
||||
console_print(id, "[%s] %s already exists!", PLUGINNAME, auth)
|
||||
} else {
|
||||
console_print(id, "Adding to database:^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, password, accessflags, flags)
|
||||
|
||||
SQL_QueryAndIgnore(sql, "REPLACE INTO `%s` (`auth`, `password`, `access`, `flags`) VALUES ('%s', '%s', '%s', '%s')", table, auth, password, accessflags, flags)
|
||||
}
|
||||
|
||||
SQL_FreeHandle(query)
|
||||
SQL_FreeHandle(sql)
|
||||
SQL_FreeHandle(info)
|
||||
#endif
|
||||
|
||||
}
|
||||
public plugin_cfg()
|
||||
{
|
||||
set_task(6.1, "delayed_load")
|
||||
}
|
||||
|
||||
public delayed_load()
|
||||
{
|
||||
new configFile[128], curMap[64], configDir[128]
|
||||
|
||||
get_configsdir(configDir, sizeof(configDir)-1)
|
||||
get_mapname(curMap, sizeof(curMap)-1)
|
||||
|
||||
new i=0;
|
||||
|
||||
while (curMap[i] != '_' && curMap[i++] != '^0') {/*do nothing*/}
|
||||
|
||||
if (curMap[i]=='_')
|
||||
{
|
||||
// this map has a prefix
|
||||
curMap[i]='^0';
|
||||
formatex(configFile, sizeof(configFile)-1, "%s/maps/prefix_%s.cfg", configDir, curMap);
|
||||
|
||||
if (file_exists(configFile))
|
||||
{
|
||||
server_cmd("exec %s", configFile);
|
||||
}
|
||||
}
|
||||
|
||||
get_mapname(curMap, sizeof(curMap)-1)
|
||||
|
||||
|
||||
formatex(configFile, sizeof(configFile)-1, "%s/maps/%s.cfg", configDir, curMap)
|
||||
|
||||
if (file_exists(configFile))
|
||||
{
|
||||
server_cmd("exec %s", configFile)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
loadSettings(szFilename[])
|
||||
{
|
||||
new File=fopen(szFilename,"r");
|
||||
|
||||
if (File)
|
||||
{
|
||||
new Text[512];
|
||||
new Flags[32];
|
||||
new Access[32]
|
||||
new AuthData[44];
|
||||
new Password[32];
|
||||
|
||||
while (!feof(File))
|
||||
{
|
||||
fgets(File,Text,sizeof(Text)-1);
|
||||
|
||||
trim(Text);
|
||||
|
||||
// comment
|
||||
if (Text[0]==';')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Flags[0]=0;
|
||||
Access[0]=0;
|
||||
AuthData[0]=0;
|
||||
Password[0]=0;
|
||||
|
||||
// not enough parameters
|
||||
if (parse(Text,AuthData,sizeof(AuthData)-1,Password,sizeof(Password)-1,Access,sizeof(Access)-1,Flags,sizeof(Flags)-1) < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
admins_push(AuthData,Password,read_flags(Access),read_flags(Flags));
|
||||
|
||||
AdminCount++;
|
||||
}
|
||||
|
||||
fclose(File);
|
||||
}
|
||||
|
||||
if (AdminCount == 1)
|
||||
{
|
||||
server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMIN");
|
||||
}
|
||||
else
|
||||
{
|
||||
server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMINS", AdminCount);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined USING_SQL
|
||||
public adminSql()
|
||||
{
|
||||
new table[32], error[128], type[12], errno
|
||||
|
||||
new Handle:info = SQL_MakeStdTuple()
|
||||
new Handle:sql = SQL_Connect(info, errno, error, 127)
|
||||
|
||||
get_cvar_string("amx_sql_table", table, 31)
|
||||
|
||||
SQL_GetAffinity(type, 11)
|
||||
|
||||
if (sql == Empty_Handle)
|
||||
{
|
||||
server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error)
|
||||
|
||||
//backup to users.ini
|
||||
new configsDir[64]
|
||||
|
||||
get_configsdir(configsDir, 63)
|
||||
format(configsDir, 63, "%s/users.ini", configsDir)
|
||||
loadSettings(configsDir) // Load admins accounts
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new Handle:query
|
||||
|
||||
if (equali(type, "sqlite"))
|
||||
{
|
||||
if (!sqlite_TableExists(sql, table))
|
||||
{
|
||||
SQL_QueryAndIgnore(sql, "CREATE TABLE %s ( auth TEXT NOT NULL DEFAULT '', password TEXT NOT NULL DEFAULT '', access TEXT NOT NULL DEFAULT '', flags TEXT NOT NULL DEFAULT '' )", table)
|
||||
}
|
||||
|
||||
query = SQL_PrepareQuery(sql, "SELECT auth, password, access, flags FROM %s", table)
|
||||
} else {
|
||||
SQL_QueryAndIgnore(sql, "CREATE TABLE IF NOT EXISTS `%s` ( `auth` VARCHAR( 32 ) NOT NULL, `password` VARCHAR( 32 ) NOT NULL, `access` VARCHAR( 32 ) NOT NULL, `flags` VARCHAR( 32 ) NOT NULL ) COMMENT = 'AMX Mod X Admins'", table)
|
||||
query = SQL_PrepareQuery(sql,"SELECT `auth`,`password`,`access`,`flags` FROM `%s`", table)
|
||||
}
|
||||
|
||||
if (!SQL_Execute(query))
|
||||
{
|
||||
SQL_QueryError(query, error, 127)
|
||||
server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
|
||||
} else if (!SQL_NumResults(query)) {
|
||||
server_print("[AMXX] %L", LANG_SERVER, "NO_ADMINS")
|
||||
} else {
|
||||
|
||||
AdminCount = 0
|
||||
|
||||
/** do this incase people change the query order and forget to modify below */
|
||||
new qcolAuth = SQL_FieldNameToNum(query, "auth")
|
||||
new qcolPass = SQL_FieldNameToNum(query, "password")
|
||||
new qcolAccess = SQL_FieldNameToNum(query, "access")
|
||||
new qcolFlags = SQL_FieldNameToNum(query, "flags")
|
||||
|
||||
new AuthData[44];
|
||||
new Password[44];
|
||||
new Access[32];
|
||||
new Flags[32];
|
||||
|
||||
while (SQL_MoreResults(query))
|
||||
{
|
||||
SQL_ReadResult(query, qcolAuth, AuthData, sizeof(AuthData)-1);
|
||||
SQL_ReadResult(query, qcolPass, Password, sizeof(Password)-1);
|
||||
SQL_ReadResult(query, qcolAccess, Access, sizeof(Access)-1);
|
||||
SQL_ReadResult(query, qcolFlags, Flags, sizeof(Flags)-1);
|
||||
|
||||
admins_push(AuthData,Password,read_flags(Access),read_flags(Flags));
|
||||
|
||||
++AdminCount;
|
||||
SQL_NextRow(query)
|
||||
}
|
||||
|
||||
if (AdminCount == 1)
|
||||
{
|
||||
server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMIN")
|
||||
}
|
||||
else
|
||||
{
|
||||
server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMINS", AdminCount)
|
||||
}
|
||||
|
||||
SQL_FreeHandle(query)
|
||||
SQL_FreeHandle(sql)
|
||||
SQL_FreeHandle(info)
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
#endif
|
||||
|
||||
public cmdReload(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 1))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
//strip original flags (patch submitted by mrhunt)
|
||||
remove_user_flags(0, read_flags("z"))
|
||||
|
||||
admins_flush();
|
||||
|
||||
#if !defined USING_SQL
|
||||
new filename[128]
|
||||
|
||||
get_configsdir(filename, 127)
|
||||
format(filename, 63, "%s/users.ini", filename)
|
||||
|
||||
AdminCount = 0;
|
||||
loadSettings(filename); // Re-Load admins accounts
|
||||
|
||||
if (id != 0)
|
||||
{
|
||||
if (AdminCount == 1)
|
||||
{
|
||||
console_print(id, "[AMXX] %L", LANG_SERVER, "LOADED_ADMIN");
|
||||
}
|
||||
else
|
||||
{
|
||||
console_print(id, "[AMXX] %L", LANG_SERVER, "LOADED_ADMINS", AdminCount);
|
||||
}
|
||||
}
|
||||
#else
|
||||
AdminCount = 0
|
||||
adminSql()
|
||||
|
||||
if (id != 0)
|
||||
{
|
||||
if (AdminCount == 1)
|
||||
console_print(id, "[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMIN")
|
||||
else
|
||||
console_print(id, "[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMINS", AdminCount)
|
||||
}
|
||||
#endif
|
||||
|
||||
new players[32], num, pv
|
||||
new name[32]
|
||||
get_players(players, num)
|
||||
for (new i=0; i<num; i++)
|
||||
{
|
||||
pv = players[i]
|
||||
get_user_name(pv, name, 31)
|
||||
accessUser(pv, name)
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
getAccess(id, name[], authid[], ip[], password[])
|
||||
{
|
||||
new index = -1
|
||||
new result = 0
|
||||
|
||||
static Count;
|
||||
static Flags;
|
||||
static Access;
|
||||
static AuthData[44];
|
||||
static Password[32];
|
||||
|
||||
g_CaseSensitiveName[id] = false;
|
||||
|
||||
Count=admins_num();
|
||||
for (new i = 0; i < Count; ++i)
|
||||
{
|
||||
Flags=admins_lookup(i,AdminProp_Flags);
|
||||
admins_lookup(i,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
|
||||
|
||||
if (Flags & FLAG_AUTHID)
|
||||
{
|
||||
if (equal(authid, AuthData))
|
||||
{
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else if (Flags & FLAG_IP)
|
||||
{
|
||||
new c = strlen(AuthData)
|
||||
|
||||
if (AuthData[c - 1] == '.') /* check if this is not a xxx.xxx. format */
|
||||
{
|
||||
if (equal(AuthData, ip, c))
|
||||
{
|
||||
index = i
|
||||
break
|
||||
}
|
||||
} /* in other case an IP must just match */
|
||||
else if (equal(ip, AuthData))
|
||||
{
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Flags & FLAG_CASE_SENSITIVE)
|
||||
{
|
||||
if (Flags & FLAG_TAG)
|
||||
{
|
||||
if (contain(name, AuthData) != -1)
|
||||
{
|
||||
index = i
|
||||
g_CaseSensitiveName[id] = true
|
||||
break
|
||||
}
|
||||
}
|
||||
else if (equal(name, AuthData))
|
||||
{
|
||||
index = i
|
||||
g_CaseSensitiveName[id] = true
|
||||
break
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Flags & FLAG_TAG)
|
||||
{
|
||||
if (containi(name, AuthData) != -1)
|
||||
{
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
else if (equali(name, AuthData))
|
||||
{
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
Access=admins_lookup(index,AdminProp_Access);
|
||||
|
||||
if (Flags & FLAG_NOPASS)
|
||||
{
|
||||
result |= 8
|
||||
new sflags[32]
|
||||
|
||||
get_flags(Access, sflags, 31)
|
||||
set_user_flags(id, Access)
|
||||
|
||||
log_amx("Login: ^"%s<%d><%s><>^" became an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, sflags, ip)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
admins_lookup(index,AdminProp_Password,Password,sizeof(Password)-1);
|
||||
|
||||
if (equal(password, Password))
|
||||
{
|
||||
result |= 12
|
||||
set_user_flags(id, Access)
|
||||
|
||||
new sflags[32]
|
||||
get_flags(Access, sflags, 31)
|
||||
|
||||
log_amx("Login: ^"%s<%d><%s><>^" became an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, sflags, ip)
|
||||
}
|
||||
else
|
||||
{
|
||||
result |= 1
|
||||
|
||||
if (Flags & FLAG_KICK)
|
||||
{
|
||||
result |= 2
|
||||
log_amx("Login: ^"%s<%d><%s><>^" kicked due to invalid password (account ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (get_pcvar_float(amx_mode) == 2.0)
|
||||
{
|
||||
result |= 2
|
||||
}
|
||||
else
|
||||
{
|
||||
new defaccess[32]
|
||||
|
||||
get_pcvar_string(amx_default_access, defaccess, 31)
|
||||
|
||||
if (!strlen(defaccess))
|
||||
{
|
||||
copy(defaccess, 32, "z")
|
||||
}
|
||||
|
||||
new idefaccess = read_flags(defaccess)
|
||||
|
||||
if (idefaccess)
|
||||
{
|
||||
result |= 8
|
||||
set_user_flags(id, idefaccess)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
accessUser(id, name[] = "")
|
||||
{
|
||||
remove_user_flags(id)
|
||||
|
||||
new userip[32], userauthid[32], password[32], passfield[32], username[32]
|
||||
|
||||
get_user_ip(id, userip, 31, 1)
|
||||
get_user_authid(id, userauthid, 31)
|
||||
|
||||
if (name[0])
|
||||
{
|
||||
copy(username, 31, name)
|
||||
}
|
||||
else
|
||||
{
|
||||
get_user_name(id, username, 31)
|
||||
}
|
||||
|
||||
get_pcvar_string(amx_password_field, passfield, 31)
|
||||
get_user_info(id, passfield, password, 31)
|
||||
|
||||
new result = getAccess(id, username, userauthid, userip, password)
|
||||
|
||||
if (result & 1)
|
||||
{
|
||||
client_cmd(id, "echo ^"* %L^"", id, "INV_PAS")
|
||||
}
|
||||
|
||||
if (result & 2)
|
||||
{
|
||||
client_cmd(id, "%s", g_cmdLoopback)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
if (result & 4)
|
||||
{
|
||||
client_cmd(id, "echo ^"* %L^"", id, "PAS_ACC")
|
||||
}
|
||||
|
||||
if (result & 8)
|
||||
{
|
||||
client_cmd(id, "echo ^"* %L^"", id, "PRIV_SET")
|
||||
}
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public client_infochanged(id)
|
||||
{
|
||||
if (!is_user_connected(id) || !get_pcvar_num(amx_mode))
|
||||
{
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
new newname[32], oldname[32]
|
||||
|
||||
get_user_name(id, oldname, 31)
|
||||
get_user_info(id, "name", newname, 31)
|
||||
|
||||
if (g_CaseSensitiveName[id])
|
||||
{
|
||||
if (!equal(newname, oldname))
|
||||
{
|
||||
accessUser(id, newname)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!equali(newname, oldname))
|
||||
{
|
||||
accessUser(id, newname)
|
||||
}
|
||||
}
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public ackSignal(id)
|
||||
{
|
||||
server_cmd("kick #%d ^"%L^"", get_user_userid(id), id, "NO_ENTRY")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public client_authorized(id)
|
||||
return get_pcvar_num(amx_mode) ? accessUser(id) : PLUGIN_CONTINUE
|
||||
|
||||
public client_putinserver(id)
|
||||
{
|
||||
if (!is_dedicated_server() && id == 1)
|
||||
return get_pcvar_num(amx_mode) ? accessUser(id) : PLUGIN_CONTINUE
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
@@ -0,0 +1,402 @@
|
||||
/* AMX Mod X
|
||||
* Admin Chat Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
|
||||
new g_msgChannel
|
||||
|
||||
#define MAX_CLR 10
|
||||
|
||||
new g_Colors[MAX_CLR][] = {"COL_WHITE", "COL_RED", "COL_GREEN", "COL_BLUE", "COL_YELLOW", "COL_MAGENTA", "COL_CYAN", "COL_ORANGE", "COL_OCEAN", "COL_MAROON"}
|
||||
new g_Values[MAX_CLR][] = {{255, 255, 255}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 0}, {255, 0, 255}, {0, 255, 255}, {227, 96, 8}, {45, 89, 116}, {103, 44, 38}}
|
||||
new Float:g_Pos[4][] = {{0.0, 0.0}, {0.05, 0.55}, {-1.0, 0.2}, {-1.0, 0.7}}
|
||||
|
||||
new amx_show_activity;
|
||||
new g_AdminChatFlag = ADMIN_CHAT;
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
new admin_chat_id
|
||||
|
||||
register_plugin("Admin Chat", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("adminchat.txt")
|
||||
register_dictionary("common.txt")
|
||||
register_clcmd("say", "cmdSayChat", ADMIN_CHAT, "@[@|@|@][w|r|g|b|y|m|c]<text> - displays hud message")
|
||||
register_clcmd("say_team", "cmdSayAdmin", 0, "@<text> - displays message to admins")
|
||||
register_concmd("amx_say", "cmdSay", ADMIN_CHAT, "<message> - sends message to all players")
|
||||
admin_chat_id = register_concmd("amx_chat", "cmdChat", ADMIN_CHAT, "<message> - sends message to admins")
|
||||
register_concmd("amx_psay", "cmdPsay", ADMIN_CHAT, "<name or #userid> <message> - sends private message")
|
||||
register_concmd("amx_tsay", "cmdTsay", ADMIN_CHAT, "<color> <message> - sends left side hud message to all players")
|
||||
register_concmd("amx_csay", "cmdTsay", ADMIN_CHAT, "<color> <message> - sends center hud message to all players")
|
||||
|
||||
amx_show_activity = get_cvar_pointer("amx_show_activity");
|
||||
|
||||
if (amx_show_activity == 0)
|
||||
{
|
||||
amx_show_activity = register_cvar("amx_show_activity", "2");
|
||||
}
|
||||
|
||||
new str[1]
|
||||
get_concmd(admin_chat_id, str, 0, g_AdminChatFlag, str, 0, -1)
|
||||
}
|
||||
|
||||
public cmdSayChat(id)
|
||||
{
|
||||
if (!access(id, g_AdminChatFlag))
|
||||
{
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
new said[6], i = 0
|
||||
read_argv(1, said, 5)
|
||||
|
||||
while (said[i] == '@')
|
||||
{
|
||||
i++
|
||||
}
|
||||
|
||||
if (!i || i > 3)
|
||||
{
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
new message[192], a = 0
|
||||
read_args(message, 191)
|
||||
remove_quotes(message)
|
||||
|
||||
switch (said[i])
|
||||
{
|
||||
case 'r': a = 1
|
||||
case 'g': a = 2
|
||||
case 'b': a = 3
|
||||
case 'y': a = 4
|
||||
case 'm': a = 5
|
||||
case 'c': a = 6
|
||||
case 'o': a = 7
|
||||
}
|
||||
|
||||
new n, s = i
|
||||
if (a)
|
||||
{
|
||||
n++
|
||||
s++
|
||||
}
|
||||
while (said[s] && isspace(said[s]))
|
||||
{
|
||||
n++
|
||||
s++
|
||||
}
|
||||
|
||||
|
||||
new name[32], authid[32], userid
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
userid = get_user_userid(id)
|
||||
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"", name, userid, authid, message[i + n])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")", name, userid, authid, message[i + n], "en", g_Colors[a])
|
||||
|
||||
if (++g_msgChannel > 6 || g_msgChannel < 3)
|
||||
{
|
||||
g_msgChannel = 3
|
||||
}
|
||||
|
||||
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0
|
||||
|
||||
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 6.0, 6.0, 0.5, 0.15, -1)
|
||||
|
||||
switch ( get_pcvar_num(amx_show_activity) )
|
||||
{
|
||||
case 3, 4:
|
||||
{
|
||||
new maxpl = get_maxplayers();
|
||||
for (new pl = 1; pl <= maxpl; pl++)
|
||||
{
|
||||
if (is_user_connected(pl) && !is_user_bot(pl))
|
||||
{
|
||||
if (is_user_admin(pl))
|
||||
{
|
||||
show_hudmessage(pl, "%s : %s", name, message[i + n])
|
||||
client_print(pl, print_notify, "%s : %s", name, message[i + n])
|
||||
}
|
||||
else
|
||||
{
|
||||
show_hudmessage(pl, "%s", message[i + n])
|
||||
client_print(pl, print_notify, "%s", message[i + n])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
show_hudmessage(0, "%s : %s", name, message[i + n])
|
||||
client_print(0, print_notify, "%s : %s", name, message[i + n])
|
||||
}
|
||||
default:
|
||||
{
|
||||
show_hudmessage(0, "%s", message[i + n])
|
||||
client_print(0, print_notify, "%s", message[i + n])
|
||||
}
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdSayAdmin(id)
|
||||
{
|
||||
new said[2]
|
||||
read_argv(1, said, 1)
|
||||
|
||||
if (said[0] != '@')
|
||||
return PLUGIN_CONTINUE
|
||||
|
||||
new message[192], name[32], authid[32], userid
|
||||
new players[32], inum
|
||||
|
||||
read_args(message, 191)
|
||||
remove_quotes(message)
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
userid = get_user_userid(id)
|
||||
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message[1])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message[1])
|
||||
|
||||
if (is_user_admin(id))
|
||||
format(message, 191, "(%L) %s : %s", id, "ADMIN", name, message[1])
|
||||
else
|
||||
format(message, 191, "(%L) %s : %s", id, "PLAYER", name, message[1])
|
||||
|
||||
get_players(players, inum)
|
||||
|
||||
for (new i = 0; i < inum; ++i)
|
||||
{
|
||||
// dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
|
||||
if (players[i] != id && get_user_flags(players[i]) & g_AdminChatFlag)
|
||||
client_print(players[i], print_chat, "%s", message)
|
||||
}
|
||||
|
||||
client_print(id, print_chat, "%s", message)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdChat(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 2))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new message[192], name[32], players[32], inum, authid[32], userid
|
||||
|
||||
read_args(message, 191)
|
||||
remove_quotes(message)
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
userid = get_user_userid(id)
|
||||
get_players(players, inum)
|
||||
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message)
|
||||
|
||||
format(message, 191, "(ADMINS) %s : %s", name, message)
|
||||
console_print(id, "%s", message)
|
||||
|
||||
for (new i = 0; i < inum; ++i)
|
||||
{
|
||||
if (access(players[i], g_AdminChatFlag))
|
||||
client_print(players[i], print_chat, "%s", message)
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdSay(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 2))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new message[192], name[32], authid[32], userid
|
||||
|
||||
read_args(message, 191)
|
||||
remove_quotes(message)
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
userid = get_user_userid(id)
|
||||
client_print(0, print_chat, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
|
||||
console_print(id, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
|
||||
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" say ^"%s^"", name, userid, authid, message)
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_say^" (text ^"%s^")", name, userid, authid, message)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdPsay(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 3))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new name[32]
|
||||
read_argv(1, name, 31)
|
||||
new priv = cmd_target(id, name, 0)
|
||||
|
||||
if (!priv)
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new length = strlen(name) + 1
|
||||
|
||||
get_user_name(priv, name, 31);
|
||||
|
||||
new message[192], name2[32], authid[32], authid2[32], userid, userid2
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name2, 31)
|
||||
userid = get_user_userid(id)
|
||||
read_args(message, 191)
|
||||
|
||||
if (message[0] == '"' && message[length] == '"') // HLSW fix
|
||||
{
|
||||
message[0] = ' '
|
||||
message[length] = ' '
|
||||
length += 2
|
||||
}
|
||||
|
||||
remove_quotes(message[length])
|
||||
get_user_name(priv, name, 31)
|
||||
|
||||
if (id && id != priv)
|
||||
client_print(id, print_chat, "(%s) %s : %s", name, name2, message[length])
|
||||
|
||||
client_print(priv, print_chat, "(%s) %s : %s", name, name2, message[length])
|
||||
console_print(id, "(%s) %s : %s", name, name2, message[length])
|
||||
get_user_authid(priv, authid2, 31)
|
||||
userid2 = get_user_userid(priv)
|
||||
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" psay ^"%s<%d><%s><>^" ^"%s^"", name2, userid, authid, name, userid2, authid2, message[length])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_psay^" against ^"%s<%d><%s><>^" (text ^"%s^")", name2, userid, authid, name, userid2, authid2, message[length])
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdTsay(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 3))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new cmd[16], color[16], color2[16], message[192], name[32], authid[32], userid = 0
|
||||
|
||||
read_argv(0, cmd, 15)
|
||||
new bool:tsay = (tolower(cmd[4]) == 't')
|
||||
|
||||
read_args(message, 191)
|
||||
remove_quotes(message)
|
||||
parse(message, color, 15)
|
||||
|
||||
new found = 0, a = 0
|
||||
new lang[3], langnum = get_langsnum()
|
||||
|
||||
for (new i = 0; i < MAX_CLR; ++i)
|
||||
{
|
||||
for (new j = 0; j < langnum; j++)
|
||||
{
|
||||
get_lang(j, lang)
|
||||
format(color2, 15, "%L", lang, g_Colors[i])
|
||||
|
||||
if (equali(color, color2))
|
||||
{
|
||||
a = i
|
||||
found = 1
|
||||
break
|
||||
}
|
||||
}
|
||||
if (found == 1)
|
||||
break
|
||||
}
|
||||
|
||||
new length = found ? (strlen(color) + 1) : 0
|
||||
|
||||
if (++g_msgChannel > 6 || g_msgChannel < 3)
|
||||
g_msgChannel = 3
|
||||
|
||||
new Float:verpos = (tsay ? 0.55 : 0.1) + float(g_msgChannel) / 35.0
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
userid = get_user_userid(id)
|
||||
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], tsay ? 0.05 : -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, -1)
|
||||
|
||||
switch ( get_pcvar_num(amx_show_activity) )
|
||||
{
|
||||
case 3, 4:
|
||||
{
|
||||
new maxpl = get_maxplayers();
|
||||
for (new pl = 1; pl <= maxpl; pl++)
|
||||
{
|
||||
if (is_user_connected(pl) && !is_user_bot(pl))
|
||||
{
|
||||
if (is_user_admin(pl))
|
||||
{
|
||||
show_hudmessage(pl, "%s : %s", name, message[length])
|
||||
client_print(pl, print_notify, "%s : %s", name, message[length])
|
||||
}
|
||||
else
|
||||
{
|
||||
show_hudmessage(pl, "%s", message[length])
|
||||
client_print(pl, print_notify, "%s", message[length])
|
||||
}
|
||||
}
|
||||
}
|
||||
console_print(id, "%s : %s", name, message[length])
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
show_hudmessage(0, "%s : %s", name, message[length])
|
||||
client_print(0, print_notify, "%s : %s", name, message[length])
|
||||
console_print(id, "%s : %s", name, message[length])
|
||||
}
|
||||
default:
|
||||
{
|
||||
show_hudmessage(0, "%s", message[length])
|
||||
client_print(0, print_notify, "%s", message[length])
|
||||
console_print(id, "%s", message[length])
|
||||
}
|
||||
}
|
||||
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" %s ^"%s^"", name, userid, authid, cmd[4], message[length])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"%s^" (text ^"%s^") (color ^"%s^")", name, userid, authid, cmd, message[length], color2)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,129 @@
|
||||
/* AMX Mod X
|
||||
* Admin Help Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by tcquest78
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
|
||||
#define DISPLAY_MSG // Comment to disable message on join
|
||||
#define HELPAMOUNT 10 // Number of commands per page
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Admin Help", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("adminhelp.txt")
|
||||
register_concmd("amx_help", "cmdHelp", 0, "<page> [nr of cmds (only for server)] - displays this help")
|
||||
}
|
||||
|
||||
#if defined DISPLAY_MSG
|
||||
public client_putinserver(id)
|
||||
{
|
||||
if (is_user_bot(id))
|
||||
return
|
||||
|
||||
set_task(15.0, "dispInfo", id)
|
||||
}
|
||||
|
||||
public client_disconnect(id)
|
||||
{
|
||||
remove_task(id)
|
||||
}
|
||||
#endif
|
||||
|
||||
public cmdHelp(id, level, cid)
|
||||
{
|
||||
new arg1[8], flags = get_user_flags(id)
|
||||
new start = read_argv(1, arg1, 7) ? str_to_num(arg1) : 1
|
||||
new lHelpAmount = HELPAMOUNT
|
||||
|
||||
// HACK: ADMIN_ADMIN is never set as a user's actual flags, so those types of commands never show
|
||||
if (flags > 0 && !(flags & ADMIN_USER))
|
||||
{
|
||||
flags |= ADMIN_ADMIN;
|
||||
}
|
||||
|
||||
if (id == 0 && read_argc() == 3)
|
||||
lHelpAmount = read_argv(2, arg1, 7) ? str_to_num(arg1) : HELPAMOUNT
|
||||
|
||||
if (--start < 0)
|
||||
start = 0
|
||||
|
||||
new clcmdsnum = get_concmdsnum(flags, id)
|
||||
|
||||
if (start >= clcmdsnum)
|
||||
start = clcmdsnum - 1
|
||||
|
||||
console_print(id, "^n----- %L -----", id, "HELP_COMS")
|
||||
|
||||
new info[128], cmd[32], eflags
|
||||
new end = start + lHelpAmount // HELPAMOUNT
|
||||
|
||||
if (end > clcmdsnum)
|
||||
end = clcmdsnum
|
||||
|
||||
for (new i = start; i < end; i++)
|
||||
{
|
||||
get_concmd(i, cmd, 31, eflags, info, 127, flags, id)
|
||||
console_print(id, "%3d: %s %s", i + 1, cmd, info)
|
||||
}
|
||||
|
||||
console_print(id, "----- %L -----", id, "HELP_ENTRIES", start + 1, end, clcmdsnum)
|
||||
|
||||
if (end < clcmdsnum)
|
||||
console_print(id, "----- %L -----", id, "HELP_USE_MORE", end + 1)
|
||||
else
|
||||
console_print(id, "----- %L -----", id, "HELP_USE_BEGIN")
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
#if defined DISPLAY_MSG
|
||||
public dispInfo(id)
|
||||
{
|
||||
client_print(id, print_chat, "%L", id, "TYPE_HELP")
|
||||
|
||||
new nextmap[32]
|
||||
get_cvar_string("amx_nextmap", nextmap, 31)
|
||||
|
||||
if (get_cvar_float("mp_timelimit"))
|
||||
{
|
||||
new timeleft = get_timeleft()
|
||||
|
||||
if (timeleft > 0)
|
||||
{
|
||||
client_print(id, print_chat, "%L", id, "TIME_INFO_1", timeleft / 60, timeleft % 60, nextmap)
|
||||
} else {
|
||||
client_print(id, print_chat, "%L", id, "TIME_INFO_2", nextmap)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
/* AMX Mod X
|
||||
* Slots Reservation Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
|
||||
new g_ResPtr
|
||||
new g_HidePtr
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Slots Reservation", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("adminslots.txt")
|
||||
register_dictionary("common.txt")
|
||||
g_ResPtr = register_cvar("amx_reservation", "0")
|
||||
g_HidePtr = register_cvar("amx_hideslots", "0")
|
||||
}
|
||||
|
||||
public plugin_cfg()
|
||||
{
|
||||
set_task(3.0, "MapLoaded")
|
||||
}
|
||||
|
||||
public MapLoaded()
|
||||
{
|
||||
if (!get_pcvar_num(g_HidePtr))
|
||||
return
|
||||
|
||||
new maxplayers = get_maxplayers()
|
||||
new players = get_playersnum(1)
|
||||
new limit = maxplayers - get_pcvar_num(g_ResPtr)
|
||||
setVisibleSlots(players, maxplayers, limit)
|
||||
}
|
||||
|
||||
public client_authorized(id)
|
||||
{
|
||||
new maxplayers = get_maxplayers()
|
||||
new players = get_playersnum(1)
|
||||
new limit = maxplayers - get_pcvar_num(g_ResPtr)
|
||||
|
||||
if (access(id, ADMIN_RESERVATION) || (players <= limit))
|
||||
{
|
||||
if (get_pcvar_num(g_HidePtr) == 1)
|
||||
setVisibleSlots(players, maxplayers, limit)
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
new lReason[64]
|
||||
format(lReason, 63, "%L", id, "DROPPED_RES")
|
||||
server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public client_disconnect(id)
|
||||
{
|
||||
if (!get_pcvar_num(g_HidePtr))
|
||||
return PLUGIN_CONTINUE
|
||||
|
||||
new maxplayers = get_maxplayers()
|
||||
|
||||
setVisibleSlots(get_playersnum(1) - 1, maxplayers, maxplayers - get_pcvar_num(g_ResPtr))
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
setVisibleSlots(players, maxplayers, limit)
|
||||
{
|
||||
new num = players + 1
|
||||
|
||||
if (players == maxplayers)
|
||||
num = maxplayers
|
||||
else if (players < limit)
|
||||
num = limit
|
||||
|
||||
set_cvar_num("sv_visiblemaxplayers", num)
|
||||
}
|
||||
@@ -0,0 +1,570 @@
|
||||
/* AMX Mod X
|
||||
* Admin Votes Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
|
||||
|
||||
new g_Answer[128]
|
||||
new g_optionName[4][64]
|
||||
new g_voteCount[4]
|
||||
new g_validMaps
|
||||
new g_yesNoVote
|
||||
new g_coloredMenus
|
||||
new g_voteCaller
|
||||
new g_Execute[256]
|
||||
new g_execLen
|
||||
|
||||
new bool:g_execResult
|
||||
new Float:g_voteRatio
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Admin Votes", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("adminvote.txt")
|
||||
register_dictionary("common.txt")
|
||||
register_dictionary("mapsmenu.txt")
|
||||
register_menucmd(register_menuid("Change map to "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||
register_menucmd(register_menuid("Choose map: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
|
||||
register_menucmd(register_menuid("Kick "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||
register_menucmd(register_menuid("Ban "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||
register_menucmd(register_menuid("Vote: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
|
||||
register_menucmd(register_menuid("The result: "), MENU_KEY_1|MENU_KEY_2, "actionResult")
|
||||
register_concmd("amx_votemap", "cmdVoteMap", ADMIN_VOTE, "<map> [map] [map] [map]")
|
||||
register_concmd("amx_votekick", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
|
||||
register_concmd("amx_voteban", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
|
||||
register_concmd("amx_vote", "cmdVote", ADMIN_VOTE, "<question> <answer#1> <answer#2>")
|
||||
register_concmd("amx_cancelvote", "cmdCancelVote", ADMIN_VOTE, "- cancels last vote")
|
||||
|
||||
g_coloredMenus = colored_menus()
|
||||
}
|
||||
|
||||
public cmdCancelVote(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 0))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
if (task_exists(99889988, 1))
|
||||
{
|
||||
new authid[32], name[32]
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name, get_user_userid(id), authid)
|
||||
|
||||
|
||||
new maxpl=get_maxplayers();
|
||||
new msg[256];
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
{
|
||||
if (is_user_connected(i) && !is_user_bot(i))
|
||||
{
|
||||
// HACK: ADMIN_CANC_VOTE_{1,2} keys were designed very poorly. Remove all : and %s in it.
|
||||
LookupLangKey(msg, charsmax(msg), "ADMIN_CANC_VOTE_1", i);
|
||||
replace_all(msg, charsmax(msg), "%s", "");
|
||||
replace_all(msg, charsmax(msg), ":", "");
|
||||
trim(msg);
|
||||
show_activity_id(i, id, name, msg);
|
||||
}
|
||||
}
|
||||
|
||||
console_print(id, "%L", id, "VOTING_CANC")
|
||||
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTING_CANC")
|
||||
remove_task(99889988, 1)
|
||||
set_cvar_float("amx_last_voting", get_gametime())
|
||||
}
|
||||
else
|
||||
console_print(id, "%L", id, "NO_VOTE_CANC")
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public delayedExec(cmd[])
|
||||
server_cmd("%s", cmd)
|
||||
|
||||
public autoRefuse()
|
||||
{
|
||||
log_amx("Vote: %L", "en", "RES_REF")
|
||||
client_print(0, print_chat, "%L", LANG_PLAYER, "RES_REF")
|
||||
}
|
||||
|
||||
public actionResult(id, key)
|
||||
{
|
||||
remove_task(4545454)
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
|
||||
log_amx("Vote: %L", "en", "RES_ACCEPTED")
|
||||
client_print(0, print_chat, "%L", LANG_PLAYER, "RES_ACCEPTED")
|
||||
}
|
||||
case 1: autoRefuse()
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public checkVotes()
|
||||
{
|
||||
new best = 0
|
||||
|
||||
if (!g_yesNoVote)
|
||||
{
|
||||
for (new a = 0; a < 4; ++a)
|
||||
if (g_voteCount[a] > g_voteCount[best])
|
||||
|
||||
best = a
|
||||
}
|
||||
|
||||
new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3]
|
||||
new iRatio = votesNum ? floatround(g_voteRatio * float(votesNum), floatround_ceil) : 1
|
||||
new iResult = g_voteCount[best]
|
||||
new players[32], pnum, i
|
||||
|
||||
get_players(players, pnum, "c")
|
||||
|
||||
if (iResult < iRatio)
|
||||
{
|
||||
new lVotingFailed[64]
|
||||
|
||||
for (i = 0; i < pnum; i++)
|
||||
{
|
||||
format(lVotingFailed, 63, "%L", players[i], "VOTING_FAILED")
|
||||
if (g_yesNoVote)
|
||||
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_1", lVotingFailed, g_voteCount[0], g_voteCount[1], iRatio)
|
||||
else
|
||||
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_2", lVotingFailed, iResult, iRatio)
|
||||
}
|
||||
|
||||
format(lVotingFailed, 63, "%L", "en", "VOTING_FAILED")
|
||||
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")", lVotingFailed, iResult, iRatio)
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
g_execLen = format(g_Execute, 255, g_Answer, g_optionName[best]) + 1
|
||||
|
||||
if (g_execResult)
|
||||
{
|
||||
g_execResult = false
|
||||
|
||||
if (is_user_connected(g_voteCaller))
|
||||
{
|
||||
new menuBody[512], lTheResult[32], lYes[16], lNo[16]
|
||||
|
||||
format(lTheResult, 31, "%L", g_voteCaller, "THE_RESULT")
|
||||
format(lYes, 15, "%L", g_voteCaller, "YES")
|
||||
format(lNo, 15, "%L", g_voteCaller, "NO")
|
||||
|
||||
new len = format(menuBody, 511, g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute)
|
||||
|
||||
len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE")
|
||||
format(menuBody[len], 511 - len, "^n1. %s^n2. %s", lYes, lNo)
|
||||
show_menu(g_voteCaller, 0x03, menuBody, 10, "The result: ")
|
||||
set_task(10.0, "autoRefuse", 4545454)
|
||||
}
|
||||
else
|
||||
set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
|
||||
}
|
||||
|
||||
new lVotingSuccess[32]
|
||||
|
||||
for (i = 0; i < pnum; i++)
|
||||
{
|
||||
format(lVotingSuccess, 31, "%L", players[i], "VOTING_SUCCESS")
|
||||
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_3", lVotingSuccess, iResult, iRatio, g_Execute)
|
||||
}
|
||||
|
||||
format(lVotingSuccess, 31, "%L", "en", "VOTING_SUCCESS")
|
||||
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", lVotingSuccess, iResult, iRatio, g_Execute)
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public voteCount(id, key)
|
||||
{
|
||||
if (get_cvar_num("amx_vote_answers"))
|
||||
{
|
||||
new name[32]
|
||||
get_user_name(id, name, 31)
|
||||
|
||||
if (g_yesNoVote)
|
||||
client_print(0, print_chat, "%L", LANG_PLAYER, key ? "VOTED_AGAINST" : "VOTED_FOR", name)
|
||||
else
|
||||
client_print(0, print_chat, "%L", LANG_PLAYER, "VOTED_FOR_OPT", name, key + 1)
|
||||
}
|
||||
++g_voteCount[key]
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdVoteMap(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 2))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new Float:voting = get_cvar_float("amx_last_voting")
|
||||
if (voting > get_gametime())
|
||||
{
|
||||
console_print(id, "%L", id, "ALREADY_VOTING")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
|
||||
{
|
||||
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new argc = read_argc()
|
||||
if (argc > 5) argc = 5
|
||||
|
||||
g_validMaps = 0
|
||||
g_optionName[0][0] = 0
|
||||
g_optionName[1][0] = 0
|
||||
g_optionName[2][0] = 0
|
||||
g_optionName[3][0] = 0
|
||||
|
||||
for (new i = 1; i < argc; ++i)
|
||||
{
|
||||
read_argv(i, g_optionName[g_validMaps], 31)
|
||||
|
||||
if (is_map_valid(g_optionName[g_validMaps]))
|
||||
g_validMaps++
|
||||
}
|
||||
|
||||
if (g_validMaps == 0)
|
||||
{
|
||||
new lMaps[16]
|
||||
|
||||
format(lMaps, 15, "%L", id, (argc == 2) ? "MAP_IS" : "MAPS_ARE")
|
||||
console_print(id, "%L", id, "GIVEN_NOT_VALID", lMaps)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new menu_msg[256], len = 0
|
||||
new keys = 0
|
||||
|
||||
if (g_validMaps > 1)
|
||||
{
|
||||
keys = MENU_KEY_0
|
||||
len = format(menu_msg, 255, g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n", LANG_SERVER, "CHOOSE_MAP")
|
||||
new temp[128]
|
||||
|
||||
for (new a = 0; a < g_validMaps; ++a)
|
||||
{
|
||||
format(temp, 127, "%d. %s^n", a+1, g_optionName[a])
|
||||
len += copy(menu_msg[len], 255-len, temp)
|
||||
keys |= (1<<a)
|
||||
}
|
||||
|
||||
format(menu_msg[len], 255-len, "^n0. %L", LANG_SERVER, "NONE")
|
||||
g_yesNoVote = 0
|
||||
} else {
|
||||
new lChangeMap[32], lYes[16], lNo[16]
|
||||
|
||||
format(lChangeMap, 31, "%L", LANG_SERVER, "CHANGE_MAP_TO")
|
||||
format(lYes, 15, "%L", LANG_SERVER, "YES")
|
||||
format(lNo, 15, "%L", LANG_SERVER, "NO")
|
||||
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lChangeMap, g_optionName[0], lYes, lNo)
|
||||
keys = MENU_KEY_1|MENU_KEY_2
|
||||
g_yesNoVote = 1
|
||||
}
|
||||
|
||||
new authid[32], name[32]
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
|
||||
if (argc == 2)
|
||||
log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")", name, get_user_userid(id), authid, g_optionName[0])
|
||||
else
|
||||
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", name, get_user_userid(id), authid, g_optionName[0], g_optionName[1], g_optionName[2], g_optionName[3])
|
||||
|
||||
new maxpl=get_maxplayers();
|
||||
new msg[256];
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
{
|
||||
if (is_user_connected(i) && !is_user_bot(i))
|
||||
{
|
||||
// HACK: ADMIN_VOTE_MAP_{1,2} keys were designed very poorly. Remove all : and %s in it.
|
||||
LookupLangKey(msg, charsmax(msg), "ADMIN_VOTE_MAP_1", i);
|
||||
replace_all(msg, charsmax(msg), "%s", "");
|
||||
replace_all(msg, charsmax(msg), ":", "");
|
||||
trim(msg);
|
||||
show_activity_id(i, id, name, msg);
|
||||
}
|
||||
}
|
||||
|
||||
g_execResult = true
|
||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||
|
||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||
g_voteRatio = get_cvar_float("amx_votemap_ratio")
|
||||
g_Answer = "changelevel %s"
|
||||
show_menu(0, keys, menu_msg, floatround(vote_time), (g_validMaps > 1) ? "Choose map: " : "Change map to ")
|
||||
set_task(vote_time, "checkVotes", 99889988)
|
||||
g_voteCaller = id
|
||||
console_print(id, "%L", id, "VOTING_STARTED")
|
||||
g_voteCount = {0, 0, 0, 0}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdVote(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 4))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new Float:voting = get_cvar_float("amx_last_voting")
|
||||
if (voting > get_gametime())
|
||||
{
|
||||
console_print(id, "%L", id, "ALREADY_VOTING")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
|
||||
{
|
||||
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new quest[48]
|
||||
read_argv(1, quest, 47)
|
||||
|
||||
if (contain(quest, "sv_password") != -1 || contain(quest, "rcon_password") != -1)
|
||||
{
|
||||
console_print(id, "%L", id, "VOTING_FORBIDDEN")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new count=read_argc();
|
||||
|
||||
for (new i=0;i<4 && (i+2)<count;i++)
|
||||
{
|
||||
read_argv(i+2, g_optionName[i], sizeof(g_optionName[])-1);
|
||||
}
|
||||
|
||||
new authid[32], name[32]
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")", name, get_user_userid(id), authid, quest, g_optionName[0], g_optionName[1])
|
||||
|
||||
new maxpl=get_maxplayers();
|
||||
new msg[256];
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
{
|
||||
if (is_user_connected(i) && !is_user_bot(i))
|
||||
{
|
||||
// HACK: ADMIN_VOTE_CUS_{1,2} keys were designed very poorly. Remove all : and %s in it.
|
||||
LookupLangKey(msg, charsmax(msg), "ADMIN_VOTE_CUS_1", i);
|
||||
replace_all(msg, charsmax(msg), "%s", "");
|
||||
replace_all(msg, charsmax(msg), ":", "");
|
||||
trim(msg);
|
||||
show_activity_id(i, id, name, msg);
|
||||
}
|
||||
}
|
||||
|
||||
new menu_msg[512], lVote[16]
|
||||
|
||||
format(lVote, 15, "%L", LANG_SERVER, "VOTE")
|
||||
|
||||
count-=2;
|
||||
if (count>4)
|
||||
{
|
||||
count=4;
|
||||
}
|
||||
// count now shows how many options were listed
|
||||
new keys=0;
|
||||
for (new i=0;i<count;i++)
|
||||
{
|
||||
keys |= (1<<i);
|
||||
}
|
||||
|
||||
new len=formatex(menu_msg, sizeof(menu_msg)-1, g_coloredMenus ? "\y%s: %s\w^n^n" : "%s: %s^n^n", lVote, quest);
|
||||
|
||||
for (new i=0;i<count;i++)
|
||||
{
|
||||
len+=formatex(menu_msg[len], sizeof(menu_msg) - 1 - len ,"%d. %s^n",i+1,g_optionName[i]);
|
||||
}
|
||||
g_execResult = false
|
||||
|
||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||
|
||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||
g_voteRatio = get_cvar_float("amx_vote_ratio")
|
||||
replace_all(quest,sizeof(quest)-1,"%","");
|
||||
format(g_Answer, 127, "%s - %%s", quest)
|
||||
show_menu(0, keys, menu_msg, floatround(vote_time), "Vote: ")
|
||||
set_task(vote_time, "checkVotes", 99889988)
|
||||
g_voteCaller = id
|
||||
console_print(id, "%L", id, "VOTING_STARTED")
|
||||
g_voteCount = {0, 0, 0, 0}
|
||||
g_yesNoVote = 0
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public cmdVoteKickBan(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 2))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new Float:voting = get_cvar_float("amx_last_voting")
|
||||
if (voting > get_gametime())
|
||||
{
|
||||
console_print(id, "%L", id, "ALREADY_VOTING")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
|
||||
{
|
||||
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new cmd[32]
|
||||
|
||||
read_argv(0, cmd, 31)
|
||||
|
||||
new voteban = equal(cmd, "amx_voteban")
|
||||
new arg[32]
|
||||
read_argv(1, arg, 31)
|
||||
|
||||
new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
if (voteban && is_user_bot(player))
|
||||
{
|
||||
new imname[32]
|
||||
|
||||
get_user_name(player, imname, 31)
|
||||
console_print(id, "%L", id, "ACTION_PERFORMED", imname)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new keys = MENU_KEY_1|MENU_KEY_2
|
||||
new menu_msg[256], lYes[16], lNo[16], lKickBan[16]
|
||||
|
||||
format(lYes, 15, "%L", LANG_SERVER, "YES")
|
||||
format(lNo, 15, "%L", LANG_SERVER, "NO")
|
||||
format(lKickBan, 15, "%L", LANG_SERVER, voteban ? "BAN" : "KICK")
|
||||
ucfirst(lKickBan)
|
||||
get_user_name(player, arg, 31)
|
||||
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lKickBan, arg, lYes, lNo)
|
||||
g_yesNoVote = 1
|
||||
|
||||
new bool:ipban=false;
|
||||
|
||||
if (voteban)
|
||||
{
|
||||
get_user_authid(player, g_optionName[0], sizeof(g_optionName[])-1);
|
||||
|
||||
// Do the same check that's in plmenu to determine if this should be an IP ban instead
|
||||
if (equal("4294967295", g_optionName[0])
|
||||
|| equal("HLTV", g_optionName[0])
|
||||
|| equal("STEAM_ID_LAN", g_optionName[0])
|
||||
|| equali("VALVE_ID_LAN", g_optionName[0]))
|
||||
{
|
||||
get_user_ip(player, g_optionName[0], sizeof(g_optionName[])-1, 1);
|
||||
|
||||
ipban=true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
num_to_str(get_user_userid(player), g_optionName[0], 31)
|
||||
}
|
||||
|
||||
new authid[32], name[32]
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")", name, get_user_userid(id), authid, voteban ? "ban" : "kick", arg)
|
||||
|
||||
new maxpl=get_maxplayers();
|
||||
new msg[256];
|
||||
new right[256];
|
||||
new dummy[1];
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
{
|
||||
if (is_user_connected(i) && !is_user_bot(i))
|
||||
{
|
||||
formatex(lKickBan, charsmax(lKickBan), "%L", i, voteban ? "BAN" : "KICK");
|
||||
|
||||
// HACK: ADMIN_VOTE_FOR{1,2} keys are really weird. Tokenize and ignore the text before the :
|
||||
LookupLangKey(msg, charsmax(msg), "ADMIN_VOTE_FOR_1", i);
|
||||
strtok(msg, dummy, 0, right, charsmax(right), ':');
|
||||
trim(right);
|
||||
show_activity_id(i, id, name, right, lKickBan, arg);
|
||||
}
|
||||
}
|
||||
|
||||
g_execResult = true
|
||||
|
||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||
|
||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||
g_voteRatio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio")
|
||||
|
||||
if (voteban)
|
||||
{
|
||||
if (ipban==true)
|
||||
{
|
||||
g_Answer = "addip 30.0 %s";
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Answer = "banid 30.0 %s kick";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Answer = "kick #%s";
|
||||
}
|
||||
show_menu(0, keys, menu_msg, floatround(vote_time), voteban ? "Ban " : "Kick ")
|
||||
set_task(vote_time, "checkVotes", 99889988)
|
||||
g_voteCaller = id
|
||||
console_print(id, "%L", id, "VOTING_STARTED")
|
||||
g_voteCount = {0, 0, 0, 0}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* AMX Mod Compatibility engine
|
||||
* by the AMX Mod X Development Team
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
#include <fun> //we want fun running for extra compatibility
|
||||
#include <engine> //we want engine running for extra compatibility
|
||||
#include <fakemeta>
|
||||
#include <translator>
|
||||
#define AMXMODX_NOAUTOLOAD
|
||||
#include <cstrike>
|
||||
#include <sqlx>
|
||||
|
||||
#define MOD_NORMAL 0
|
||||
#define MOD_CSTRIKE 1
|
||||
|
||||
new g_ModType = MOD_NORMAL
|
||||
new g_MaxPlayers
|
||||
|
||||
#include "core.sma"
|
||||
#include "vexdum.sma"
|
||||
#include "mysql.sma"
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("AMX Mod Compat Engine", "1.76.rc4", "AMXX Dev Team")
|
||||
|
||||
g_MaxPlayers = get_maxplayers()
|
||||
|
||||
VexdUM_Register()
|
||||
}
|
||||
|
||||
public plugin_natives()
|
||||
{
|
||||
set_module_filter("Plugin_ModuleFilter")
|
||||
set_native_filter("Plugin_NativeFilter")
|
||||
|
||||
new modname[32]
|
||||
get_modname(modname, 31)
|
||||
if (equali(modname, "cstrike") || equali(modname, "czero"))
|
||||
{
|
||||
g_ModType = MOD_CSTRIKE
|
||||
}
|
||||
|
||||
Core_Natives()
|
||||
VexdUM_Natives()
|
||||
MySQL_Natives()
|
||||
}
|
||||
|
||||
public Plugin_ModuleFilter(const module[])
|
||||
{
|
||||
if (equali(module, "sqlx") || equali(module, "cstrike"))
|
||||
{
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public Plugin_NativeFilter(const name[], index, trap)
|
||||
{
|
||||
if (!trap)
|
||||
{
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
public client_connect(id)
|
||||
{
|
||||
VexdUM_ClientConnect(id)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
/**
|
||||
* AMX Mod Compatibility engine
|
||||
* by the AMX Mod X Development Team
|
||||
*/
|
||||
|
||||
Core_Natives()
|
||||
{
|
||||
/* implicit compatibility */
|
||||
register_native("VelocityByAim", "__VelocityByAim")
|
||||
register_native("load_translations", "__load_translations")
|
||||
register_native("is_user_authorized", "__is_user_authorized")
|
||||
register_native("get_user_money", "__get_user_money")
|
||||
register_native("set_user_money", "__set_user_money")
|
||||
register_native("angle_to_vector", "__angle_to_vector")
|
||||
register_native("fabs", "__fabs")
|
||||
register_native("asin", "__asin")
|
||||
register_native("sin", "__sin")
|
||||
register_native("sinh", "__sinh")
|
||||
register_native("acos", "__acos")
|
||||
register_native("cos", "__cos")
|
||||
register_native("cosh", "__cosh")
|
||||
register_native("atan", "__atan")
|
||||
register_native("atan2", "__atan2")
|
||||
register_native("tan", "__tan")
|
||||
register_native("tanh", "__tanh")
|
||||
register_native("fsqroot", "__fsqroot")
|
||||
register_native("fpower", "__fpower")
|
||||
register_native("flog", "__flog")
|
||||
register_native("get_cmdaccess", "__get_cmdaccess")
|
||||
register_native("is_translated", "__is_translated")
|
||||
register_native("get_plugincmdsnum", "__get_plugincmdsnum")
|
||||
register_native("get_plugincmd", "__get_plugincmd")
|
||||
register_native("get_plugincvarsnum", "__get_plugincvarsnum")
|
||||
register_native("get_plugincvar", "__get_plugincvar")
|
||||
register_native("is_module_running", "__is_module_running")
|
||||
register_native("is_plugin_running", "__is_plugin_running")
|
||||
}
|
||||
|
||||
public __VelocityByAim(plid, num)
|
||||
{
|
||||
new iIndex
|
||||
new iVelocity
|
||||
new Float:vRetValue[3]
|
||||
|
||||
iIndex = get_param(1)
|
||||
iVelocity = get_param(2)
|
||||
|
||||
new ret = velocity_by_aim(iIndex, iVelocity, vRetValue)
|
||||
set_array_f(3, vRetValue, 3)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
public __load_translations(plid, num)
|
||||
{
|
||||
static file[255]
|
||||
|
||||
get_string(1, file, 254)
|
||||
|
||||
return load_translations(file)
|
||||
}
|
||||
|
||||
public __is_user_authorized(plid, num)
|
||||
{
|
||||
return is_user_authorized(get_param(1))
|
||||
}
|
||||
|
||||
public __get_user_money(plid, num)
|
||||
{
|
||||
return get_user_money(get_param(1))
|
||||
}
|
||||
|
||||
public __set_user_money(plid, num)
|
||||
{
|
||||
return set_user_money(get_param(1), get_param(2), get_param(3))
|
||||
}
|
||||
|
||||
public __angle_to_vector(plid, num)
|
||||
{
|
||||
new Float:angle[3]
|
||||
new Float:vRetValue[3]
|
||||
|
||||
get_array_f(1, angle, 3)
|
||||
|
||||
new ret = angle_vector(angle, get_param(2), vRetValue)
|
||||
set_array_f(3, vRetValue, 3)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
public Float:__fabs(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatabs(value)
|
||||
}
|
||||
|
||||
public Float:__asin(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatasin(value, radian)
|
||||
}
|
||||
|
||||
public Float:__sin(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatsin(value, radian)
|
||||
}
|
||||
|
||||
public Float:__sinh(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatsinh(value, radian)
|
||||
}
|
||||
|
||||
public Float:__acos(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatacos(value, radian)
|
||||
}
|
||||
|
||||
public Float:__cos(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatcos(value, radian)
|
||||
}
|
||||
|
||||
public Float:__cosh(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatcosh(value, radian)
|
||||
}
|
||||
|
||||
public Float:__atan(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatatan(value, radian)
|
||||
}
|
||||
|
||||
public Float:__atan2(plid, num)
|
||||
{
|
||||
new Float:value1 = get_param_f(1)
|
||||
new Float:value2 = get_param_f(2)
|
||||
|
||||
return floatatan2(value1, value2, radian)
|
||||
}
|
||||
|
||||
public Float:__tan(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floattan(value, radian)
|
||||
}
|
||||
|
||||
public Float:__tanh(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floattanh(value, radian)
|
||||
}
|
||||
|
||||
public Float:__fsqroot(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
|
||||
return floatsqroot(value)
|
||||
}
|
||||
|
||||
public Float:__fpower(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
new Float:exponent = get_param_f(2)
|
||||
|
||||
return floatpower(value, exponent)
|
||||
}
|
||||
|
||||
public Float:__flog(plid, num)
|
||||
{
|
||||
new Float:value = get_param_f(1)
|
||||
new Float:base = get_param_f(2)
|
||||
|
||||
return floatlog(value, base)
|
||||
}
|
||||
|
||||
//get_cmdaccess(cmd[], accessflags[], len)
|
||||
public __get_cmdaccess(plid, num)
|
||||
{
|
||||
static command[32], accessflags[32]
|
||||
new ret
|
||||
|
||||
get_string(1, command, 31)
|
||||
|
||||
if ((ret=get_cmdaccess(command, accessflags, 31)))
|
||||
{
|
||||
set_string(2, accessflags, get_param(3))
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
public __is_translated(plid, num)
|
||||
{
|
||||
static string[512]
|
||||
|
||||
get_string(1, string, 511)
|
||||
|
||||
return is_translated(string)
|
||||
}
|
||||
|
||||
public __get_plugincmdsnum(plid, num)
|
||||
{
|
||||
static plugin[64]
|
||||
|
||||
get_string(1, plugin, 63)
|
||||
|
||||
return get_plugincmdsnum(plugin, get_param(2))
|
||||
}
|
||||
|
||||
public __get_plugincmd(plid, num)
|
||||
{
|
||||
static plugin[64]
|
||||
static command[32]
|
||||
static accessflags[32]
|
||||
static info[512]
|
||||
|
||||
get_string(1, plugin, 63)
|
||||
|
||||
if (get_plugincmd(plugin,
|
||||
get_param(2),
|
||||
command,
|
||||
31,
|
||||
accessflags,
|
||||
31,
|
||||
info,
|
||||
511,
|
||||
get_param(9),
|
||||
get_param(10)))
|
||||
{
|
||||
set_string(3, command, get_param(4))
|
||||
set_string(5, accessflags, get_param(6))
|
||||
set_string(7, info, get_param(8))
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
public __get_plugincvarsnum(plid, num)
|
||||
{
|
||||
static plugin[64]
|
||||
|
||||
get_string(1, plugin, 63)
|
||||
|
||||
return get_plugincvarsnum(plugin, get_param(2))
|
||||
}
|
||||
|
||||
//stock get_plugincvar(plugin[], index, cvar[], len1, value[], len2, flags=0)
|
||||
public __get_plugincvar(plid, num)
|
||||
{
|
||||
static plugin[64]
|
||||
static cvar[32]
|
||||
static value[512]
|
||||
|
||||
get_string(1, plugin, 63)
|
||||
|
||||
if (get_plugincvar(plugin, get_param(2), cvar, 31, value, 511, get_param(7)))
|
||||
{
|
||||
set_string(3, cvar, get_param(4))
|
||||
set_string(5, value, get_param(6))
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
public __is_module_running(plid, num)
|
||||
{
|
||||
static module[64]
|
||||
|
||||
get_string(1, module, 63)
|
||||
|
||||
return is_module_running(module)
|
||||
}
|
||||
|
||||
public __is_plugin_running(plid, num)
|
||||
{
|
||||
static plugin[64]
|
||||
|
||||
get_string(1, plugin, 63)
|
||||
|
||||
return is_plugin_running(plugin)
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
/**
|
||||
* AMX Mod Compatibility engine
|
||||
* by the AMX Mod X Development Team
|
||||
*/
|
||||
|
||||
#define MAX_CONNECTIONS 64
|
||||
|
||||
new Connections[MAX_CONNECTIONS+1] = {0}
|
||||
new ConnectionTracker[MAX_CONNECTIONS+1] = {0}
|
||||
new ConnectionErrors[MAX_CONNECTIONS+1][255]
|
||||
new ConnectionQueries[MAX_CONNECTIONS+1] = {0}
|
||||
new QueryPositions[MAX_CONNECTIONS+1]
|
||||
|
||||
MySQL_Natives()
|
||||
{
|
||||
register_native("mysql_connect", "__mysql_connect")
|
||||
register_native("mysql_query", "__mysql_query")
|
||||
register_native("mysql_error", "__mysql_error")
|
||||
register_native("mysql_close", "__mysql_close")
|
||||
register_native("mysql_nextrow", "__mysql_nextrow")
|
||||
register_native("mysql_getfield", "__mysql_getfield")
|
||||
register_native("mysql_getresult", "__mysql_getresult")
|
||||
register_native("mysql_affected_rows", "__mysql_affected_rows")
|
||||
register_native("mysql_num_fields", "__mysql_num_fields")
|
||||
register_native("mysql_num_rows", "__mysql_num_rows")
|
||||
register_native("mysql_field_name", "__mysql_field_name")
|
||||
register_native("mysql_insert_id", "__mysql_insert_id")
|
||||
}
|
||||
|
||||
MakeConnectionIndex(Handle:cn)
|
||||
{
|
||||
if (ConnectionTracker[0])
|
||||
{
|
||||
new idx = ConnectionTracker[ConnectionTracker[0]]
|
||||
ConnectionTracker[0]--
|
||||
Connections[idx] = _:cn
|
||||
return idx
|
||||
} else {
|
||||
Connections[0]++
|
||||
if (Connections[0] > MAX_CONNECTIONS)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
Connections[Connections[0]] = _:cn
|
||||
return Connections[0]
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
Handle:GetConnectionIndex(idx)
|
||||
{
|
||||
if (idx < 1 || idx > MAX_CONNECTIONS || !Connections[idx])
|
||||
{
|
||||
return Empty_Handle
|
||||
}
|
||||
|
||||
return Handle:Connections[idx]
|
||||
}
|
||||
|
||||
FreeConnectionIndex(idx)
|
||||
{
|
||||
Connections[idx] = 0
|
||||
ConnectionTracker[0]++
|
||||
ConnectionTracker[ConnectionTracker[0]] = idx
|
||||
ConnectionErrors[idx][0] = 0
|
||||
ConnectionQueries[idx] = 0
|
||||
QueryPositions[idx] = 0
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlike the previous this does not check for a matching connection.
|
||||
* Unless a plugin breaks I'm not going to take that step.
|
||||
*/
|
||||
|
||||
public __mysql_connect(plid, num)
|
||||
{
|
||||
static host[255], user[128], pass[128], dbname[128], error[512]
|
||||
new errcode
|
||||
|
||||
get_string(1, host, 254)
|
||||
get_string(2, user, 127)
|
||||
get_string(3, pass, 127)
|
||||
get_string(4, dbname, 127)
|
||||
|
||||
new Handle:info = SQL_MakeDbTuple(host, user, pass, dbname)
|
||||
new Handle:cn = SQL_Connect(info, errcode, error, 511)
|
||||
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
set_string(5, error, get_param(6))
|
||||
return 0
|
||||
}
|
||||
|
||||
SQL_FreeHandle(info)
|
||||
|
||||
new idx = MakeConnectionIndex(cn)
|
||||
if (idx == 0)
|
||||
{
|
||||
set_string(5, "Reached max unclosed connections", get_param(6))
|
||||
return 0
|
||||
}
|
||||
|
||||
ConnectionQueries[idx] = 0
|
||||
|
||||
return idx
|
||||
}
|
||||
|
||||
public __mysql_query(plid, num)
|
||||
{
|
||||
static queryString[4096]
|
||||
new cn_idx = get_param(1)
|
||||
new Handle:cn
|
||||
|
||||
if ((cn=GetConnectionIndex(cn_idx)) == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
vdformat(queryString, 4095, 2, 3)
|
||||
|
||||
new Handle:query = SQL_PrepareQuery(cn, "%s", queryString)
|
||||
|
||||
if (!SQL_Execute(query))
|
||||
{
|
||||
SQL_QueryError(query, ConnectionErrors[cn_idx], 254)
|
||||
SQL_FreeHandle(query)
|
||||
return 0
|
||||
}
|
||||
|
||||
if (ConnectionQueries[cn_idx])
|
||||
{
|
||||
SQL_FreeHandle(Handle:ConnectionQueries[cn_idx])
|
||||
}
|
||||
|
||||
ConnectionQueries[cn_idx] = _:query
|
||||
QueryPositions[cn_idx] = 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __mysql_error(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
if (Connections[cn_idx] < 1)
|
||||
{
|
||||
static error[255]
|
||||
format(error, 254, "Invalid connection index: %d", cn_idx)
|
||||
set_string(2, error, get_param(3))
|
||||
return 1
|
||||
}
|
||||
|
||||
set_string(2, ConnectionErrors[cn_idx], get_param(3))
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __mysql_close(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
|
||||
if (query != Empty_Handle)
|
||||
{
|
||||
SQL_FreeHandle(query)
|
||||
}
|
||||
|
||||
SQL_FreeHandle(cn)
|
||||
|
||||
FreeConnectionIndex(cn_idx)
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __mysql_nextrow(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
if (QueryPositions[cn_idx] != 0)
|
||||
{
|
||||
SQL_NextRow(query)
|
||||
}
|
||||
|
||||
if (SQL_MoreResults(query))
|
||||
{
|
||||
return ++QueryPositions[cn_idx]
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
public __mysql_getresult(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
if (!SQL_MoreResults(query))
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
static name[64]
|
||||
get_string(2, name, 63)
|
||||
new column = SQL_FieldNameToNum(query, name)
|
||||
if (column == -1)
|
||||
{
|
||||
log_error(AMX_ERR_NATIVE, "Invalid column name: %s", name)
|
||||
return 0
|
||||
}
|
||||
|
||||
switch (num)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
return SQL_ReadResult(query, column)
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
new Float:fma
|
||||
SQL_ReadResult(query, column, fma)
|
||||
set_param_byref(3, _:fma)
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
static str[2048]
|
||||
SQL_ReadResult(query, column, str, 2047)
|
||||
set_string(3, str, get_param_byref(4))
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __mysql_getfield(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
if (!SQL_MoreResults(query))
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
switch (num)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
return SQL_ReadResult(query, get_param(2)-1)
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
new Float:fma
|
||||
SQL_ReadResult(query, get_param(2)-1, fma)
|
||||
set_param_byref(3, _:fma)
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
static str[2048]
|
||||
SQL_ReadResult(query, get_param(2)-1, str, 2047)
|
||||
set_string(3, str, get_param_byref(4))
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __mysql_affected_rows(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
return SQL_AffectedRows(query)
|
||||
}
|
||||
|
||||
public __mysql_num_fields(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
return SQL_NumColumns(query)
|
||||
}
|
||||
|
||||
public __mysql_insert_id(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
return SQL_GetInsertId(query)
|
||||
}
|
||||
|
||||
public __mysql_num_rows(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
return SQL_NumResults(query)
|
||||
}
|
||||
|
||||
public __mysql_field_name(plid, num)
|
||||
{
|
||||
new cn_idx = get_param(1)
|
||||
|
||||
new Handle:cn = GetConnectionIndex(cn_idx)
|
||||
if (cn == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new Handle:query = Handle:ConnectionQueries[cn_idx]
|
||||
if (query == Empty_Handle)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new column = get_param(2) - 1
|
||||
if (column < 0 || column >= SQL_NumColumns(query))
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new field[64]
|
||||
SQL_FieldNumToName(query, column, field, 63)
|
||||
|
||||
set_string(3, field, get_param(4))
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -0,0 +1,730 @@
|
||||
/**
|
||||
* AMX Mod Compatibility engine
|
||||
* by the AMX Mod X Development Team
|
||||
*/
|
||||
|
||||
#include <VexdUM_const>
|
||||
#include <VexdUM_stock>
|
||||
|
||||
/* Forwards */
|
||||
new g_FwdTouch
|
||||
new g_FwdThink
|
||||
new g_FwdSpawn
|
||||
new g_FwdClientPreThink
|
||||
new g_FwdClientPostThink
|
||||
new g_FwdEmitSound
|
||||
new g_FwdEmitAmbientSound
|
||||
new g_FwdSetModel
|
||||
new g_FwdTraceLine
|
||||
new g_FwdSetCliKeyValue
|
||||
new g_FwdKeyValue
|
||||
new g_PlayerModels[33][64]
|
||||
new g_PlayerModeled[33]
|
||||
|
||||
/* User Messages */
|
||||
new g_msgDamage
|
||||
new g_msgDeathMsg
|
||||
new g_msgScoreInfo
|
||||
|
||||
new g_LastTrace = 0
|
||||
|
||||
VexdUM_Register()
|
||||
{
|
||||
/* Fakemeta Hooks */
|
||||
register_forward(FM_EmitSound, "Hook_FM_EmitSound")
|
||||
register_forward(FM_EmitAmbientSound, "Hook_FM_EmitAmbientSound")
|
||||
register_forward(FM_SetModel, "Hook_FM_SetModel")
|
||||
register_forward(FM_SetClientKeyValue, "Hook_FM_SetClientKeyValue")
|
||||
register_forward(FM_KeyValue, "Hook_FM_KeyValue")
|
||||
register_forward(FM_Touch, "Hook_FM_Touch")
|
||||
register_forward(FM_Think, "Hook_FM_Think")
|
||||
register_forward(FM_Spawn, "Hook_FM_Spawn")
|
||||
register_forward(FM_PlayerPreThink, "Hook_FM_PlayerPreThink")
|
||||
register_forward(FM_PlayerPostThink, "Hook_FM_PlayerPostThink")
|
||||
register_forward(FM_ClientUserInfoChanged, "Hook_ClientUserInfoChanged")
|
||||
|
||||
// Only register the traceline forward if there actually is a plugin
|
||||
// that needs it. Otherwise this will mess with set_user_hitzones
|
||||
|
||||
new pluginnum = get_pluginsnum();
|
||||
for (new i = 0; i < pluginnum; i++)
|
||||
{
|
||||
if (plugin_flags(0, i) & AMX_FLAG_OLDFILE && // plugin is an AMX plugin being emulated
|
||||
get_func_id("traceline", i) != -1) // plugin needs traceline
|
||||
{
|
||||
register_forward(FM_TraceLine, "Hook_FM_TraceLine")
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
/* Global Forwards */
|
||||
g_FwdTouch = CreateMultiForwardEx("entity_touch", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_CELL)
|
||||
g_FwdThink = CreateMultiForwardEx("entity_think", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdSpawn = CreateMultiForwardEx("entity_spawn", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdClientPreThink = CreateMultiForwardEx("client_prethink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdClientPostThink = CreateMultiForwardEx("client_postthink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdEmitSound = CreateMultiForwardEx("emitsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
|
||||
g_FwdEmitAmbientSound = CreateMultiForwardEx("emitambientsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
|
||||
g_FwdSetModel = CreateMultiForwardEx("set_model", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
|
||||
g_FwdTraceLine = CreateMultiForwardEx("traceline", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdSetCliKeyValue = CreateMultiForwardEx("setclientkeyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING, FP_STRING)
|
||||
g_FwdKeyValue = CreateMultiForwardEx("keyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
|
||||
/* User Messages */
|
||||
g_msgDamage = get_user_msgid("Damage")
|
||||
g_msgDeathMsg = get_user_msgid("DeathMsg")
|
||||
g_msgScoreInfo = get_user_msgid("ScoreInfo")
|
||||
}
|
||||
|
||||
VexdUM_Natives()
|
||||
{
|
||||
/* implicit compatibility */
|
||||
register_native("is_entity", "__is_entity")
|
||||
register_native("find_entity", "__find_entity")
|
||||
register_native("find_entity_sphere", "__find_entity_sphere")
|
||||
register_native("in_view_cone", "__in_view_cone")
|
||||
register_native("get_offset_int", "__get_offset_int")
|
||||
register_native("set_offset_int", "__set_offset_int")
|
||||
register_native("trace_line", "__trace_line")
|
||||
register_native("traceline_get_int", "__traceline_get_int")
|
||||
register_native("traceline_set_int", "__traceline_set_int")
|
||||
register_native("traceline_get_edict", "__traceline_get_edict")
|
||||
register_native("traceline_set_edict", "__traceline_set_edict")
|
||||
register_native("traceline_set_float", "__traceline_set_float")
|
||||
register_native("can_see", "__can_see")
|
||||
register_native("user_spawn", "__user_spawn")
|
||||
register_native("get_maxentities", "__get_maxentities")
|
||||
register_native("PointContents", "__PointContents")
|
||||
register_native("DispatchKeyValue", "__DispatchKeyValue")
|
||||
register_native("entity_use","__entity_use")
|
||||
register_native("get_num_ents","__get_num_ents")
|
||||
register_native("take_damage","__take_damage")
|
||||
|
||||
if (g_ModType == MOD_CSTRIKE)
|
||||
{
|
||||
register_native("set_user_model", "__cs_set_user_model")
|
||||
} else {
|
||||
register_native("set_user_model", "__set_user_model")
|
||||
}
|
||||
}
|
||||
|
||||
VexdUM_ClientConnect(id)
|
||||
{
|
||||
g_PlayerModels[id][0] = 0
|
||||
g_PlayerModeled[id] =0
|
||||
}
|
||||
|
||||
SetClientKeyValue(id, const key[], const value[])
|
||||
{
|
||||
new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
|
||||
|
||||
return engfunc(EngFunc_SetClientKeyValue, id, buffer, key, value)
|
||||
}
|
||||
|
||||
GetClientKeyValue(id, const key[], value[], maxlen)
|
||||
{
|
||||
new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
|
||||
|
||||
engfunc(EngFunc_InfoKeyValue, buffer, key, value, maxlen)
|
||||
}
|
||||
|
||||
Death(victim, killer, weapon[64], hs)
|
||||
{
|
||||
if(pev(victim,pev_takedamage) > DAMAGE_NO)
|
||||
{
|
||||
new inflictor = pev(killer,pev_owner)
|
||||
if(pev(killer,pev_flags) & (FL_CLIENT | FL_FAKECLIENT))
|
||||
{
|
||||
if(equal(weapon,""))
|
||||
{
|
||||
pev(killer,pev_viewmodel2,weapon,63)
|
||||
|
||||
replace(weapon,63,"models/v_","")
|
||||
weapon[strlen(weapon) - 4] = '^0'
|
||||
}
|
||||
}
|
||||
else if(inflictor > 0 && inflictor < get_maxplayers())
|
||||
{
|
||||
if(equal(weapon,""))
|
||||
{
|
||||
pev(killer,pev_viewmodel2,weapon,63)
|
||||
|
||||
replace(weapon,63,"weapon_","")
|
||||
replace(weapon,63,"monster_","")
|
||||
replace(weapon,63,"func_","")
|
||||
}
|
||||
|
||||
if(inflictor == victim)
|
||||
{
|
||||
killer = victim
|
||||
} else {
|
||||
killer = inflictor
|
||||
}
|
||||
}
|
||||
|
||||
message_begin(MSG_ALL,g_msgDeathMsg)
|
||||
write_byte(killer)
|
||||
write_byte(victim)
|
||||
write_byte(hs)
|
||||
write_string(weapon)
|
||||
message_end()
|
||||
|
||||
new vname[32],vauthid[32],vteam[32]
|
||||
get_user_name(victim,vname,31)
|
||||
get_user_authid(victim,vauthid,31)
|
||||
get_user_team(victim,vteam,31)
|
||||
|
||||
if(victim == killer)
|
||||
{
|
||||
log_message("^"%s<%i><%s><%s>^" killed self with ^"%s^"^n",vname,get_user_userid(victim),
|
||||
vauthid,vteam,weapon)
|
||||
}
|
||||
else if(pev(killer,pev_flags) & (FL_CLIENT | FL_FAKECLIENT))
|
||||
{
|
||||
new kname[32],kauthid[32],kteam[32],team
|
||||
get_user_name(killer,kname,31)
|
||||
get_user_authid(killer,kauthid,31)
|
||||
team = get_user_team(killer,kteam,31)
|
||||
|
||||
log_message("^"%s<%i><%s><%s>^" killed ^"%s<%i><%s><%s>^" with ^"%s^"^n",kname,get_user_userid(killer),
|
||||
kauthid,kteam,vname,get_user_userid(victim),vauthid,vteam,weapon)
|
||||
|
||||
new Float:frags
|
||||
pev(killer,pev_frags,frags)
|
||||
set_pev(killer,pev_frags,frags+1.0)
|
||||
|
||||
message_begin(MSG_ALL,g_msgScoreInfo)
|
||||
write_byte(killer)
|
||||
write_short(floatround(frags))
|
||||
write_short(get_user_deaths(killer))
|
||||
write_short(0)
|
||||
write_short(team)
|
||||
message_end()
|
||||
|
||||
pev(victim,pev_frags,frags)
|
||||
set_pev(victim,pev_frags,frags+1.0)
|
||||
} else {
|
||||
log_message("^"%s<%i><%s><%s>^" killed by ^"%s^"^n",vname,get_user_userid(victim),vauthid,vteam,weapon)
|
||||
}
|
||||
|
||||
set_msg_block(g_msgDeathMsg,BLOCK_ONCE)
|
||||
dllfunc(DLLFunc_ClientKill,victim)
|
||||
}
|
||||
}
|
||||
|
||||
public __is_entity(plid, num)
|
||||
{
|
||||
new ent = get_param(1)
|
||||
return is_entity(ent)
|
||||
}
|
||||
|
||||
public __find_entity(plid, num)
|
||||
{
|
||||
static entstr[256]
|
||||
new startEnt, type
|
||||
|
||||
startEnt = get_param(1)
|
||||
get_string(2, entstr, 255)
|
||||
type = get_param(3)
|
||||
|
||||
return find_entity(startEnt, entstr, type)
|
||||
}
|
||||
|
||||
public __find_entity_sphere(plid, num)
|
||||
{
|
||||
new ent
|
||||
new Float:orig[3]
|
||||
new Float:radius
|
||||
|
||||
ent = get_param(1)
|
||||
get_array_f(2, orig, 3)
|
||||
radius = get_param_f(3)
|
||||
|
||||
return find_entity_sphere(ent, orig, radius)
|
||||
}
|
||||
|
||||
public __in_view_cone(plid, num)
|
||||
{
|
||||
new ent
|
||||
new Float:orig[3]
|
||||
|
||||
ent = get_param(1)
|
||||
get_array_f(2, orig, 3)
|
||||
|
||||
return in_view_cone(ent, orig)
|
||||
}
|
||||
|
||||
public __get_offset_int(plid, num)
|
||||
{
|
||||
new ent = get_param(1)
|
||||
new offs = get_param(2)
|
||||
new linux = get_param(3)
|
||||
|
||||
return get_pdata_int(ent, offs, linux)
|
||||
}
|
||||
|
||||
public __set_offset_int(plid, num)
|
||||
{
|
||||
return set_offset_int(get_param(1), get_param(2), get_param(3), get_param(4))
|
||||
}
|
||||
|
||||
public __trace_line(plid, num)
|
||||
{
|
||||
new ent = get_param(1)
|
||||
|
||||
new Float:vStart[3], Float:vEnd[3], Float:vReturn[3]
|
||||
|
||||
get_array_f(2, vStart, 3)
|
||||
get_array_f(3, vEnd, 3)
|
||||
|
||||
if (ent == FM_NULLENT)
|
||||
engfunc(EngFunc_TraceLine, vStart, vEnd, IGNORE_MONSTERS, 0, 0)
|
||||
else
|
||||
engfunc(EngFunc_TraceLine, vStart, vEnd, DONT_IGNORE_MONSTERS, ent, 0)
|
||||
|
||||
get_tr2(0, TraceResult:TR_vecEndPos, vReturn)
|
||||
|
||||
set_array_f(4, vReturn, 3)
|
||||
|
||||
new traceHit = get_tr2(0, TraceResult:TR_pHit)
|
||||
|
||||
if (!pev_valid(traceHit))
|
||||
return FM_NULLENT
|
||||
|
||||
return traceHit
|
||||
}
|
||||
|
||||
public __traceline_get_int(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new iValue = 0
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_INT_fAllSolid:
|
||||
iValue = get_tr2(g_LastTrace, TraceResult:TR_AllSolid)
|
||||
case TR_INT_fStartSolid:
|
||||
iValue = get_tr2(g_LastTrace, TraceResult:TR_StartSolid)
|
||||
case TR_INT_fInOpen:
|
||||
iValue = get_tr2(g_LastTrace, TraceResult:TR_InOpen)
|
||||
case TR_INT_fInWater:
|
||||
iValue = get_tr2(g_LastTrace, TraceResult:TR_InWater)
|
||||
case TR_INT_iHitgroup:
|
||||
iValue = get_tr2(g_LastTrace, TraceResult:TR_iHitgroup)
|
||||
default:
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
}
|
||||
|
||||
return iValue
|
||||
}
|
||||
|
||||
public __traceline_set_int(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new iValue = get_param(2)
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_INT_fAllSolid:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_AllSolid, iValue)
|
||||
case TR_INT_fStartSolid:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_StartSolid, iValue)
|
||||
case TR_INT_fInOpen:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_InOpen, iValue)
|
||||
case TR_INT_fInWater:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_InWater, iValue)
|
||||
case TR_INT_iHitgroup:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_iHitgroup, iValue)
|
||||
default:
|
||||
{
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __traceline_get_edict(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new iValue = 0
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_ENT_pHit:
|
||||
iValue = get_tr2(g_LastTrace, TraceResult:TR_pHit)
|
||||
default:
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
}
|
||||
|
||||
return iValue
|
||||
}
|
||||
|
||||
public __traceline_set_edict(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new iValue = get_param(2)
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_ENT_pHit:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_pHit, iValue)
|
||||
default:
|
||||
{
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public Float:__traceline_get_float(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new Float:fValue = 0.0
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_FL_flFraction:
|
||||
get_tr2(g_LastTrace, TraceResult:TR_flFraction, fValue)
|
||||
case TR_FL_flPlaneDist:
|
||||
get_tr2(g_LastTrace, TraceResult:TR_flPlaneDist, fValue)
|
||||
default:
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
}
|
||||
|
||||
return fValue
|
||||
}
|
||||
|
||||
public __traceline_set_float(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new Float:fValue = get_param_f(2)
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_FL_flFraction:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_flFraction, fValue)
|
||||
case TR_FL_flPlaneDist:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_flPlaneDist, fValue)
|
||||
default:
|
||||
{
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __traceline_get_vector(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new Float:vValue[3]
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_VEC_vecEndPos:
|
||||
get_tr2(g_LastTrace, TraceResult:TR_vecEndPos, vValue)
|
||||
case TR_VEC_vecPlaneNormal:
|
||||
get_tr2(g_LastTrace, TraceResult:TR_vecPlaneNormal, vValue)
|
||||
default:
|
||||
{
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
set_array_f(2, vValue, 3)
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __traceline_set_vector(plid, num)
|
||||
{
|
||||
new iSet = get_param(1)
|
||||
new Float:vValue[3]
|
||||
|
||||
get_array_f(2, vValue, 3)
|
||||
|
||||
switch (iSet)
|
||||
{
|
||||
case TR_VEC_vecEndPos:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_vecEndPos, vValue)
|
||||
case TR_VEC_vecPlaneNormal:
|
||||
set_tr2(g_LastTrace, TraceResult:TR_vecPlaneNormal, vValue)
|
||||
default:
|
||||
{
|
||||
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __can_see(plid, num)
|
||||
{
|
||||
return can_see(get_param(1), get_param(2))
|
||||
}
|
||||
|
||||
public __user_spawn(plid, num)
|
||||
{
|
||||
return dllfunc(DLLFunc_Spawn, get_param(1))
|
||||
}
|
||||
|
||||
public __set_user_model(plid, num)
|
||||
{
|
||||
new id = get_param(1)
|
||||
if (id < 1 || id > g_MaxPlayers)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
|
||||
new model[64]
|
||||
get_string(2, model, 63)
|
||||
if (model[0] == 0)
|
||||
{
|
||||
if (!g_PlayerModeled[id])
|
||||
{
|
||||
return 0
|
||||
}
|
||||
g_PlayerModeled[id] = 0
|
||||
g_PlayerModels[id][0] = 0
|
||||
dllfunc(DLLFunc_ClientUserInfoChanged, id)
|
||||
} else {
|
||||
copy(g_PlayerModels[id], 63, model)
|
||||
g_PlayerModeled[id] = 1
|
||||
SetClientKeyValue(id, "model", model)
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __cs_set_user_model(plid, num)
|
||||
{
|
||||
new id = get_param(1)
|
||||
new model[64]
|
||||
|
||||
get_string(2, model, 63)
|
||||
|
||||
return cs_set_user_model(id, model)
|
||||
}
|
||||
|
||||
public __get_maxentities(plid, num)
|
||||
{
|
||||
return get_maxentities()
|
||||
}
|
||||
|
||||
public __PointContents(plid, num)
|
||||
{
|
||||
new Float:vCheckAt[3]
|
||||
|
||||
get_array_f(1, vCheckAt, 3)
|
||||
|
||||
return point_contents(vCheckAt)
|
||||
}
|
||||
|
||||
public __DispatchKeyValue(plid, num)
|
||||
{
|
||||
new ent = get_param(1)
|
||||
|
||||
new szClassname[32], szKey[32], szValue[32]
|
||||
|
||||
if (pev_valid(ent))
|
||||
{
|
||||
get_string(2, szKey, 31)
|
||||
get_string(3, szValue, 31)
|
||||
pev(ent, pev_classname, szClassname, 31)
|
||||
|
||||
set_kvd(0, KV_ClassName, szClassname)
|
||||
set_kvd(0, KV_KeyName, szKey)
|
||||
set_kvd(0, KV_Value, szValue)
|
||||
set_kvd(0, KV_fHandled, 0)
|
||||
|
||||
dllfunc(DLLFunc_KeyValue, ent, 0)
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
public __entity_use(plid, num)
|
||||
{
|
||||
new entUsed = get_param(1)
|
||||
new entOther = get_param(2)
|
||||
return dllfunc(DLLFunc_Use,entUsed,entOther)
|
||||
}
|
||||
|
||||
public __get_num_ents(plid, num)
|
||||
{
|
||||
return engfunc(EngFunc_NumberOfEntities)
|
||||
}
|
||||
|
||||
public __take_damage(plid, num)
|
||||
{
|
||||
new victim = get_param(1)
|
||||
new attacker = get_param(2)
|
||||
new Float:orig[3]
|
||||
get_array_f(3,orig,3)
|
||||
new Float:dmg = get_param_f(4)
|
||||
new bit = get_param(5)
|
||||
new wpnName[64]
|
||||
get_string(6,wpnName,63)
|
||||
new hs = get_param(7)
|
||||
|
||||
if(pev(victim,pev_takedamage) > DAMAGE_NO)
|
||||
{
|
||||
set_pev(victim,pev_dmg_inflictor,attacker)
|
||||
|
||||
new Float:olddmg
|
||||
pev(victim,pev_dmg_take,olddmg)
|
||||
set_pev(victim,pev_dmg_take,olddmg+dmg)
|
||||
|
||||
message_begin(MSG_ONE, g_msgDamage, {0,0,0} , victim)
|
||||
write_byte(0)
|
||||
write_byte(floatround(olddmg+dmg))
|
||||
write_long(bit)
|
||||
write_coord(floatround(orig[0]))
|
||||
write_coord(floatround(orig[1]))
|
||||
write_coord(floatround(orig[2]))
|
||||
message_end()
|
||||
|
||||
new Float:health
|
||||
pev(victim,pev_health,health)
|
||||
if((dmg >= health) && (health > 0.0))
|
||||
{
|
||||
Death(victim,attacker,wpnName,hs)
|
||||
} else {
|
||||
set_pev(victim,pev_health,health-dmg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************
|
||||
***** HOOKS *********************
|
||||
*********************************/
|
||||
|
||||
public Hook_ClientUserInfoChanged(id, buffer)
|
||||
{
|
||||
if (g_PlayerModeled[id] && (pev(id, pev_deadflag) == DEAD_NO))
|
||||
{
|
||||
return FMRES_SUPERCEDE
|
||||
}
|
||||
|
||||
return FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_EmitSound(entid, channel, const sample[]) //we don't care about the rest
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdEmitSound, ret, entid, sample)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_EmitAmbientSound(entid, Float:pos[3], const sample[]) //we don't care about the rest
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdEmitAmbientSound, ret, entid, sample)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_SetModel(entid, const model[])
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdSetModel, ret, entid, model)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_TraceLine(Float:v1[3], Float:v2[3], noMonsters, skip_ent, ptr)
|
||||
{
|
||||
g_LastTrace = ptr
|
||||
|
||||
engfunc(EngFunc_TraceLine, v1, v2, noMonsters, skip_ent, ptr)
|
||||
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdTraceLine, ret, skip_ent)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_SetClientKeyValue(id, const infobuffer[], const key[], const value[])
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdSetCliKeyValue, ret, id, key, value)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_KeyValue(ent, kvd)
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdKeyValue, ret, ent)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_Touch(ent1, ent2)
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdTouch, ret, ent1, ent2)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_Think(entid)
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdThink, ret, entid)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_Spawn(entid)
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdSpawn, ret, entid)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_PlayerPreThink(id)
|
||||
{
|
||||
new ret
|
||||
|
||||
ExecuteForward(g_FwdClientPreThink, ret, id)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
|
||||
public Hook_FM_PlayerPostThink(id)
|
||||
{
|
||||
new ret
|
||||
|
||||
if (g_PlayerModeled[id])
|
||||
{
|
||||
new model[64]
|
||||
GetClientKeyValue(id, "model", model, 63)
|
||||
if (!equal(g_PlayerModels[id], model))
|
||||
{
|
||||
SetClientKeyValue(id, "model", g_PlayerModels[id])
|
||||
}
|
||||
}
|
||||
|
||||
ExecuteForward(g_FwdClientPostThink, ret, id)
|
||||
|
||||
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
|
||||
}
|
||||
BIN
src/csserver/serverfiles/cstrike/addons/amxmodx/scripting/amxxpc
Normal file
BIN
src/csserver/serverfiles/cstrike/addons/amxmodx/scripting/amxxpc
Normal file
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,78 @@
|
||||
/* AMX Mod X
|
||||
* Anti Flood Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
|
||||
new Float:g_Flooding[33] = {0.0, ...}
|
||||
new g_Flood[33] = {0, ...}
|
||||
|
||||
new amx_flood_time;
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Anti Flood", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("antiflood.txt")
|
||||
register_clcmd("say", "chkFlood")
|
||||
register_clcmd("say_team", "chkFlood")
|
||||
amx_flood_time=register_cvar("amx_flood_time", "0.75")
|
||||
}
|
||||
|
||||
public chkFlood(id)
|
||||
{
|
||||
new Float:maxChat = get_pcvar_float(amx_flood_time)
|
||||
|
||||
if (maxChat)
|
||||
{
|
||||
new Float:nexTime = get_gametime()
|
||||
|
||||
if (g_Flooding[id] > nexTime)
|
||||
{
|
||||
if (g_Flood[id] >= 3)
|
||||
{
|
||||
client_print(id, print_notify, "** %L **", id, "STOP_FLOOD")
|
||||
g_Flooding[id] = nexTime + maxChat + 3.0
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
g_Flood[id]++
|
||||
}
|
||||
else if (g_Flood[id])
|
||||
{
|
||||
g_Flood[id]--
|
||||
}
|
||||
|
||||
g_Flooding[id] = nexTime + maxChat
|
||||
}
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
/* AMX Mod X
|
||||
* Commands Menu Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
|
||||
// Precache sounds from speech.ini - comment this line to disable
|
||||
#define PRECACHE_SPEECHINI
|
||||
|
||||
/* Commands Menus */
|
||||
|
||||
#define MAX_CMDS_LAYERS 3
|
||||
|
||||
new g_cmdMenuName[MAX_CMDS_LAYERS][] =
|
||||
{
|
||||
"CMD_MENU",
|
||||
"CONF_MENU",
|
||||
"SPE_MENU"
|
||||
}
|
||||
|
||||
new g_cmdMenuCmd[MAX_CMDS_LAYERS][] =
|
||||
{
|
||||
"amx_cmdmenu",
|
||||
"amx_cfgmenu",
|
||||
"amx_speechmenu"
|
||||
}
|
||||
|
||||
new g_cmdMenuCfg[MAX_CMDS_LAYERS][] =
|
||||
{
|
||||
"cmds.ini",
|
||||
"configs.ini",
|
||||
"speech.ini"
|
||||
}
|
||||
|
||||
new g_cmdMenuHelp[MAX_CMDS_LAYERS][] =
|
||||
{
|
||||
"- displays commands menu",
|
||||
"- displays configs menu",
|
||||
"- displays speech menu"
|
||||
}
|
||||
|
||||
/* End of Commands Menu */
|
||||
|
||||
#define MAX_CMDS 64
|
||||
#define MAX_CVARS 48
|
||||
|
||||
new g_cmdName[MAX_CMDS*MAX_CMDS_LAYERS][32]
|
||||
new g_cmdCmd[MAX_CMDS*MAX_CMDS_LAYERS][64]
|
||||
new g_cmdMisc[MAX_CMDS*MAX_CMDS_LAYERS][2]
|
||||
new g_cmdNum[MAX_CMDS_LAYERS]
|
||||
|
||||
new g_cvarNames[MAX_CVARS][32]
|
||||
new g_cvarMisc[MAX_CVARS][3]
|
||||
new g_cvarCmd[MAX_CVARS*5][32]
|
||||
new g_cvarCmdNum
|
||||
new g_cvarNum
|
||||
|
||||
new g_menuPosition[33]
|
||||
new g_menuSelect[33][MAX_CMDS]
|
||||
new g_menuSelectNum[33]
|
||||
new g_menuLayer[33]
|
||||
|
||||
new g_coloredMenus
|
||||
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Commands Menu", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("cmdmenu.txt")
|
||||
register_dictionary("common.txt")
|
||||
|
||||
new configsDir[64], config[64]
|
||||
get_configsdir(configsDir, 63)
|
||||
|
||||
for (new a = 0; a < MAX_CMDS_LAYERS; ++a)
|
||||
{
|
||||
new MenuName[64]
|
||||
|
||||
format(MenuName, 63, "%L", "en", g_cmdMenuName[a])
|
||||
register_menucmd(register_menuid(MenuName), 1023, "actionCmdMenu")
|
||||
register_clcmd(g_cmdMenuCmd[a], "cmdCmdMenu", ADMIN_MENU, g_cmdMenuHelp[a])
|
||||
format(config, 63, "%s/%s", configsDir, g_cmdMenuCfg[a])
|
||||
loadCmdSettings(config, a)
|
||||
}
|
||||
|
||||
register_menucmd(register_menuid("Cvars Menu"), 1023, "actionCvarMenu")
|
||||
register_clcmd("amx_cvarmenu", "cmdCvarMenu", ADMIN_CVAR, "- displays cvars menu")
|
||||
|
||||
new cvars_ini_file[64];
|
||||
format(cvars_ini_file, 63, "%s/%s", configsDir, "cvars.ini");
|
||||
loadCvarSettings(cvars_ini_file)
|
||||
|
||||
g_coloredMenus = colored_menus()
|
||||
}
|
||||
|
||||
#if defined PRECACHE_SPEECHINI
|
||||
public plugin_precache( )
|
||||
{
|
||||
new configsDir[64], config[64];
|
||||
get_configsdir( configsDir, 63 );
|
||||
formatex( config, 63, "%s/%s", configsDir, "speech.ini" );
|
||||
|
||||
new fp = fopen( config, "rt" ); // Read file as text
|
||||
|
||||
if ( ! fp ) // File doesn't exists
|
||||
return 0;
|
||||
|
||||
new szText[256];
|
||||
new line = 0;
|
||||
new szName[32], szSound[128], sndExt[5];
|
||||
new field1[32], field2[64], field3[64];
|
||||
new fieldNums = 0;
|
||||
|
||||
while ( line < MAX_CMDS && ! feof( fp ) ) // Loop till MAX_CMDS or EOF
|
||||
{
|
||||
fgets( fp, szText, 255 ); // Store line content
|
||||
|
||||
/* Strips newline */
|
||||
new len = strlen( szText );
|
||||
if ( len != 0 && szText[len-1] == '^n' ) // len != 0 because if the last line of the file is empty, there's no newline
|
||||
szText[--len] = 0;
|
||||
|
||||
if ( len == 0 || szText[0] == ';' || szText[0] == '/' ) // Line is empty or a comment
|
||||
continue;
|
||||
|
||||
parse( szText, szName, 31, szSound, 127 );
|
||||
fieldNums = parse( szSound, field1, 31, field2, 63, field3, 63 );
|
||||
if ( fieldNums == 2 && field1[0] == 's' ) // .wav (spk)
|
||||
{
|
||||
copy( szSound, 127, field2 );
|
||||
copy( sndExt, 4, ".wav" );
|
||||
}
|
||||
else if ( fieldNums == 3 && field1[0] == 'm' && ( field2[0] == 'p' || field2[0] == 'l' ) ) // .mp3 (mp3 play | mp3 loop)
|
||||
{
|
||||
copy( szSound, 127, field3 );
|
||||
copy( sndExt, 4, ".mp3" );
|
||||
}
|
||||
else // WTH is this sound, drop it.
|
||||
continue;
|
||||
|
||||
replace_all( szSound, 127, "\'", "" ); // Strips all ugly (and sometimes useless) \'
|
||||
|
||||
if ( szSound[0] == '/' )
|
||||
replace( szSound, 127, "/", "" ); // Strip leading slash
|
||||
|
||||
if ( sndExt[1] == 'm' || ( ! equali( szSound, "vox", 3 ) && ! equali( szSound, "fvox", 4 ) && ! equali( szSound, "barney", 6 ) && ! equali( szSound, "hgrunt", 6 ) ) )
|
||||
{
|
||||
// SzSound is a mp3, or a custom wav (not a vox, fvox, or default sound from HL pak)
|
||||
if ( !equali( szSound[strlen(szSound)-4], sndExt ) )
|
||||
add( szSound, 127, sndExt ); // Add filetype extension if it isn't already specified
|
||||
if ( sndExt[1] == 'w' )
|
||||
format( szSound, 127, "sound/%s", szSound ); // spk basedir is $moddir/sound, but mp3 play is $moddir, fix this for the file_exists check
|
||||
if ( file_exists( szSound ) )
|
||||
{
|
||||
if ( sndExt[1] == 'm')
|
||||
{
|
||||
precache_generic( szSound ); // mp3
|
||||
}
|
||||
else
|
||||
{
|
||||
replace( szSound, 127, "sound/", "" ); // wav, strip the leading sound/ we added for our file_exists check
|
||||
precache_sound( szSound );
|
||||
}
|
||||
}
|
||||
}
|
||||
line++
|
||||
}
|
||||
fclose( fp ); // Close file
|
||||
return line;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Commands menu */
|
||||
|
||||
public actionCmdMenu(id, key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case 8: displayCmdMenu(id, ++g_menuPosition[id])
|
||||
case 9: displayCmdMenu(id, --g_menuPosition[id])
|
||||
default:
|
||||
{
|
||||
new option = g_menuSelect[id][g_menuPosition[id] * 8 + key]
|
||||
new flags = g_cmdMisc[option][1]
|
||||
|
||||
if (flags & 1)
|
||||
server_cmd("%s", g_cmdCmd[option])
|
||||
else if (flags & 2)
|
||||
client_cmd(id, "%s", g_cmdCmd[option])
|
||||
else if (flags & 4)
|
||||
client_cmd(0, "%s", g_cmdCmd[option])
|
||||
|
||||
if (flags & 8)
|
||||
displayCmdMenu(id, g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayCmdMenu(id, pos)
|
||||
{
|
||||
if (pos < 0)
|
||||
return
|
||||
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new start = pos * 8
|
||||
|
||||
if (start >= g_menuSelectNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new limit = (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8)))
|
||||
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, g_cmdMenuName[g_menuLayer[id]], pos + 1, (limit == 0) ? 1 : limit)
|
||||
new end = start + 8
|
||||
new keys = MENU_KEY_0
|
||||
|
||||
if (end > g_menuSelectNum[id])
|
||||
end = g_menuSelectNum[id]
|
||||
|
||||
for (new a = start; a < end; ++a)
|
||||
{
|
||||
if (g_cmdCmd[g_menuSelect[id][a]][0] == '-')
|
||||
{
|
||||
if (g_coloredMenus)
|
||||
len += format(menuBody[len], 511-len, "\d%s^n\w", g_cmdName[g_menuSelect[id][a]])
|
||||
else
|
||||
len += format(menuBody[len], 511-len, "%s^n", g_cmdName[g_menuSelect[id][a]])
|
||||
++b
|
||||
} else {
|
||||
keys |= (1<<b)
|
||||
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_cmdName[g_menuSelect[id][a]])
|
||||
}
|
||||
}
|
||||
|
||||
if (end != g_menuSelectNum[id])
|
||||
{
|
||||
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||
keys |= MENU_KEY_9
|
||||
}
|
||||
else
|
||||
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||
|
||||
new MenuName[64]
|
||||
|
||||
format(MenuName, 63, "%L", "en", g_cmdMenuName[g_menuLayer[id]])
|
||||
show_menu(id, keys, menuBody, -1, MenuName)
|
||||
}
|
||||
|
||||
public cmdCmdMenu(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 1))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new szCmd[32]
|
||||
read_argv(0, szCmd, 31)
|
||||
new lvl = 0
|
||||
|
||||
while (lvl < MAX_CMDS_LAYERS)
|
||||
{
|
||||
if (equal(g_cmdMenuCmd[lvl], szCmd))
|
||||
break
|
||||
++lvl
|
||||
}
|
||||
|
||||
g_menuLayer[id] = lvl
|
||||
g_menuSelectNum[id] = 0
|
||||
|
||||
new a = lvl * MAX_CMDS
|
||||
new d, c = 0
|
||||
|
||||
while (c < g_cmdNum[lvl])
|
||||
{
|
||||
d = a + c
|
||||
|
||||
if (access(id, g_cmdMisc[d][0]))
|
||||
{
|
||||
g_menuSelect[id][g_menuSelectNum[id]++] = d
|
||||
}
|
||||
|
||||
++c
|
||||
}
|
||||
|
||||
displayCmdMenu(id, g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
loadCmdSettings(szFilename[], level)
|
||||
{
|
||||
if (!file_exists(szFilename))
|
||||
return 0
|
||||
|
||||
new text[256], szFlags[32], szAccess[32]
|
||||
new a, pos = 0, c, d = level * MAX_CMDS
|
||||
|
||||
while (g_cmdNum[level] < MAX_CMDS && read_file(szFilename, pos++, text, 255, a))
|
||||
{
|
||||
if (text[0] == ';') continue
|
||||
c = d + g_cmdNum[level]
|
||||
|
||||
if (parse(text, g_cmdName[c], 31, g_cmdCmd[c], 63, szFlags, 31, szAccess, 31) > 3)
|
||||
{
|
||||
while (replace(g_cmdCmd[c], 63, "\'", "^""))
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
g_cmdMisc[c][1] = read_flags(szFlags)
|
||||
g_cmdMisc[c][0] = read_flags(szAccess)
|
||||
g_cmdNum[level]++
|
||||
}
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
/* Cvars menu */
|
||||
|
||||
public actionCvarMenu(id, key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case 8: displayCvarMenu(id, ++g_menuPosition[id])
|
||||
case 9: displayCvarMenu(id, --g_menuPosition[id])
|
||||
default:
|
||||
{
|
||||
new option = g_menuSelect[id][g_menuPosition[id] * 8 + key]
|
||||
new szValue[32]
|
||||
|
||||
get_cvar_string(g_cvarNames[option], szValue, 31)
|
||||
|
||||
new end = g_cvarMisc[option][2]
|
||||
new start = g_cvarMisc[option][1]
|
||||
|
||||
for (new i = start; ; ++i)
|
||||
{
|
||||
if (i < end)
|
||||
{
|
||||
if (equal(szValue, g_cvarCmd[i]))
|
||||
{
|
||||
if (++i >= end)
|
||||
{
|
||||
i = start
|
||||
}
|
||||
|
||||
set_cvar_string(g_cvarNames[option], g_cvarCmd[i])
|
||||
break
|
||||
}
|
||||
} else {
|
||||
set_cvar_string(g_cvarNames[option], g_cvarCmd[start])
|
||||
break
|
||||
}
|
||||
}
|
||||
displayCvarMenu(id, g_menuPosition[id])
|
||||
}
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
displayCvarMenu(id, pos)
|
||||
{
|
||||
if (pos < 0)
|
||||
return
|
||||
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new start = pos * 8
|
||||
|
||||
if (start >= g_menuSelectNum[id])
|
||||
start = pos = g_menuPosition[id] = 0
|
||||
|
||||
new len = format(menuBody, 511, g_coloredMenus ? "\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n", pos + 1, (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0)))
|
||||
|
||||
new end = start + 8
|
||||
new keys = MENU_KEY_0
|
||||
new szValue[64]
|
||||
|
||||
if (end > g_menuSelectNum[id])
|
||||
end = g_menuSelectNum[id]
|
||||
|
||||
for (new a = start; a < end; ++a)
|
||||
{
|
||||
get_cvar_string(g_cvarNames[g_menuSelect[id][a]], szValue, 31)
|
||||
keys |= (1<<b)
|
||||
++b
|
||||
|
||||
if (g_coloredMenus)
|
||||
len += format(menuBody[len], 511-len, "%d. %s\R%s^n\w", b, g_cvarNames[g_menuSelect[id][a]], szValue)
|
||||
else
|
||||
len += format(menuBody[len], 511-len, "%d. %s %s^n", b, g_cvarNames[g_menuSelect[id][a]], szValue)
|
||||
}
|
||||
|
||||
if (end != g_menuSelectNum[id])
|
||||
{
|
||||
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||
keys |= MENU_KEY_9
|
||||
}
|
||||
else
|
||||
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||
|
||||
show_menu(id, keys, menuBody)
|
||||
}
|
||||
|
||||
public cmdCvarMenu(id, level, cid)
|
||||
{
|
||||
if (!cmd_access(id, level, cid, 1))
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
g_menuSelectNum[id] = 0
|
||||
|
||||
for (new a = 0; a < g_cvarNum; ++a)
|
||||
if (access(id, g_cvarMisc[a][0]))
|
||||
g_menuSelect[id][g_menuSelectNum[id]++] = a
|
||||
|
||||
displayCvarMenu(id, g_menuPosition[id] = 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
loadCvarSettings(szFilename[])
|
||||
{
|
||||
if (!file_exists(szFilename))
|
||||
return 0
|
||||
|
||||
new text[256], szValues[12][32]
|
||||
new inum, a, pos = 0
|
||||
new cvar_values = MAX_CVARS * 5
|
||||
|
||||
// a b c d
|
||||
while (g_cvarNum < MAX_CVARS && read_file(szFilename, pos++, text, 255, a))
|
||||
{
|
||||
if (text[0] == ';') continue
|
||||
|
||||
inum = parse(text, g_cvarNames[g_cvarNum], 31,
|
||||
szValues[0], 31, szValues[1], 31, szValues[2], 31,
|
||||
szValues[3], 31, szValues[4], 31, szValues[5], 31,
|
||||
szValues[6], 31, szValues[7], 31, szValues[8], 31,
|
||||
szValues[9], 31, szValues[10], 31, szValues[11], 31)
|
||||
|
||||
inum -= 2
|
||||
if (inum < 2) continue
|
||||
g_cvarMisc[g_cvarNum][1] = g_cvarCmdNum
|
||||
|
||||
for (a = 0; a < inum && g_cvarCmdNum < cvar_values; ++a)
|
||||
{
|
||||
while (replace(szValues[a], 31, "\'", "^""))
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
copy(g_cvarCmd[g_cvarCmdNum], 31, szValues[a])
|
||||
g_cvarCmdNum++
|
||||
}
|
||||
|
||||
g_cvarMisc[g_cvarNum][2] = g_cvarCmdNum
|
||||
g_cvarMisc[g_cvarNum][0] = read_flags(szValues[inum])
|
||||
g_cvarNum++
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# AMX Mod X
|
||||
#
|
||||
# by the AMX Mod X Development Team
|
||||
# originally developed by OLO
|
||||
#
|
||||
# This file is part of AMX Mod X.
|
||||
|
||||
# new code contributed by \malex\
|
||||
|
||||
test -e compiled || mkdir compiled
|
||||
rm -f temp.txt
|
||||
|
||||
# Choose compiler binary
|
||||
if test `uname` = "Darwin"; then
|
||||
pc=./amxxpc_osx
|
||||
else
|
||||
pc=./amxxpc
|
||||
fi
|
||||
|
||||
for sourcefile in *.sma
|
||||
do
|
||||
amxxfile="`echo $sourcefile | sed -e 's/\.sma$/.amxx/'`"
|
||||
echo -n "Compiling $sourcefile ..."
|
||||
$pc $sourcefile -ocompiled/$amxxfile >> temp.txt
|
||||
echo "done"
|
||||
done
|
||||
|
||||
less temp.txt
|
||||
rm temp.txt
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
/* AMX Mod X
|
||||
* Rank Calculation
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
/* File location: $moddir/addons/amxmodx/data/csstats.amxx */
|
||||
|
||||
#include <amxmodx>
|
||||
|
||||
/* Function calculates position in rank.
|
||||
*
|
||||
* Stats:
|
||||
* 0 - kills
|
||||
* 1 - deaths
|
||||
* 2 - headshots
|
||||
* 3 - teamkills
|
||||
* 4 - shots
|
||||
* 5 - hits
|
||||
* 6 - damage
|
||||
* 7 - defusions
|
||||
* 8 - defused
|
||||
* 9 - plants
|
||||
* 10 - explosions
|
||||
*
|
||||
* Returning cellmin as value in get_score function
|
||||
* makes that rank won't be saved. */
|
||||
|
||||
public get_score(stats[11], body[8])
|
||||
return stats[0] - stats[1] - stats[3] // kills - deaths - teamkills
|
||||
@@ -0,0 +1,143 @@
|
||||
/* AMX Mod X
|
||||
* Info. Messages Plugin
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is part of AMX Mod X.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
|
||||
#define X_POS -1.0
|
||||
#define Y_POS 0.20
|
||||
#define HOLD_TIME 12.0
|
||||
|
||||
new Array:g_Values
|
||||
new Array:g_Messages
|
||||
new g_MessagesNum
|
||||
new g_Current
|
||||
|
||||
#define charsof(%1) (sizeof(%1)-1)
|
||||
|
||||
new amx_freq_imessage;
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
g_Messages=ArrayCreate(384);
|
||||
g_Values=ArrayCreate(3);
|
||||
register_plugin("Info. Messages", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
register_dictionary("imessage.txt")
|
||||
register_dictionary("common.txt")
|
||||
register_srvcmd("amx_imessage", "setMessage")
|
||||
amx_freq_imessage=register_cvar("amx_freq_imessage", "10")
|
||||
|
||||
new lastinfo[8]
|
||||
get_localinfo("lastinfomsg", lastinfo, 7)
|
||||
g_Current = str_to_num(lastinfo)
|
||||
set_localinfo("lastinfomsg", "")
|
||||
}
|
||||
|
||||
public infoMessage()
|
||||
{
|
||||
if (g_Current >= g_MessagesNum)
|
||||
g_Current = 0
|
||||
|
||||
// No messages, just get out of here
|
||||
if (g_MessagesNum==0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new values[3];
|
||||
new Message[384];
|
||||
|
||||
ArrayGetString(g_Messages, g_Current, Message, charsof(Message));
|
||||
ArrayGetArray(g_Values, g_Current, values);
|
||||
|
||||
new hostname[64];
|
||||
|
||||
get_cvar_string("hostname", hostname, 63);
|
||||
replace(Message, 380, "%hostname%", hostname);
|
||||
|
||||
set_hudmessage(values[0], values[1], values[2], X_POS, Y_POS, 0, 0.5, HOLD_TIME, 2.0, 2.0, -1);
|
||||
|
||||
show_hudmessage(0, "%s", Message);
|
||||
|
||||
client_print(0, print_console, "%s", Message);
|
||||
++g_Current;
|
||||
|
||||
new Float:freq_im = get_pcvar_float(amx_freq_imessage);
|
||||
|
||||
if (freq_im > 0.0)
|
||||
set_task(freq_im, "infoMessage", 12345);
|
||||
}
|
||||
|
||||
public setMessage()
|
||||
{
|
||||
|
||||
new Message[384];
|
||||
|
||||
remove_task(12345)
|
||||
read_argv(1, Message, 380)
|
||||
|
||||
while (replace(Message, 380, "\n", "^n")) {}
|
||||
|
||||
new mycol[12]
|
||||
new vals[3];
|
||||
|
||||
read_argv(2, mycol, 11) // RRRGGGBBB
|
||||
vals[2] = str_to_num(mycol[6])
|
||||
|
||||
mycol[6] = 0
|
||||
vals[1] = str_to_num(mycol[3])
|
||||
|
||||
mycol[3] = 0
|
||||
vals[0] = str_to_num(mycol[0])
|
||||
|
||||
g_MessagesNum++
|
||||
|
||||
new Float:freq_im = get_pcvar_float(amx_freq_imessage)
|
||||
|
||||
ArrayPushString(g_Messages, Message);
|
||||
ArrayPushArray(g_Values, vals);
|
||||
|
||||
if (freq_im > 0.0)
|
||||
set_task(freq_im, "infoMessage", 12345)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public plugin_end()
|
||||
{
|
||||
new lastinfo[8]
|
||||
|
||||
num_to_str(g_Current, lastinfo, 7)
|
||||
set_localinfo("lastinfomsg", lastinfo)
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
/* AMX Mod X constants
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _amxconst_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _amxconst_included
|
||||
|
||||
#include <svn_version>
|
||||
|
||||
#define M_PI 3.1415926535
|
||||
|
||||
#define ADMIN_ALL 0 /* everyone */
|
||||
#define ADMIN_IMMUNITY (1<<0) /* flag "a" */
|
||||
#define ADMIN_RESERVATION (1<<1) /* flag "b" */
|
||||
#define ADMIN_KICK (1<<2) /* flag "c" */
|
||||
#define ADMIN_BAN (1<<3) /* flag "d" */
|
||||
#define ADMIN_SLAY (1<<4) /* flag "e" */
|
||||
#define ADMIN_MAP (1<<5) /* flag "f" */
|
||||
#define ADMIN_CVAR (1<<6) /* flag "g" */
|
||||
#define ADMIN_CFG (1<<7) /* flag "h" */
|
||||
#define ADMIN_CHAT (1<<8) /* flag "i" */
|
||||
#define ADMIN_VOTE (1<<9) /* flag "j" */
|
||||
#define ADMIN_PASSWORD (1<<10) /* flag "k" */
|
||||
#define ADMIN_RCON (1<<11) /* flag "l" */
|
||||
#define ADMIN_LEVEL_A (1<<12) /* flag "m" */
|
||||
#define ADMIN_LEVEL_B (1<<13) /* flag "n" */
|
||||
#define ADMIN_LEVEL_C (1<<14) /* flag "o" */
|
||||
#define ADMIN_LEVEL_D (1<<15) /* flag "p" */
|
||||
#define ADMIN_LEVEL_E (1<<16) /* flag "q" */
|
||||
#define ADMIN_LEVEL_F (1<<17) /* flag "r" */
|
||||
#define ADMIN_LEVEL_G (1<<18) /* flag "s" */
|
||||
#define ADMIN_LEVEL_H (1<<19) /* flag "t" */
|
||||
#define ADMIN_MENU (1<<20) /* flag "u" */
|
||||
#define ADMIN_ADMIN (1<<24) /* flag "y" */
|
||||
#define ADMIN_USER (1<<25) /* flag "z" */
|
||||
|
||||
#define FLAG_KICK (1<<0) /* flag "a" */
|
||||
#define FLAG_TAG (1<<1) /* flag "b" */
|
||||
#define FLAG_AUTHID (1<<2) /* flag "c" */
|
||||
#define FLAG_IP (1<<3) /* flag "d" */
|
||||
#define FLAG_NOPASS (1<<4) /* flag "e" */
|
||||
#define FLAG_CASE_SENSITIVE (1<<10) /* flag "k" */
|
||||
|
||||
#define PLUGIN_CONTINUE 0 /* Results returned by public functions */
|
||||
#define PLUGIN_HANDLED 1 /* stop other plugins */
|
||||
#define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */
|
||||
|
||||
/* Flags for register_cvar() */
|
||||
#define FCVAR_ARCHIVE 1 /* set to cause it to be saved to vars.rc */
|
||||
#define FCVAR_USERINFO 2 /* changes the client's info string */
|
||||
#define FCVAR_SERVER 4 /* notifies players when changed */
|
||||
#define FCVAR_EXTDLL 8 /* defined by external DLL */
|
||||
#define FCVAR_CLIENTDLL 16 /* defined by the client dll */
|
||||
#define FCVAR_PROTECTED 32 /* It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value */
|
||||
#define FCVAR_SPONLY 64 /* This cvar cannot be changed by clients connected to a multiplayer server. */
|
||||
#define FCVAR_PRINTABLEONLY 128 /* This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). */
|
||||
#define FCVAR_UNLOGGED 256 /* If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log */
|
||||
|
||||
|
||||
/* Id of weapons in CS */
|
||||
#define CSW_P228 1
|
||||
#define CSW_SCOUT 3
|
||||
#define CSW_HEGRENADE 4
|
||||
#define CSW_XM1014 5
|
||||
#define CSW_C4 6
|
||||
#define CSW_MAC10 7
|
||||
#define CSW_AUG 8
|
||||
#define CSW_SMOKEGRENADE 9
|
||||
#define CSW_ELITE 10
|
||||
#define CSW_FIVESEVEN 11
|
||||
#define CSW_UMP45 12
|
||||
#define CSW_SG550 13
|
||||
#define CSW_GALI 14
|
||||
#define CSW_GALIL 14
|
||||
#define CSW_FAMAS 15
|
||||
#define CSW_USP 16
|
||||
#define CSW_GLOCK18 17
|
||||
#define CSW_AWP 18
|
||||
#define CSW_MP5NAVY 19
|
||||
#define CSW_M249 20
|
||||
#define CSW_M3 21
|
||||
#define CSW_M4A1 22
|
||||
#define CSW_TMP 23
|
||||
#define CSW_G3SG1 24
|
||||
#define CSW_FLASHBANG 25
|
||||
#define CSW_DEAGLE 26
|
||||
#define CSW_SG552 27
|
||||
#define CSW_AK47 28
|
||||
#define CSW_KNIFE 29
|
||||
#define CSW_P90 30
|
||||
#define CSW_VEST 31
|
||||
#define CSW_VESTHELM 32
|
||||
|
||||
#define HIW_BERETTA 1
|
||||
#define HIW_SPAS12 2
|
||||
#define HIW_M4A1 3
|
||||
#define HIW_MP5A4 4
|
||||
#define HIW_MP5SD5 5
|
||||
#define HIW_AK47 6
|
||||
#define HIW_AKS74U 7
|
||||
#define HIW_GLOCK 8
|
||||
#define HIW_M11 9
|
||||
#define HIW_M11SD 10
|
||||
#define HIW_PSG1 11
|
||||
#define HIW_ZASTAVA 12
|
||||
#define HIW_M16A2 13
|
||||
#define HIW_REMINGTON 14
|
||||
#define HIW_NATOGREN 15
|
||||
#define HIW_TANGOGREN 16
|
||||
#define HIW_FLASHBANG 17
|
||||
|
||||
/* Parts of body for hits */
|
||||
#define HIT_GENERIC 0 /* none */
|
||||
#define HIT_HEAD 1
|
||||
#define HIT_CHEST 2
|
||||
#define HIT_STOMACH 3
|
||||
#define HIT_LEFTARM 4
|
||||
#define HIT_RIGHTARM 5
|
||||
#define HIT_LEFTLEG 6
|
||||
#define HIT_RIGHTLEG 7
|
||||
|
||||
/* Constants for emit_sound() */
|
||||
/* Channels */
|
||||
#define CHAN_AUTO 0
|
||||
#define CHAN_WEAPON 1
|
||||
#define CHAN_VOICE 2
|
||||
#define CHAN_ITEM 3
|
||||
#define CHAN_BODY 4
|
||||
#define CHAN_STREAM 5 /* allocate stream channel from the static or dynamic area */
|
||||
#define CHAN_STATIC 6 /* allocate channel from the static area */
|
||||
#define CHAN_NETWORKVOICE_BASE 7 /* voice data coming across the network */
|
||||
#define CHAN_NETWORKVOICE_END 500 /* network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). */
|
||||
|
||||
/* Attenuation values */
|
||||
#define ATTN_NONE 0.00
|
||||
#define ATTN_NORM 0.80
|
||||
#define ATTN_IDLE 2.00
|
||||
#define ATTN_STATIC 1.25
|
||||
|
||||
/* Pitch values */
|
||||
#define PITCH_NORM 100 /* non-pitch shifted */
|
||||
#define PITCH_LOW 95 /* other values are possible - 0-255, where 255 is very high */
|
||||
#define PITCH_HIGH 120
|
||||
|
||||
/* Volume values */
|
||||
#define VOL_NORM 1.0
|
||||
|
||||
/* Menu keys */
|
||||
#define MENU_KEY_1 (1<<0)
|
||||
#define MENU_KEY_2 (1<<1)
|
||||
#define MENU_KEY_3 (1<<2)
|
||||
#define MENU_KEY_4 (1<<3)
|
||||
#define MENU_KEY_5 (1<<4)
|
||||
#define MENU_KEY_6 (1<<5)
|
||||
#define MENU_KEY_7 (1<<6)
|
||||
#define MENU_KEY_8 (1<<7)
|
||||
#define MENU_KEY_9 (1<<8)
|
||||
#define MENU_KEY_0 (1<<9)
|
||||
|
||||
#define LANG_SERVER 0
|
||||
#define LANG_PLAYER -1
|
||||
|
||||
/* Destination types for client_print() */
|
||||
enum {
|
||||
print_notify = 1,
|
||||
print_console,
|
||||
print_chat,
|
||||
print_center,
|
||||
};
|
||||
|
||||
/* Destination types for engclient_print() */
|
||||
enum {
|
||||
engprint_console = 0,
|
||||
engprint_center,
|
||||
engprint_chat,
|
||||
};
|
||||
|
||||
/* Render for set_user_rendering() */
|
||||
enum {
|
||||
kRenderNormal = 0, /* src */
|
||||
kRenderTransColor, /* c*a+dest*(1-a) */
|
||||
kRenderTransTexture, /* src*a+dest*(1-a) */
|
||||
kRenderGlow, /* src*a+dest -- No Z buffer checks */
|
||||
kRenderTransAlpha, /* src*srca+dest*(1-srca) */
|
||||
kRenderTransAdd, /* src*a+dest */
|
||||
};
|
||||
|
||||
/* Fx for set_user_rendering() */
|
||||
enum {
|
||||
kRenderFxNone = 0,
|
||||
kRenderFxPulseSlow,
|
||||
kRenderFxPulseFast,
|
||||
kRenderFxPulseSlowWide,
|
||||
kRenderFxPulseFastWide,
|
||||
kRenderFxFadeSlow,
|
||||
kRenderFxFadeFast,
|
||||
kRenderFxSolidSlow,
|
||||
kRenderFxSolidFast,
|
||||
kRenderFxStrobeSlow,
|
||||
kRenderFxStrobeFast,
|
||||
kRenderFxStrobeFaster,
|
||||
kRenderFxFlickerSlow,
|
||||
kRenderFxFlickerFast,
|
||||
kRenderFxNoDissipation,
|
||||
kRenderFxDistort, /* Distort/scale/translate flicker */
|
||||
kRenderFxHologram, /* kRenderFxDistort + distance fade */
|
||||
kRenderFxDeadPlayer, /* kRenderAmt is the player index */
|
||||
kRenderFxExplode, /* Scale up really big! */
|
||||
kRenderFxGlowShell, /* Glowing Shell */
|
||||
kRenderFxClampMinScale, /* Keep this sprite from getting very small (SPRITES only!) */
|
||||
};
|
||||
|
||||
/* Type for force_unmodified() */
|
||||
enum {
|
||||
force_exactfile = 0, /* File on client must exactly match server's file */
|
||||
force_model_samebounds, /* For model files only, the geometry must fit in the same bbox */
|
||||
force_model_specifybounds, /* For model files only, the geometry must fit in the specified bbox */
|
||||
};
|
||||
|
||||
/* Status for get_module() */
|
||||
enum {
|
||||
module_none = 0,
|
||||
module_query,
|
||||
module_badload,
|
||||
module_loaded,
|
||||
module_noinfo,
|
||||
module_noquery,
|
||||
module_noattach,
|
||||
module_old,
|
||||
};
|
||||
|
||||
#define AMX_FLAG_DEBUG 0x02 /* symbolic info. available */
|
||||
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */
|
||||
#define AMX_FLAG_BYTEOPC 0x08 /* opcode is a byte (not a cell) */
|
||||
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no STMT opcode */
|
||||
#define AMX_FLAG_OLDFILE 0x20 /* Old AMX Mod plugin */
|
||||
#define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */
|
||||
#define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */
|
||||
#define AMX_FLAG_BROWSE 0x4000 /* busy browsing */
|
||||
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
|
||||
|
||||
#define INVALID_PLUGIN_ID -1
|
||||
|
||||
#define MENU_EXIT -3
|
||||
#define MENU_BACK -2
|
||||
#define MENU_MORE -1
|
||||
#define ITEM_IGNORE 0
|
||||
#define ITEM_ENABLED 1
|
||||
#define ITEM_DISABLED 2
|
||||
|
||||
#define AMX_ERR_NATIVE 10
|
||||
#define AMX_ERR_MEMACCESS 5
|
||||
#define AMX_ERR_NONE 0
|
||||
#define AMX_ERR_BOUNDS 4
|
||||
#define AMX_ERR_STACKERR 3
|
||||
#define AMX_ERR_STACKLOW 7
|
||||
#define AMX_ERR_HEAPLOW 8
|
||||
#define AMX_ERR_DIVIDE 11
|
||||
#define AMX_ERR_NOTFOUND 19
|
||||
#define AMX_ERR_PARAMS 25
|
||||
#define AMX_ERR_GENERAL 27
|
||||
|
||||
#define INVALID_HANDLE -1
|
||||
|
||||
#define ET_IGNORE 0 //ignore return val
|
||||
#define ET_STOP 1 //stop on PLUGIN_HANDLED
|
||||
#define ET_STOP2 2 //same, except return biggest
|
||||
#define ET_CONTINUE 3 //no stop, return biggest
|
||||
|
||||
#define FP_CELL 0
|
||||
#define FP_FLOAT 1
|
||||
#define FP_STRING 2
|
||||
#define FP_ARRAY 4
|
||||
|
||||
#define FORWARD_ONLY_OLD 1
|
||||
#define FORWARD_ONLY_NEW 2
|
||||
#define FORWARD_ALL 3
|
||||
|
||||
#define SND_SPAWNING (1<<8) // we're spawing, used in some cases for ambients
|
||||
#define SND_STOP (1<<5) // stop sound
|
||||
#define SND_CHANGE_VOL (1<<6) // change sound vol
|
||||
#define SND_CHANGE_PITCH (1<<7) // change sound pitch
|
||||
|
||||
enum LibType
|
||||
{
|
||||
LibType_Library,
|
||||
LibType_Class
|
||||
};
|
||||
|
||||
enum AdminProp
|
||||
{
|
||||
AdminProp_Auth = 0,
|
||||
AdminProp_Password,
|
||||
AdminProp_Access,
|
||||
AdminProp_Flags
|
||||
};
|
||||
@@ -0,0 +1,622 @@
|
||||
/* AMX Mod X misc.
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _amxmisc_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _amxmisc_included
|
||||
|
||||
#if !defined _amxmodx_included
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
#include <amxmod>
|
||||
#else
|
||||
#include <amxmodx>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
#if defined _translator_included
|
||||
#define SIMPLE_T(%1) _T(%1)
|
||||
#else
|
||||
#define SIMPLE_T(%1) %1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
stock is_user_admin(id)
|
||||
{
|
||||
new __flags=get_user_flags(id);
|
||||
return (__flags>0 && !(__flags&ADMIN_USER));
|
||||
}
|
||||
|
||||
stock cmd_access(id, level, cid, num, bool:accesssilent = false)
|
||||
{
|
||||
new has_access = 0;
|
||||
if ( id==(is_dedicated_server()?0:1) )
|
||||
{
|
||||
has_access = 1;
|
||||
}
|
||||
else if ( level==ADMIN_ADMIN )
|
||||
{
|
||||
if ( is_user_admin(id) )
|
||||
{
|
||||
has_access = 1;
|
||||
}
|
||||
}
|
||||
else if ( get_user_flags(id) & level )
|
||||
{
|
||||
has_access = 1;
|
||||
}
|
||||
else if (level == ADMIN_ALL)
|
||||
{
|
||||
has_access = 1;
|
||||
}
|
||||
|
||||
if ( has_access==0 )
|
||||
{
|
||||
if (!accesssilent)
|
||||
{
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
console_print(id, SIMPLE_T("You have no access to that command."));
|
||||
#else
|
||||
console_print(id,"%L",id,"NO_ACC_COM");
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (read_argc() < num)
|
||||
{
|
||||
new hcmd[32], hinfo[128], hflag;
|
||||
get_concmd(cid,hcmd,31,hflag,hinfo,127,level);
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
console_print(id, SIMPLE_T("Usage: %s %s"), hcmd, SIMPLE_T(hinfo));
|
||||
#else
|
||||
console_print(id,"%L: %s %s",id,"USAGE",hcmd,hinfo);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock access(id,level)
|
||||
{
|
||||
if (level==ADMIN_ADMIN)
|
||||
{
|
||||
return is_user_admin(id);
|
||||
}
|
||||
else if (level==ADMIN_ALL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (get_user_flags(id) & level);
|
||||
}
|
||||
|
||||
/* Flags:
|
||||
* 1 - obey immunity
|
||||
* 2 - allow yourself
|
||||
* 4 - must be alive
|
||||
* 8 - can't be bot */
|
||||
#define CMDTARGET_OBEY_IMMUNITY (1<<0)
|
||||
#define CMDTARGET_ALLOW_SELF (1<<1)
|
||||
#define CMDTARGET_ONLY_ALIVE (1<<2)
|
||||
#define CMDTARGET_NO_BOTS (1<<3)
|
||||
stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
|
||||
{
|
||||
new player = find_player("bl",arg);
|
||||
if (player)
|
||||
{
|
||||
if ( player != find_player("blj",arg) )
|
||||
{
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
console_print(id, SIMPLE_T("There are more clients matching to your argument"));
|
||||
#else
|
||||
console_print(id,"%L",id,"MORE_CL_MATCHT");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if ( ( player = find_player("c",arg) )==0 && arg[0]=='#' && arg[1] )
|
||||
{
|
||||
player = find_player("k",str_to_num(arg[1]));
|
||||
}
|
||||
if (!player)
|
||||
{
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
console_print(id, SIMPLE_T("Client with that name or userid not found"));
|
||||
#else
|
||||
console_print(id,"%L",id,"CL_NOT_FOUND");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (flags & CMDTARGET_OBEY_IMMUNITY)
|
||||
{
|
||||
if ((get_user_flags(player) & ADMIN_IMMUNITY) &&
|
||||
((flags & CMDTARGET_ALLOW_SELF) ? (id != player) : true) )
|
||||
{
|
||||
new imname[32];
|
||||
get_user_name(player,imname,31);
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
console_print(id, SIMPLE_T("Client ^"%s^" has immunity"), imname);
|
||||
#else
|
||||
console_print(id,"%L",id,"CLIENT_IMM",imname);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (flags & CMDTARGET_ONLY_ALIVE)
|
||||
{
|
||||
if (!is_user_alive(player))
|
||||
{
|
||||
new imname[32];
|
||||
get_user_name(player,imname,31);
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
console_print(id, SIMPLE_T("That action can't be performed on dead client ^"%s^""), imname);
|
||||
#else
|
||||
console_print(id,"%L",id,"CANT_PERF_DEAD",imname);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (flags & CMDTARGET_NO_BOTS)
|
||||
{
|
||||
if (is_user_bot(player))
|
||||
{
|
||||
new imname[32];
|
||||
get_user_name(player,imname,31);
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
console_print(id, SIMPLE_T("That action can't be performed on bot ^"%s^""), imname);
|
||||
#else
|
||||
console_print(id,"%L",id,"CANT_PERF_BOT",imname);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard method to show activity to clients connected to the server.
|
||||
* This depends on the amx_show_activity cvar. See documentation for more details.
|
||||
*
|
||||
* @param id The user id of the person doing the action.
|
||||
* @param name The name of the person doing the action.
|
||||
* @param fmt The format string to display. Do not put the "ADMIN:" prefix in this.
|
||||
*/
|
||||
stock show_activity( id, const name[], const fmt[], any:... )
|
||||
{
|
||||
static __amx_show_activity;
|
||||
if (__amx_show_activity == 0)
|
||||
{
|
||||
__amx_show_activity = get_cvar_pointer("amx_show_activity");
|
||||
|
||||
// if still not found, then register the cvar as a dummy
|
||||
if (__amx_show_activity == 0)
|
||||
{
|
||||
__amx_show_activity = register_cvar("amx_show_activity", "2");
|
||||
}
|
||||
}
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
new buffer[128];
|
||||
format_args( buffer , 127 , 2 );
|
||||
#else
|
||||
new prefix[10];
|
||||
if (is_user_admin(id))
|
||||
{
|
||||
copy(prefix, charsmax(prefix), "ADMIN");
|
||||
}
|
||||
else
|
||||
{
|
||||
copy(prefix, charsmax(prefix), "PLAYER");
|
||||
}
|
||||
new buffer[512];
|
||||
vformat(buffer, charsmax(buffer), fmt, 4);
|
||||
#endif
|
||||
switch(get_pcvar_num(__amx_show_activity))
|
||||
{
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
case 2: // show name to all
|
||||
{
|
||||
client_print(0, print_chat, "%s %s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), name, buffer);
|
||||
}
|
||||
case 1: // hide name to all
|
||||
{
|
||||
client_print(0, print_chat, "%s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), buffer);
|
||||
}
|
||||
#else
|
||||
case 5: // hide name only to admins, show nothing to normal users
|
||||
{
|
||||
new __maxclients=get_maxplayers();
|
||||
|
||||
|
||||
for (new i=1; i<=__maxclients; i++)
|
||||
{
|
||||
if (is_user_connected(i))
|
||||
{
|
||||
if (is_user_admin(i))
|
||||
{
|
||||
client_print(i, print_chat, "%L: %s", i, prefix, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case 4: // show name only to admins, show nothing to normal users
|
||||
{
|
||||
new __maxclients=get_maxplayers();
|
||||
|
||||
for (new i=1; i<=__maxclients; i++)
|
||||
{
|
||||
if (is_user_connected(i))
|
||||
{
|
||||
if (is_user_admin(i))
|
||||
{
|
||||
client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case 3: // show name only to admins, hide name from normal users
|
||||
{
|
||||
new __maxclients=get_maxplayers();
|
||||
|
||||
for (new i=1; i<=__maxclients; i++)
|
||||
{
|
||||
if (is_user_connected(i))
|
||||
{
|
||||
if (is_user_admin(i))
|
||||
{
|
||||
client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
client_print(i, print_chat, "%L: %s", i, prefix, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case 2: // show name to all
|
||||
{
|
||||
client_print(0, print_chat, "%L %s: %s", LANG_PLAYER, prefix , name , buffer );
|
||||
}
|
||||
case 1: // hide name to all
|
||||
{
|
||||
client_print(0, print_chat, "%L: %s", LANG_PLAYER, prefix, buffer );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard method to show activity to one single client.
|
||||
* This is useful for messages that get pieced together by many language keys.
|
||||
* This depends on the amx_show_activity cvar. See documentation for more details.
|
||||
*
|
||||
* @param idtarget The user id of the person to display to. 0 is invalid.
|
||||
* @param idadmin The user id of the person doing the action.
|
||||
* @param name The name of the person doing the action.
|
||||
* @param fmt The format string to display. Do not put the "ADMIN:" prefix in this.
|
||||
*/
|
||||
stock show_activity_id(idtarget, idadmin, const name[], const fmt[], any:...)
|
||||
{
|
||||
if (idtarget == 0 ||
|
||||
!is_user_connected(idtarget) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static __amx_show_activity;
|
||||
if (__amx_show_activity == 0)
|
||||
{
|
||||
__amx_show_activity = get_cvar_pointer("amx_show_activity");
|
||||
|
||||
// if still not found, then register the cvar as a dummy
|
||||
if (__amx_show_activity == 0)
|
||||
{
|
||||
__amx_show_activity = register_cvar("amx_show_activity", "2");
|
||||
}
|
||||
}
|
||||
|
||||
static prefix[10];
|
||||
if (is_user_admin(idadmin))
|
||||
{
|
||||
copy(prefix, charsmax(prefix), "ADMIN");
|
||||
}
|
||||
else
|
||||
{
|
||||
copy(prefix, charsmax(prefix), "PLAYER");
|
||||
}
|
||||
|
||||
static buffer[512];
|
||||
vformat(buffer, charsmax(buffer), fmt, 5);
|
||||
|
||||
|
||||
switch(get_pcvar_num(__amx_show_activity))
|
||||
{
|
||||
case 5: // hide name only to admins, show nothing to normal users
|
||||
{
|
||||
if ( is_user_admin(idtarget) )
|
||||
{
|
||||
client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer);
|
||||
}
|
||||
}
|
||||
case 4: // show name only to admins, show nothing to normal users
|
||||
{
|
||||
if ( is_user_admin(idtarget) )
|
||||
{
|
||||
client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer);
|
||||
}
|
||||
}
|
||||
case 3: // show name only to admins, hide name from normal users
|
||||
{
|
||||
if ( is_user_admin(idtarget) )
|
||||
{
|
||||
client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer);
|
||||
}
|
||||
}
|
||||
case 2: // show name to all
|
||||
{
|
||||
client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer);
|
||||
}
|
||||
case 1: // hide name to all
|
||||
{
|
||||
client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Standard method to show activity to one single client with normal language keys.
|
||||
* These keys need to be in the format of standard AMXX keys:
|
||||
* eg: ADMIN_KICK_1 = ADMIN: kick %s
|
||||
* ADMIN_KICK_2 = ADMIN %s: kick %s
|
||||
* This depends on the amx_show_activity cvar. See documentation for more details.
|
||||
*
|
||||
* @param KeyWithoutName The language key that does not have the name field.
|
||||
* @param KeyWithName The language key that does have the name field.
|
||||
* @param __AdminName The name of the person doing the action.
|
||||
* @extra Pass any extra format arguments for the language key in the variable arguments list.
|
||||
*/
|
||||
stock show_activity_key(const KeyWithoutName[], const KeyWithName[], const ___AdminName[], any:...)
|
||||
{
|
||||
// The variable gets used via vformat, but the compiler doesn't know that, so it still cries.
|
||||
#pragma unused ___AdminName
|
||||
static __amx_show_activity;
|
||||
if (__amx_show_activity == 0)
|
||||
{
|
||||
__amx_show_activity = get_cvar_pointer("amx_show_activity");
|
||||
|
||||
// if still not found, then register the cvar as a dummy
|
||||
if (__amx_show_activity == 0)
|
||||
{
|
||||
__amx_show_activity = register_cvar("amx_show_activity", "2");
|
||||
}
|
||||
}
|
||||
|
||||
new buffer[512];
|
||||
new keyfmt[256];
|
||||
new i;
|
||||
|
||||
new __maxclients=get_maxplayers();
|
||||
|
||||
switch( get_pcvar_num(__amx_show_activity) )
|
||||
{
|
||||
case 5: // hide name to admins, display nothing to normal players
|
||||
while (i++ < __maxclients)
|
||||
{
|
||||
if ( is_user_connected(i) )
|
||||
{
|
||||
if ( is_user_admin(i) )
|
||||
{
|
||||
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
|
||||
|
||||
// skip the "adminname" argument if not showing name
|
||||
vformat(buffer, charsmax(buffer), keyfmt, 4);
|
||||
client_print(i, print_chat, "%s", buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
case 4: // show name only to admins, display nothing to normal players
|
||||
while (i++ < __maxclients)
|
||||
{
|
||||
if ( is_user_connected(i) )
|
||||
{
|
||||
if ( is_user_admin(i) )
|
||||
{
|
||||
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
|
||||
vformat(buffer, charsmax(buffer), keyfmt, 3);
|
||||
client_print(i, print_chat, "%s", buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
case 3: // show name only to admins, hide name from normal users
|
||||
while (i++ < __maxclients)
|
||||
{
|
||||
if ( is_user_connected(i) )
|
||||
{
|
||||
if ( is_user_admin(i) )
|
||||
{
|
||||
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
|
||||
vformat(buffer, charsmax(buffer), keyfmt, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
|
||||
|
||||
// skip the "adminname" argument if not showing name
|
||||
vformat(buffer, charsmax(buffer), keyfmt, 4);
|
||||
}
|
||||
client_print(i, print_chat, "%s", buffer);
|
||||
}
|
||||
}
|
||||
case 2: // show name to all users
|
||||
while (i++ < __maxclients)
|
||||
{
|
||||
if ( is_user_connected(i) )
|
||||
{
|
||||
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
|
||||
vformat(buffer, charsmax(buffer), keyfmt, 3);
|
||||
client_print(i, print_chat, "%s", buffer);
|
||||
}
|
||||
}
|
||||
case 1: // hide name from all users
|
||||
while (i++ < __maxclients)
|
||||
{
|
||||
if ( is_user_connected(i) )
|
||||
{
|
||||
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
|
||||
|
||||
// skip the "adminname" argument if not showing name
|
||||
vformat(buffer, charsmax(buffer), keyfmt, 4);
|
||||
client_print(i, print_chat, "%s", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stock colored_menus()
|
||||
{
|
||||
new mod_name[32];
|
||||
get_modname(mod_name,31);
|
||||
|
||||
return ( equal(mod_name,"cstrike") || equal(mod_name,"czero") || equal(mod_name,"dod") );
|
||||
}
|
||||
|
||||
stock cstrike_running()
|
||||
{
|
||||
new mod_name[32];
|
||||
get_modname(mod_name,31);
|
||||
|
||||
return ( equal(mod_name,"cstrike") || equal(mod_name,"czero") || equal(mod_name,"csv15") || equal(mod_name,"cs13") );
|
||||
}
|
||||
|
||||
stock is_running(const mod[])
|
||||
{
|
||||
new mod_name[32];
|
||||
get_modname(mod_name,31);
|
||||
|
||||
return equal(mod_name,mod);
|
||||
}
|
||||
|
||||
stock get_basedir(name[],len)
|
||||
{
|
||||
return get_localinfo("amxx_basedir",name,len);
|
||||
}
|
||||
|
||||
stock get_configsdir(name[],len)
|
||||
{
|
||||
return get_localinfo("amxx_configsdir",name,len);
|
||||
}
|
||||
|
||||
stock get_datadir(name[],len)
|
||||
{
|
||||
return get_localinfo("amxx_datadir",name,len);
|
||||
}
|
||||
|
||||
stock register_menu(const title[],keys,const function[],outside=0)
|
||||
{
|
||||
register_menucmd(register_menuid(title,outside),keys,function);
|
||||
}
|
||||
|
||||
/* Backwards Compatibility
|
||||
* don't use it! */
|
||||
stock get_customdir(name[],len)
|
||||
{
|
||||
return get_localinfo("amxx_configsdir",name,len);
|
||||
}
|
||||
|
||||
/* Add a menu item to Menus Front-End plugin ("amxmodmenu"):
|
||||
* MENU_TEXT: Text that will be shown for this item in menu
|
||||
* MENU_CMD: Command that should be executed to start menu
|
||||
* MENU_ACCESS: Access required for menu
|
||||
* MENU_PLUGIN: The exact case-insensitive name of plugin holding the menu command
|
||||
*/
|
||||
stock AddMenuItem(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[])
|
||||
{
|
||||
AddMenuItem_call(MENU_TEXT, MENU_CMD, MENU_ACCESS, MENU_PLUGIN, false);
|
||||
}
|
||||
/* Just like above, but add menu item to "amx_menu", that should also be accessible by non-admins.
|
||||
*/
|
||||
stock AddClientMenuItem(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[])
|
||||
{
|
||||
AddMenuItem_call(MENU_TEXT, MENU_CMD, MENU_ACCESS, MENU_PLUGIN, true);
|
||||
}
|
||||
|
||||
// Internal function used by above stocks.
|
||||
stock AddMenuItem_call(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[], const bool:ADD_TO_CLIENT_MENU)
|
||||
{
|
||||
new pluginid = is_plugin_loaded("Menus Front-End");
|
||||
if (pluginid == -1) {
|
||||
log_amx("Can't add menu item ^"%s^" from plugin ^"%s^" to menu set because the Menus Front-End plugin itself is not loaded!", MENU_TEXT, MENU_PLUGIN);
|
||||
return; // Menus Front-End doesn't exist, return.
|
||||
}
|
||||
|
||||
new filename[64], b[1];
|
||||
get_plugin(pluginid, filename, 63, b, 0, b, 0, b, 0, b, 0);
|
||||
|
||||
new status = callfunc_begin(ADD_TO_CLIENT_MENU ? "AddClientMenu" : "AddMenu", filename);
|
||||
new bool:failed = true;
|
||||
switch (status)
|
||||
{
|
||||
case 1: failed = false;
|
||||
case 0: log_amx("Run time error! (AddMenuItem_call failed)");
|
||||
case -2: log_amx("Function not found! (AddMenuItem_call failed)");
|
||||
case -1: log_amx("Plugin not found! (AddMenuItem_call failed)");
|
||||
}
|
||||
if (failed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Item text
|
||||
callfunc_push_str(MENU_TEXT);
|
||||
// Cmd
|
||||
callfunc_push_str(MENU_CMD);
|
||||
// Access
|
||||
callfunc_push_int(MENU_ACCESS);
|
||||
// Menu exists in this plugin
|
||||
callfunc_push_str(MENU_PLUGIN);
|
||||
|
||||
callfunc_end();
|
||||
}
|
||||
|
||||
|
||||
stock constraint_offset(low, high, seed, offset)
|
||||
{
|
||||
new numElements = high - low + 1;
|
||||
offset += seed - low;
|
||||
|
||||
if (offset >= 0)
|
||||
{
|
||||
return low + (offset % numElements);
|
||||
}
|
||||
else
|
||||
{
|
||||
return high - (abs(offset) % numElements) + 1;
|
||||
}
|
||||
|
||||
return 0; // Makes the compiler happy -_-
|
||||
}
|
||||
|
||||
/* Returns true if the user has ANY of the provided flags
|
||||
* false if they have none
|
||||
*/
|
||||
stock has_flag(id, const flags[])
|
||||
{
|
||||
return (get_user_flags(id) & read_flags(flags));
|
||||
}
|
||||
/* Returns true if the user has ALL of the provided flags
|
||||
* false otherwise
|
||||
*/
|
||||
stock has_all_flags(id, const flags[])
|
||||
{
|
||||
new FlagsNumber=read_flags(flags);
|
||||
return ((get_user_flags(id) & FlagsNumber)==FlagsNumber);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/* VexdUM backwards compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
|
||||
#if !defined _fakemeta_included
|
||||
#include <fakemeta>
|
||||
#endif
|
||||
|
||||
#if !defined _engine_included
|
||||
#include <engine>
|
||||
#endif
|
||||
|
||||
#if defined _vexd_bcompat_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _vexd_bcompat_included
|
||||
|
||||
#include <VexdUM_const>
|
||||
|
||||
native radius_damage(inflictor, Float:dmg, Float:orig[3], Float:rad, bit = DMG_BULLET, wpnName[]="", hs = 0);
|
||||
native take_damage(victim, attacker, Float:orig[3], Float:dmg, bit = DMG_BULLET, wpnName[]="", hs = 0);
|
||||
native set_user_model(id, const Model[]="");
|
||||
native entity_use(eUsed, eOther);
|
||||
native get_num_ents();
|
||||
|
||||
native DispatchKeyValue(ent, szKey[], szValue[]);
|
||||
|
||||
// Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]
|
||||
// Will return an entindex if an entity is hit.
|
||||
native trace_line(ent, Float:vStart[3], Float:vEnd[3], Float:vReturn[3]);
|
||||
|
||||
native traceline_get_int(iVar);
|
||||
native traceline_set_int(iVar, iVal);
|
||||
native Float:traceline_get_float(iVar);
|
||||
native traceline_set_float(iVar, Float:fVal);
|
||||
native traceline_get_vector(iVar, Float:vVal[3]);
|
||||
native traceline_set_vector(iVar, Float:vVal[3]);
|
||||
native traceline_get_edict(iVar);
|
||||
native traceline_set_edict(iVar, iEnt);
|
||||
|
||||
/* Wrapper around pfn_touch */
|
||||
forward entity_touch(entity1, entity2);
|
||||
|
||||
/* Wrapper around pfn_think */
|
||||
forward entity_think(entity);
|
||||
|
||||
/* Wrapper around pfn_spawn */
|
||||
forward entity_spawn(entity);
|
||||
|
||||
/* Wrapper around client_PreThink */
|
||||
forward client_prethink(id);
|
||||
|
||||
/* Wrapper around client_PostThink */
|
||||
forward client_postthink(id);
|
||||
|
||||
//From AMX Mod:
|
||||
// Called when an Emitting Sound is played Server-Side
|
||||
forward emitsound(entity, const sample[]);
|
||||
|
||||
//From AMX Mod:
|
||||
// Called when an Emitting Ambient Sound is played Server-Side
|
||||
forward emitambientsound(entity, const sample[]);
|
||||
|
||||
//From AMX Mod:
|
||||
// Called when a model spawns
|
||||
forward set_model(entity, const model[]);
|
||||
|
||||
//From AMX Mod:
|
||||
// Called whatever an entity looks at
|
||||
forward traceline(entity);
|
||||
|
||||
//:TODO: ?
|
||||
// Called when a monster is hurt by VexdUM damage natives
|
||||
// forward monster_hurt(monster, attacker, damage);
|
||||
|
||||
//From AMX Mod:
|
||||
// Called when a keyvalue is set on a player
|
||||
forward setclientkeyvalue(id, key[], value[]);
|
||||
|
||||
//From AMX Mod:
|
||||
// Called when an entity gets a keyvalue set on it from the engine.
|
||||
// Use copy_keyvalue to get the keyvalue information
|
||||
forward keyvalue(entity);
|
||||
|
||||
#include <VexdUM_stock>
|
||||
@@ -0,0 +1,30 @@
|
||||
#if defined _vexdum_const_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _vexdum_const_included
|
||||
|
||||
// TraceLine Integer
|
||||
enum {
|
||||
TR_INT_fAllSolid, // if true, plane is not valid
|
||||
TR_INT_fStartSolid, // if true, the initial point was in a solid area
|
||||
TR_INT_fInOpen,
|
||||
TR_INT_fInWater,
|
||||
TR_INT_iHitgroup, // 0 == generic, non zero is specific body part
|
||||
};
|
||||
|
||||
// TraceLine Float
|
||||
enum {
|
||||
TR_FL_flFraction, // time completed, 1.0 = didn't hit anything
|
||||
TR_FL_flPlaneDist,
|
||||
};
|
||||
|
||||
// TraceLine Vector
|
||||
enum {
|
||||
TR_VEC_vecEndPos, // final position
|
||||
TR_VEC_vecPlaneNormal, // surface normal at impact
|
||||
};
|
||||
|
||||
// TraceLine Edict
|
||||
enum {
|
||||
TR_ENT_pHit, // entity the surface is on
|
||||
};
|
||||
@@ -0,0 +1,135 @@
|
||||
/* VexdUM stocks backwards compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _vexd_bcompat_stocks_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _vexd_bcompat_stocks_included
|
||||
|
||||
#if !defined _engine_included
|
||||
#include <engine>
|
||||
#endif
|
||||
|
||||
stock is_entity(ent)
|
||||
{
|
||||
return pev_valid(ent);
|
||||
}
|
||||
|
||||
stock get_offset_int(ent, offset, linos = 5)
|
||||
{
|
||||
return get_pdata_int(ent, offset, linos);
|
||||
}
|
||||
|
||||
stock set_offset_int(ent, offset, value, linos = 5)
|
||||
{
|
||||
return set_pdata_int(ent, offset, value, linos);
|
||||
}
|
||||
|
||||
stock in_view_cone(ent, Float:Orig[3])
|
||||
{
|
||||
return is_in_viewcone(ent, Orig);
|
||||
}
|
||||
|
||||
stock get_maxentities()
|
||||
{
|
||||
return global_get(glb_maxEntities);
|
||||
}
|
||||
|
||||
stock can_see(ent1, ent2)
|
||||
{
|
||||
if (is_entity(ent1) && is_entity(ent2))
|
||||
{
|
||||
new flags = pev(ent1, pev_flags);
|
||||
if (flags & EF_NODRAW || flags & FL_NOTARGET)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
new Float:lookerOrig[3];
|
||||
new Float:targetOrig[3];
|
||||
new Float:temp[3];
|
||||
|
||||
pev(ent1, pev_origin, lookerOrig);
|
||||
pev(ent1, pev_view_ofs, temp);
|
||||
lookerOrig[0] += temp[0];
|
||||
lookerOrig[1] += temp[1];
|
||||
lookerOrig[2] += temp[2];
|
||||
|
||||
pev(ent2, pev_origin, targetOrig);
|
||||
pev(ent2, pev_view_ofs, temp);
|
||||
targetOrig[0] += temp[0];
|
||||
targetOrig[1] += temp[1];
|
||||
targetOrig[2] += temp[2];
|
||||
|
||||
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, ent1, 0);
|
||||
if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
|
||||
{
|
||||
return 0;
|
||||
} else {
|
||||
new Float:flFraction;
|
||||
get_tr2(0, TraceResult:TR_flFraction, flFraction);
|
||||
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == ent2))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//From AMX Mod:
|
||||
// Find an entity in the world, will return -1 if nothing is found
|
||||
// type = 0: "classname"
|
||||
// type = 1: "globalname"
|
||||
// type = 2: "model"
|
||||
// type = 3: "target"
|
||||
// type = 4: "targetname"
|
||||
// type = 5: "netname"
|
||||
// type = 6: "message"
|
||||
// type = 7: "noise"
|
||||
// type = 8: "noise1"
|
||||
// type = 9: "noise2"
|
||||
// type = 10: "noise3"
|
||||
// type = 11: "viewmodel"
|
||||
// type = 12: "weaponmodel"
|
||||
|
||||
stock vexd_find_entity(ent, szValue[], type=0)
|
||||
{
|
||||
static _g_FindEntTypes[13][] =
|
||||
{
|
||||
"classname",
|
||||
"globalname",
|
||||
"model",
|
||||
"target",
|
||||
"targetname",
|
||||
"netname",
|
||||
"messages",
|
||||
"noise",
|
||||
"noise1",
|
||||
"noise2",
|
||||
"noise3",
|
||||
"viewmodel",
|
||||
"weaponmodel"
|
||||
};
|
||||
|
||||
if (type < 0 || type >= 13)
|
||||
{
|
||||
type = 0;
|
||||
}
|
||||
|
||||
return engfunc(EngFunc_FindEntityByString, ent, _g_FindEntTypes[type], szValue);
|
||||
}
|
||||
|
||||
#define find_entity vexd_find_entity
|
||||
|
||||
//From AMX Mod:
|
||||
// Find an entity within a given origin and radius
|
||||
stock find_entity_sphere(ent, Float:Orig[3], Float:Rad)
|
||||
{
|
||||
return engfunc(EngFunc_FindEntityInSphere, ent, Orig, Rad);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/* Vexd Utility backwards compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _Vexd_Utilities_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _Vexd_Utilities_included
|
||||
|
||||
#include <engine>
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
#if !defined _vexd_bcompat_included
|
||||
#include <VexdUM>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
stock Entvars_Get_Int(iIndex, iVariable)
|
||||
return entity_get_int(iIndex, iVariable);
|
||||
|
||||
stock Entvars_Set_Int(iIndex, iVariable, iNewValue)
|
||||
return entity_set_int(iIndex, iVariable, iNewValue);
|
||||
|
||||
stock Float:Entvars_Get_Float(iIndex, iVariable)
|
||||
return entity_get_float(iIndex, iVariable);
|
||||
|
||||
stock Entvars_Set_Float(iIndex, iVariable, Float:fNewValue)
|
||||
return entity_set_float(iIndex, iVariable, fNewValue);
|
||||
|
||||
stock Entvars_Get_Vector(iIndex, iVariable, Float:vRetVector[3])
|
||||
return entity_get_vector(iIndex, iVariable, vRetVector);
|
||||
|
||||
stock Entvars_Set_Vector(iIndex, iVariable, Float:vNewVector[3])
|
||||
return entity_set_vector(iIndex, iVariable, vNewVector);
|
||||
|
||||
stock Entvars_Get_Edict(iIndex, iVariable)
|
||||
return entity_get_edict(iIndex, iVariable);
|
||||
|
||||
stock Entvars_Set_Edict(iIndex, iVariable, iNewIndex)
|
||||
return entity_set_edict(iIndex, iVariable, iNewIndex);
|
||||
|
||||
stock Entvars_Get_String(iIndex, iVariable, szReturnValue[], iReturnLen)
|
||||
return entity_get_string(iIndex, iVariable, szReturnValue, iReturnLen);
|
||||
|
||||
stock Entvars_Set_String(iIndex, iVariable, szNewValue[])
|
||||
return entity_set_string(iIndex, iVariable, szNewValue);
|
||||
|
||||
stock Entvars_Get_Byte(iIndex, iVariable)
|
||||
return entity_get_byte(iIndex, iVariable);
|
||||
|
||||
stock Entvars_Set_Byte(iIndex, iVariable, iNewValue)
|
||||
return entity_set_byte(iIndex, iVariable, iNewValue);
|
||||
|
||||
stock CreateEntity(szClassname[])
|
||||
return create_entity(szClassname);
|
||||
|
||||
stock ENT_SetModel(iIndex, szModel[])
|
||||
return entity_set_model(iIndex, szModel);
|
||||
|
||||
stock ENT_SetOrigin(iIndex, Float:fNewOrigin[3])
|
||||
return entity_set_origin(iIndex, fNewOrigin);
|
||||
|
||||
stock FindEntity(iIndex, szValue[])
|
||||
return find_ent_by_class(iIndex, szValue);
|
||||
|
||||
stock RemoveEntity(iIndex)
|
||||
return remove_entity(iIndex);
|
||||
|
||||
stock TraceLn(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
|
||||
return trace_line(iIgnoreEnt, fStart, fEnd, vReturn);
|
||||
|
||||
stock TraceNormal(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
|
||||
return trace_normal(iIgnoreEnt, fStart, fEnd, vReturn);
|
||||
|
||||
stock VecToAngles(Float:fVector[3], Float:vReturn[3])
|
||||
return vector_to_angle(fVector, vReturn);
|
||||
|
||||
stock Float:VecLength(Float:vVector[3])
|
||||
return vector_length(vVector);
|
||||
|
||||
stock Float:VecDist(Float:vVector[3], Float:vVector2[3])
|
||||
return vector_distance(vVector, vVector2);
|
||||
|
||||
stock MessageBlock(iMessage, iMessageFlags)
|
||||
return set_msg_block(iMessage, iMessageFlags);
|
||||
|
||||
stock GetMessageBlock(iMessage)
|
||||
return get_msg_block(iMessage);
|
||||
|
||||
stock Float:HLTime()
|
||||
return halflife_time();
|
||||
|
||||
stock FakeTouch(iToucher, iTouched)
|
||||
return fake_touch(iToucher, iTouched);
|
||||
|
||||
stock AttachView(iIndex, iTargetIndex)
|
||||
return attach_view(iIndex, iTargetIndex);
|
||||
|
||||
stock SetView(iIndex, ViewType)
|
||||
return set_view(iIndex, ViewType);
|
||||
|
||||
stock SetSpeak(iIndex, iSpeakFlags)
|
||||
return set_speak(iIndex, iSpeakFlags);
|
||||
|
||||
forward vexd_pfntouch(pToucher, pTouched);
|
||||
|
||||
forward ServerFrame();
|
||||
@@ -0,0 +1,318 @@
|
||||
/* AMX Mod X Backwards Compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _amxmod_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _amxmod_included
|
||||
|
||||
#if !defined AMXMOD_BCOMPAT
|
||||
#define AMXMOD_BCOMPAT
|
||||
#endif
|
||||
|
||||
#include <amxmodx>
|
||||
#include <cstrike>
|
||||
#include <engine>
|
||||
#include <fun>
|
||||
#include <maths>
|
||||
|
||||
stock AMX_VERSION[] = "1.76-BC";
|
||||
|
||||
#define ADMIN_PERMBAN ADMIN_BAN //AMX Mod admin flag for permanent ban
|
||||
#define ADMIN_UNBAN ADMIN_BAN //AMX Mod admin flag for unbanning
|
||||
#define ADMIN_SUPREME ADMIN_IMMUNITY //AMX Mod admin flag for "super admin" (can kick, slap, ban, slay admins with Immunity)
|
||||
|
||||
/* Core will identify us as an "old plugin" this way. */
|
||||
public __b_old_plugin = 1;
|
||||
|
||||
public __b_ident_vers()
|
||||
{
|
||||
return __b_old_plugin;
|
||||
}
|
||||
|
||||
stock user_spawn(index)
|
||||
return spawn(index);
|
||||
|
||||
stock get_logfile( name[], len )
|
||||
return get_time("admin%m%d.log",name,len);
|
||||
|
||||
stock get_user_money(index)
|
||||
return cs_get_user_money(index);
|
||||
|
||||
stock set_user_money(index,money,flash=1)
|
||||
return cs_set_user_money(index,money,flash);
|
||||
|
||||
stock numtostr(num,string[],len)
|
||||
return num_to_str(num,string,len);
|
||||
|
||||
stock strtonum(const string[])
|
||||
return str_to_num(string);
|
||||
|
||||
stock build_path(path[], len, {Float,_}:... )
|
||||
{
|
||||
format_args(path, len, 2);
|
||||
new pathlen = strlen(path);
|
||||
new basedir[32];
|
||||
if (containi(path, "$basedir") != -1)
|
||||
{
|
||||
get_localinfo("amxx_basedir", basedir, 31);
|
||||
if (!basedir[0])
|
||||
{
|
||||
copy(basedir, 31, "addons/amxmodx");
|
||||
}
|
||||
if ((pathlen+strlen(basedir)-strlen("$basedir")) < len)
|
||||
{
|
||||
replace(path, len, "$basedir", basedir);
|
||||
}
|
||||
}
|
||||
new dir[64], subdir[63];
|
||||
if (containi(path, "$configdir") != -1)
|
||||
{
|
||||
get_localinfo("amxx_configsdir", dir, 63);
|
||||
if (!dir[0])
|
||||
{
|
||||
format(dir, 63, "%s/configs", basedir);
|
||||
}
|
||||
if ((pathlen+strlen(basedir)-strlen("$configdir")) < len)
|
||||
{
|
||||
replace(path, len, "$configdir", dir);
|
||||
}
|
||||
dir[0] = '^0';
|
||||
}
|
||||
if (containi(path, "$langdir") != -1)
|
||||
{
|
||||
get_localinfo("amxx_datadir", subdir, 63);
|
||||
if (!subdir[0])
|
||||
{
|
||||
format(subdir, 63, "%s/data", basedir);
|
||||
}
|
||||
format(dir, 63, "%s/amxmod-lang", subdir);
|
||||
if ((pathlen+strlen(basedir)-strlen("$langdir")) < len)
|
||||
{
|
||||
replace(path, len, "$langdir", dir);
|
||||
}
|
||||
dir[0] = '^0';
|
||||
}
|
||||
if (containi(path, "$modulesdir") != -1)
|
||||
{
|
||||
get_localinfo("amxx_modules", dir, 63);
|
||||
if (!dir[0])
|
||||
{
|
||||
format(dir, 63, "%s/modules", basedir);
|
||||
}
|
||||
if ((pathlen+strlen(basedir)-strlen("$modulesdir")) < len)
|
||||
{
|
||||
replace(path, len, "$modulesdir", dir);
|
||||
}
|
||||
dir[0] = '^0';
|
||||
}
|
||||
if (containi(path, "$pluginsdir") != -1)
|
||||
{
|
||||
get_localinfo("amx_pluginsdir", dir, 63);
|
||||
if( !dir[0])
|
||||
{
|
||||
format(dir, 63, "%s/plugins", basedir);
|
||||
}
|
||||
if ((pathlen+strlen(basedir)-strlen("$pluginsdir")) < len)
|
||||
{
|
||||
replace(path, len, "$pluginsdir", dir);
|
||||
}
|
||||
dir[0] = '^0';
|
||||
}
|
||||
if (containi(path, "$logdir") != -1)
|
||||
{
|
||||
get_localinfo("amx_logs", dir, 63);
|
||||
if (!dir[0])
|
||||
{
|
||||
format(dir, 63, "%s/logs", basedir);
|
||||
}
|
||||
if ((pathlen+strlen(basedir)-strlen("$logdir")) < len)
|
||||
{
|
||||
replace(path, len, "$logdir", dir);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock is_user_authorized(id)
|
||||
{
|
||||
static auth[32];
|
||||
|
||||
get_user_authid(id, auth, 31);
|
||||
if (auth[0] == 0 || equali(auth, "STEAM_ID_PENDING"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Vector AMX Mod compatibility */
|
||||
#define ANGLEVECTORS_FORWARD 1
|
||||
#define ANGLEVECTORS_RIGHT 2
|
||||
#define ANGLEVECTORS_UP 3
|
||||
|
||||
stock angle_to_vector(Float:vector[3], FRU, Float:ret[3])
|
||||
{
|
||||
return angle_vector(vector, FRU, ret);
|
||||
}
|
||||
|
||||
stock get_cmdaccess(cmd[], accessflags[], len)
|
||||
{
|
||||
new num = get_concmdsnum(-1);
|
||||
new command[32], info[3];
|
||||
new flags;
|
||||
|
||||
for (new i=0; i<num; i++)
|
||||
{
|
||||
get_concmd(i, command, 31, flags, info, 2, -1);
|
||||
if (equal(command, cmd))
|
||||
{
|
||||
get_flags(flags, accessflags, len);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock is_translated(const sentence[])
|
||||
{
|
||||
return (GetLangTransKey(sentence) != TransKey_Bad);
|
||||
}
|
||||
|
||||
stock get_plugincmdsnum(plugin[], type=7)
|
||||
{
|
||||
new plid = find_plugin_byfile(plugin);
|
||||
new our_type;
|
||||
|
||||
/**
|
||||
* Whoever wrote this was a bit confused about the type stuff...
|
||||
*/
|
||||
if (type == 1) {
|
||||
our_type = 1;
|
||||
} else if (type == 4) {
|
||||
our_type = 0;
|
||||
} else {
|
||||
our_type = -1;
|
||||
}
|
||||
|
||||
new found = 0;
|
||||
new total = get_concmdsnum(-1, our_type);
|
||||
for (new i=0; i<total; i++)
|
||||
{
|
||||
if (plid == get_concmd_plid(i, -1, our_type))
|
||||
{
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
stock get_plugincmd(plugin[], index, cmd[], len1, accessflags[], len2, info[], len3, destid=-1, type=7)
|
||||
{
|
||||
new plid = find_plugin_byfile(plugin);
|
||||
new our_type;
|
||||
|
||||
/**
|
||||
* Whoever wrote this was a bit confused about the type stuff...
|
||||
*/
|
||||
if (type == 1) {
|
||||
our_type = 1;
|
||||
} else if (type == 4) {
|
||||
our_type = 0;
|
||||
} else {
|
||||
our_type = -1;
|
||||
}
|
||||
|
||||
new found_iter = 0;
|
||||
new total = get_concmdsnum(-1, our_type);
|
||||
for (new i=0; i<total; i++)
|
||||
{
|
||||
if (plid == get_concmd_plid(i, -1, our_type))
|
||||
{
|
||||
if (found_iter == index)
|
||||
{
|
||||
new flags, result;
|
||||
result = get_concmd(i, cmd, len1, flags, info, len3, -1, our_type);
|
||||
get_flags(flags, accessflags, len2);
|
||||
return result;
|
||||
}
|
||||
found_iter++;
|
||||
}
|
||||
}
|
||||
|
||||
/* get rid of a compiler warning */
|
||||
destid = -1;
|
||||
return (++destid);
|
||||
}
|
||||
|
||||
stock get_plugincvar(plugin[], index, cvar[], len1, value[], len2, flags=0)
|
||||
{
|
||||
new plid = find_plugin_byfile(plugin);
|
||||
|
||||
new total = get_plugins_cvarsnum();
|
||||
new cvar_flags, plugin_id, pcvar_handle;
|
||||
new iter_id = 0;
|
||||
for (new i=0; i<total; i++)
|
||||
{
|
||||
get_plugins_cvar(i, cvar, len1, cvar_flags, plugin_id, pcvar_handle);
|
||||
if ((plugin_id == plid)
|
||||
&& (!flags || (cvar_flags & flags)))
|
||||
{
|
||||
if (iter_id == index)
|
||||
{
|
||||
get_pcvar_string(pcvar_handle, value, len2);
|
||||
return 1;
|
||||
}
|
||||
iter_id++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock get_plugincvarsnum(plugin[], flags=0)
|
||||
{
|
||||
new plid = find_plugin_byfile(plugin);
|
||||
|
||||
new total = get_plugins_cvarsnum();
|
||||
new cvar_flags, plugin_id;
|
||||
new cvars_total = 0;
|
||||
for (new i=0; i<total; i++)
|
||||
{
|
||||
get_plugins_cvar(i, "", 0, cvar_flags, plugin_id);
|
||||
if ((plugin_id == plid)
|
||||
&& (!flags || (cvar_flags & flags)))
|
||||
{
|
||||
cvars_total++;
|
||||
}
|
||||
}
|
||||
|
||||
return cvars_total;
|
||||
}
|
||||
|
||||
stock is_module_running(const module[])
|
||||
{
|
||||
if (strcmp(module, "MySQL Access") == 0)
|
||||
return LibraryExists("sqlx", LibType_Class);
|
||||
|
||||
return is_module_loaded(module) == -1 ? 0 : 1;
|
||||
}
|
||||
|
||||
stock is_plugin_running(const plugin[])
|
||||
{
|
||||
new status[8];
|
||||
new id, filename[1], name[1], version[1], author[1];
|
||||
|
||||
id = is_plugin_loaded(plugin);
|
||||
|
||||
get_plugin(id, filename, 0, name, 0, version, 0, author, 0, status, 7);
|
||||
|
||||
return strcmp(status, "running") == 0 ? id + 1 : 0;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/* AMX Mod math functions backwards compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _maths_bcompat_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _maths_bcompat_included
|
||||
|
||||
#if !defined _float_included
|
||||
#include <float>
|
||||
#endif
|
||||
|
||||
stock Float:fabs(Float:value)
|
||||
{
|
||||
return floatabs(value);
|
||||
}
|
||||
|
||||
stock Float:asin(Float:value)
|
||||
{
|
||||
return floatasin(value, radian);
|
||||
}
|
||||
|
||||
stock Float:sin(Float:value)
|
||||
{
|
||||
return floatsin(value, radian);
|
||||
}
|
||||
|
||||
stock Float:sinh(Float:value)
|
||||
{
|
||||
return floatsinh(value, radian);
|
||||
}
|
||||
|
||||
stock Float:acos(Float:value)
|
||||
{
|
||||
return floatacos(value, radian);
|
||||
}
|
||||
|
||||
stock Float:cos(Float:value)
|
||||
{
|
||||
return floatcos(value, radian);
|
||||
}
|
||||
|
||||
stock Float:cosh(Float:value)
|
||||
{
|
||||
return floatcosh(value, radian);
|
||||
}
|
||||
|
||||
stock Float:atan(Float:value)
|
||||
{
|
||||
return floatatan(value, radian);
|
||||
}
|
||||
|
||||
stock Float:atan2(Float:value1, Float:value2)
|
||||
{
|
||||
return floatatan2(value1, value2, radian);
|
||||
}
|
||||
|
||||
stock Float:tan(Float:value)
|
||||
{
|
||||
return floattan(value, radian);
|
||||
}
|
||||
|
||||
stock Float:tanh(Float:value)
|
||||
{
|
||||
return floattanh(value, radian);
|
||||
}
|
||||
|
||||
stock Float:fsqroot(Float:value)
|
||||
{
|
||||
return floatsqroot(value);
|
||||
}
|
||||
|
||||
stock Float:fpower(Float:value, Float:exponent)
|
||||
{
|
||||
return floatpower(value, exponent);
|
||||
}
|
||||
|
||||
stock Float:flog(Float:value, Float:base=10.0)
|
||||
{
|
||||
return floatlog(value, base);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
#if defined _mysql_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _mysql_included
|
||||
|
||||
#include <sqlx>
|
||||
|
||||
native mysql_connect(host[], user[], pass[], dbname[], error[], maxlength);
|
||||
native mysql_query(sql, query[], {Float,_}:... );
|
||||
native mysql_error(sql, dest[], maxlength);
|
||||
native mysql_close(sql);
|
||||
native mysql_nextrow(sql);
|
||||
native mysql_getfield(sql, fieldnum, {Float,_}:... );
|
||||
native mysql_getresult(sql, field[], {Float,_}:... );
|
||||
native mysql_affected_rows(sql);
|
||||
native mysql_num_fields(sql);
|
||||
native mysql_num_rows(sql);
|
||||
native mysql_field_name(sql, field, name[], length);
|
||||
native mysql_insert_id(sql);
|
||||
@@ -0,0 +1,86 @@
|
||||
/* AMX Mod X Backwards Compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _amxmod_translator_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _amxmod_translator_included
|
||||
|
||||
#define _translator_included
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmod>
|
||||
#include <amxmisc>
|
||||
|
||||
//From AMX Mod. This is implemented in Core due to the nature of the
|
||||
// translation engine and what AMX Mod did.
|
||||
/* Translation backend, used by _T (since natives can't return arrays). */
|
||||
native translate(const string[], destid=-1, forcelang=-1);
|
||||
|
||||
stock _T(const string[], destid=-1, forcelang=-1)
|
||||
{
|
||||
new TranslationResult[2] = {0, 0};
|
||||
TranslationResult[0] = translate(string, destid, forcelang);
|
||||
return TranslationResult;
|
||||
}
|
||||
|
||||
stock load_translations(const file[])
|
||||
{
|
||||
static dir[255], path[255];
|
||||
get_datadir(dir, 254);
|
||||
|
||||
format(path, 254, "%s/amxmod-lang/%s.txt", dir, file);
|
||||
new fp
|
||||
if (!(fp=fopen(path, "r")))
|
||||
{
|
||||
abort(AMX_ERR_NATIVE, "Could not find file: %s", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static buffer[1024];
|
||||
new lang[3];
|
||||
new TransKey:bad_key = TransKey:-1;
|
||||
new TransKey:cur_key = bad_key;
|
||||
new len;
|
||||
while (!feof(fp))
|
||||
{
|
||||
buffer[0] = 0;
|
||||
fgets(fp, buffer, 1023);
|
||||
len = strlen(buffer);
|
||||
if (len == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (isspace(buffer[len-1]))
|
||||
{
|
||||
buffer[--len] = 0;
|
||||
}
|
||||
if (buffer[0] == '"')
|
||||
{
|
||||
remove_quotes(buffer);
|
||||
cur_key = CreateLangKey(buffer);
|
||||
AddTranslation("en", cur_key, buffer);
|
||||
continue;
|
||||
}
|
||||
if (isspace(buffer[0]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((cur_key != bad_key) && (buffer[2] == ':' && buffer[3] == '"'))
|
||||
{
|
||||
lang[0] = buffer[0];
|
||||
lang[1] = buffer[1];
|
||||
lang[2] = 0;
|
||||
remove_quotes(buffer[3]);
|
||||
AddTranslation(lang, cur_key, buffer[3]);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/* Xtrafun backwards compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* These natives were originally made by SpaceDude, EJ, and JustinHoMi.
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if !defined _xtrafun_included
|
||||
#define _xtrafun_included
|
||||
|
||||
#if !defined _engine_included
|
||||
#include <engine.inc>
|
||||
#endif
|
||||
|
||||
/* Gets the velocity of an entity */
|
||||
stock get_entity_velocity(index, velocity[3]) {
|
||||
new Float:vector[3];
|
||||
entity_get_vector(index, EV_VEC_velocity, vector);
|
||||
FVecIVec(vector, velocity);
|
||||
}
|
||||
|
||||
/* Sets the velocity of an entity */
|
||||
stock set_entity_velocity(index, velocity[3]) {
|
||||
new Float:vector[3];
|
||||
IVecFVec(velocity, vector);
|
||||
entity_set_vector(index, EV_VEC_velocity, vector);
|
||||
}
|
||||
|
||||
/* Gets the origin of an entity */
|
||||
stock get_entity_origin(index, origin[3]) {
|
||||
new Float:vector[3];
|
||||
entity_get_vector(index, EV_VEC_origin, vector);
|
||||
FVecIVec(vector, origin);
|
||||
}
|
||||
|
||||
/* Sets the origin of an entity */
|
||||
stock set_entity_origin(index, origin[3]) {
|
||||
new Float:vector[3];
|
||||
IVecFVec(origin, vector);
|
||||
entity_set_vector(index, EV_VEC_origin, vector);
|
||||
}
|
||||
|
||||
/* Get the index of the grenade belonging to index.
|
||||
* Model of grenade is returned in model[].
|
||||
* Specify the grenadeindex to start searching from,
|
||||
* or leave it at 0 to search from the start.
|
||||
* Returns grenade index.
|
||||
* Paths + models of grenades in Counter-Strike:
|
||||
* HEGRENADE = "models/w_hegrenade.mdl"
|
||||
* FLASHBANG = "models/w_flashbang.mdl"
|
||||
* SMOKEGRENADE = "models/w_smokegrenade.mdl" */
|
||||
stock get_grenade_index(index, model[], len, grenadeindex = 0) {
|
||||
new entfind = grenadeindex;
|
||||
new entowner = index;
|
||||
|
||||
for (;;) {
|
||||
entfind = find_ent_by_class(entfind, "grenade");
|
||||
|
||||
if (entfind && is_valid_ent(entfind)) {
|
||||
if (entity_get_edict(entFind, EV_ENT_owner) == entowner) {
|
||||
entity_get_string(entfind, EV_SZ_model, model);
|
||||
return entfind;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Eventually comes here if loop fails to find a grenade with specified owner.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the number of entities in the game */
|
||||
stock current_num_ents() {
|
||||
return entity_count();
|
||||
}
|
||||
|
||||
enum {
|
||||
classname = 0,
|
||||
target,
|
||||
targetname
|
||||
};
|
||||
|
||||
#if !defined _vexd_bcompat_included
|
||||
/* Find an entity ID from start_from_ent id (use 0 to start from
|
||||
* the beginning, category is either "classname", "target" or
|
||||
* "targetname", value is the name you are searching for */
|
||||
stock find_entity(start_from_ent, category, value[]) {
|
||||
switch (category) {
|
||||
case target: return find_ent_by_target(start_from_ent, value);
|
||||
case targetname: return find_ent_by_tname(start_from_ent, value);
|
||||
}
|
||||
return find_ent_by_class(start_from_ent, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _xtrafun_included
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,254 @@
|
||||
#if defined _cellarray_included
|
||||
#endinput
|
||||
#endif
|
||||
|
||||
#define _cellarray_included
|
||||
|
||||
enum Array
|
||||
{
|
||||
Invalid_Array = 0
|
||||
};
|
||||
/**
|
||||
* These arrays are intended to be used for a form of global storage without
|
||||
* requiring a #define that needs to be increased each time a person needs more
|
||||
* storage.
|
||||
* These are not designed to be used as a replacement for normal arrays, as
|
||||
* normal arrays are faster and should be used whenever possible.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a handle to a dynamically sized array.
|
||||
* It is very important that the cellsize you provide matches up with the buffer sizes
|
||||
* that you pass with subsequent Array{Get,Set,Push} calls.
|
||||
*
|
||||
* @param cellsize How many cells each entry in the array is.
|
||||
* @param reserved How many blank entries are created immediately when the array is created. These entries are not valid to read from until called with ArraySet.
|
||||
* @return Handle to the array.
|
||||
*/
|
||||
native Array:ArrayCreate(cellsize=1, reserved=32);
|
||||
|
||||
/**
|
||||
* Clears all entries from the array.
|
||||
*
|
||||
* @param which The array to clear.
|
||||
* @return 1 on success, 0 on failure.
|
||||
*/
|
||||
native ArrayClear(Array:which);
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the array.
|
||||
*
|
||||
* @param which The array to check.
|
||||
* @return How many elements are in the array.
|
||||
*/
|
||||
native ArraySize(Array:which);
|
||||
|
||||
/**
|
||||
* Returns data within an array.
|
||||
* Make sure the output buffer matches the size the array was created with!
|
||||
*
|
||||
* @param which The array to retrieve the item from.
|
||||
* @param item The item to retrieve (zero-based).
|
||||
* @param output The output buffer to write.
|
||||
*/
|
||||
native ArrayGetArray(Array:which, item, any:output[]);
|
||||
|
||||
/**
|
||||
* Returns a single cell of data from an array.
|
||||
* Use this only with arrays that were created with a cellsize of 1!
|
||||
*
|
||||
* @param which The array to retrieve the item from.
|
||||
* @param item The item to retrieve (zero-based).
|
||||
* @return The value of the cell.
|
||||
*/
|
||||
native any:ArrayGetCell(Array:which, item);
|
||||
|
||||
/**
|
||||
* Returns a string value from an array.
|
||||
*
|
||||
* @param which The array to retrieve the item from.
|
||||
* @param item The item to retrieve (zero-based).
|
||||
* @param output The variable to store the value in.
|
||||
* @param size Character size of the output buffer.
|
||||
*/
|
||||
native ArrayGetString(Array:which, item, output[], size);
|
||||
|
||||
/**
|
||||
* Sets an item's data with that of a local buffer.
|
||||
* The buffer size must match what the cellsize that the array was created with!
|
||||
* The item must already exist, use ArrayPushArray to create a new item within the array.
|
||||
*
|
||||
* @param which The array to set the item from within.
|
||||
* @param item The item to set (zero-based).
|
||||
* @param input The input buffer to store.
|
||||
*/
|
||||
native ArraySetArray(Array:which, item, const any:input[]);
|
||||
|
||||
/**
|
||||
* Sets an array's single cell value. Use this only on array that were created with a cellsize of 1!
|
||||
* The item must already exist, use ArrayPushCell to create a new item within the array.
|
||||
*
|
||||
* @param which The array to set the item from within.
|
||||
* @param item The item to set (zero-based).
|
||||
* @param input The value to set.
|
||||
*/
|
||||
native ArraySetCell(Array:which, item, any:input);
|
||||
|
||||
/**
|
||||
* Sets a string value from an array.
|
||||
* The stored string will be truncated if it is longer than the cellsize the array was created with!
|
||||
* The item must already exist, use ArrayPushString to create a new item within the array.
|
||||
*
|
||||
* @param which The array to set the item from within.
|
||||
* @param item The item to set (zero-based).
|
||||
* @param input The string to set the item as.
|
||||
*/
|
||||
native ArraySetString(Array:which, item, const input[]);
|
||||
|
||||
/**
|
||||
* Creates a new item at the end of the array and sets its data with that of a local buffer.
|
||||
* The buffer size must match what the cellsize that the array was created with!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param input The input buffer to store.
|
||||
*/
|
||||
native ArrayPushArray(Array:which, const any:input[]);
|
||||
|
||||
/**
|
||||
* Creates a new item and sets the array's single cell value.
|
||||
* Use this only on array that were created with a cellsize of 1!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param input The value to set.
|
||||
*/
|
||||
native ArrayPushCell(Array:which, any:input);
|
||||
|
||||
/**
|
||||
* Creates a new element in the array and sets its value to the input buffer.
|
||||
* The stored string will be truncated if it is longer than the cellsize the array was created with!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param input The string to set the item as.
|
||||
*/
|
||||
native ArrayPushString(Array:which, const input[]);
|
||||
|
||||
/**
|
||||
* Inserts an item after the selected item. All items beyond it get shifted up 1 space.
|
||||
* The buffer size must match what the cellsize that the array was created with!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param item The item to insert after.
|
||||
* @param input The input buffer to store.
|
||||
*/
|
||||
native ArrayInsertArrayAfter(Array:which, item, const any:input[]);
|
||||
|
||||
/**
|
||||
* Inserts an item after the selected item. All items beyond it get shifted up 1 space.
|
||||
* Use this only on an array that was created with a cellsize of 1!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param item The item to insert after.
|
||||
* @param input The value to set.
|
||||
*/
|
||||
native ArrayInsertCellAfter(Array:which, item, any:input);
|
||||
|
||||
/**
|
||||
* Inserts an item after the selected item. All items beyond it get shifted up 1 space.
|
||||
* The stored string will be truncated if it is longer than the cellsize the array was created with!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param item The item to insert after.
|
||||
* @param input The value to set.
|
||||
*/
|
||||
native ArrayInsertStringAfter(Array:which, item, const input[]);
|
||||
|
||||
/**
|
||||
* Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space.
|
||||
* The buffer size must match what the cellsize that the array was created with!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param item The item to insert before.
|
||||
* @param input The input buffer to store.
|
||||
*/
|
||||
native ArrayInsertArrayBefore(Array:which, item, const any:input[]);
|
||||
|
||||
/**
|
||||
* Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space.
|
||||
* Use this only on an array that was created with a cellsize of 1!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param item The item to insert after.
|
||||
* @param input The value to set.
|
||||
*/
|
||||
native ArrayInsertCellBefore(Array:which, item, const any:input);
|
||||
|
||||
/**
|
||||
* Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space.
|
||||
* The stored string will be truncated if it is longer than the cellsize the array was created with!
|
||||
*
|
||||
* @param which The array to add the item to.
|
||||
* @param item The item to insert before.
|
||||
* @param input The value to set.
|
||||
*/
|
||||
native ArrayInsertStringBefore(Array:which, item, const input[]);
|
||||
|
||||
/**
|
||||
* Swaps the position of two items.
|
||||
*
|
||||
* @param which The array that contains the items.
|
||||
* @param item1 The first item to swap.
|
||||
* @param item2 The second item to swap.
|
||||
*/
|
||||
native ArraySwap(Array:which, item1, item2);
|
||||
|
||||
/**
|
||||
* Deletes an item from the array. All items beyond it get shifted down 1 space.
|
||||
*
|
||||
* @param which The array that contains the item to delete.
|
||||
* @param item The item to delete.
|
||||
*/
|
||||
native ArrayDeleteItem(Array:which, item);
|
||||
|
||||
/**
|
||||
* Creates a handle that is passable to a format compliant routine for printing as a string (with the %a format option).
|
||||
* It is suggested to pass the function directly as a parameter to the format routine.
|
||||
* The array contents must be a null-terminated string!
|
||||
*
|
||||
* An example usage: client_print(id, print_chat, "%a", ArrayGetStringHandle(MessageArray, i));
|
||||
*
|
||||
* @param which The array the string is stored in.
|
||||
* @param item Which item to print the string value of.
|
||||
* @return Handle to the item directly. Do not use or save stale handles.
|
||||
*/
|
||||
native DoNotUse:ArrayGetStringHandle(Array:which, item);
|
||||
|
||||
/**
|
||||
* Destroys the array, and resets the handle to 0 to prevent accidental usage after it is destroyed.
|
||||
*
|
||||
* @param which The array to destroy.
|
||||
*/
|
||||
native ArrayDestroy(&Array:which);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Similar to sorting.inc's CustomSort.
|
||||
* The sorting algorithm then uses your comparison function to sort the data.
|
||||
* The function is called in the following manner:
|
||||
*
|
||||
* public MySortFunc(Array:array, item1, item2, const data[], data_size)
|
||||
*
|
||||
* array - Array handle in its current un-sorted state.
|
||||
* item1, item2 - Current item pair being compared
|
||||
* data[] - Extra data array you passed to the sort func.
|
||||
* data_size - Size of extra data you passed to the sort func.
|
||||
*
|
||||
* Your function should return:
|
||||
* -1 if item1 should go before item2
|
||||
* 0 if item1 and item2 are equal
|
||||
* 1 if item1 should go after item2
|
||||
* Note that the parameters after item2 are all optional and you do not need to specify them.
|
||||
*
|
||||
* Note that unlike the sorting.inc versions, the array passed to the callback is not in mid-sorted state.
|
||||
*/
|
||||
native ArraySort(Array:array, const comparefunc[], data[]="", data_size=0);
|
||||
@@ -0,0 +1,26 @@
|
||||
#if defined _celltrie_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _celltrie_included
|
||||
|
||||
enum Trie
|
||||
{
|
||||
Invalid_Trie = 0
|
||||
};
|
||||
|
||||
|
||||
native Trie:TrieCreate();
|
||||
native TrieClear(Trie:handle);
|
||||
|
||||
native TrieSetCell(Trie:handle, const key[], any:value);
|
||||
native TrieSetString(Trie:handle, const key[], const value[]);
|
||||
native TrieSetArray(Trie:handle, const key[], const any:buffer[], size);
|
||||
|
||||
native bool:TrieGetCell(Trie:handle, const key[], &any:value);
|
||||
native bool:TrieGetString(Trie:handle, const key[], output[], outputsize);
|
||||
native bool:TrieGetArray(Trie:handle, const key[], any:output[], outputsize);
|
||||
|
||||
native bool:TrieDeleteKey(Trie:handle, const key[]);
|
||||
native bool:TrieKeyExists(Trie:handle, const key[]);
|
||||
native TrieDestroy(&Trie:handle);
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
/* Fun functions
|
||||
*
|
||||
* by Numb
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _colorchat_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _colorchat_included
|
||||
|
||||
enum Color
|
||||
{
|
||||
NORMAL = 1, // clients scr_concolor cvar color
|
||||
GREEN, // Green Color
|
||||
TEAM_COLOR, // Red, grey, blue
|
||||
GREY, // grey
|
||||
RED, // Red
|
||||
BLUE, // Blue
|
||||
}
|
||||
|
||||
new TeamName[][] =
|
||||
{
|
||||
"",
|
||||
"TERRORIST",
|
||||
"CT",
|
||||
"SPECTATOR"
|
||||
}
|
||||
|
||||
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
|
||||
{
|
||||
new message[256];
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case NORMAL: // clients scr_concolor cvar color
|
||||
{
|
||||
message[0] = 0x01;
|
||||
}
|
||||
case GREEN: // Green
|
||||
{
|
||||
message[0] = 0x04;
|
||||
}
|
||||
default: // White, Red, Blue
|
||||
{
|
||||
message[0] = 0x03;
|
||||
}
|
||||
}
|
||||
|
||||
vformat(message[1], 251, msg, 4);
|
||||
|
||||
// Make sure message is not longer than 192 character. Will crash the server.
|
||||
message[192] = '^0';
|
||||
|
||||
new team, ColorChange, index, MSG_Type;
|
||||
|
||||
if(id)
|
||||
{
|
||||
MSG_Type = MSG_ONE;
|
||||
index = id;
|
||||
} else {
|
||||
index = FindPlayer();
|
||||
MSG_Type = MSG_ALL;
|
||||
}
|
||||
|
||||
team = get_user_team(index);
|
||||
ColorChange = ColorSelection(index, MSG_Type, type);
|
||||
|
||||
ShowColorMessage(index, MSG_Type, message);
|
||||
|
||||
if(ColorChange)
|
||||
{
|
||||
Team_Info(index, MSG_Type, TeamName[team]);
|
||||
}
|
||||
}
|
||||
|
||||
ShowColorMessage(id, type, message[])
|
||||
{
|
||||
static bool:saytext_used;
|
||||
static get_user_msgid_saytext;
|
||||
if(!saytext_used)
|
||||
{
|
||||
get_user_msgid_saytext = get_user_msgid("SayText");
|
||||
saytext_used = true;
|
||||
}
|
||||
message_begin(type, get_user_msgid_saytext, _, id);
|
||||
write_byte(id)
|
||||
write_string(message);
|
||||
message_end();
|
||||
}
|
||||
|
||||
Team_Info(id, type, team[])
|
||||
{
|
||||
static bool:teaminfo_used;
|
||||
static get_user_msgid_teaminfo;
|
||||
if(!teaminfo_used)
|
||||
{
|
||||
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
|
||||
teaminfo_used = true;
|
||||
}
|
||||
message_begin(type, get_user_msgid_teaminfo, _, id);
|
||||
write_byte(id);
|
||||
write_string(team);
|
||||
message_end();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ColorSelection(index, type, Color:Type)
|
||||
{
|
||||
switch(Type)
|
||||
{
|
||||
case RED:
|
||||
{
|
||||
return Team_Info(index, type, TeamName[1]);
|
||||
}
|
||||
case BLUE:
|
||||
{
|
||||
return Team_Info(index, type, TeamName[2]);
|
||||
}
|
||||
case GREY:
|
||||
{
|
||||
return Team_Info(index, type, TeamName[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
FindPlayer()
|
||||
{
|
||||
new i = -1;
|
||||
|
||||
while(i <= get_maxplayers())
|
||||
{
|
||||
if(is_user_connected(++i))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
|
||||
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
|
||||
*/
|
||||
@@ -0,0 +1,44 @@
|
||||
/* Core functions
|
||||
*
|
||||
* (c) Copyright 1998-2003, ITB CompuPhase
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _core_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _core_included
|
||||
|
||||
native heapspace();
|
||||
|
||||
native funcidx(const name[]);
|
||||
|
||||
native numargs();
|
||||
native getarg(arg, index=0);
|
||||
native setarg(arg, index=0, value);
|
||||
|
||||
native strlen(const string[]);
|
||||
|
||||
native tolower(c);
|
||||
native toupper(c);
|
||||
native swapchars(c);
|
||||
|
||||
native random(max);
|
||||
|
||||
native min(value1, value2);
|
||||
native max(value1, value2);
|
||||
native clamp(value, min=cellmin, max=cellmax);
|
||||
|
||||
native power(value, exponent);
|
||||
native sqroot(value);
|
||||
|
||||
native time(&hour=0,&minute=0,&second=0);
|
||||
native date(&year=0,&month=0,&day=0);
|
||||
|
||||
native tickcount(&granularity=0);
|
||||
|
||||
stock abs(x)
|
||||
{
|
||||
return x > 0 ? x : -x;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
#if defined _csstats_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _csstats_included
|
||||
|
||||
/* Gets stats from given weapon index. If wpnindex is 0
|
||||
* then the stats are from all weapons. If weapon has not been used function
|
||||
* returns 0 in other case 1. Fields in stats are:
|
||||
* 0 - kills
|
||||
* 1 - deaths
|
||||
* 2 - headshots
|
||||
* 3 - teamkilling
|
||||
* 4 - shots
|
||||
* 5 - hits
|
||||
* 6 - damage
|
||||
|
||||
* For body hits fields see amxconst.inc. */
|
||||
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets round stats from given weapon index.*/
|
||||
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets overall stats which are stored in file on server
|
||||
* and updated on every respawn or user disconnect.
|
||||
* Function returns the position in stats by diff. kills to deaths. */
|
||||
native get_user_stats(index,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets round stats of player. */
|
||||
native get_user_rstats(index,stats[8],bodyhits[8]);
|
||||
|
||||
/* Gets stats with which user have killed/hurt his victim. If victim is 0
|
||||
* then stats are from all victims. If victim has not been hurt, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
|
||||
/* Gets stats with which user have been killed/hurt. If killer is 0
|
||||
* then stats are from all attacks. If killer has not hurt user, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
|
||||
|
||||
/* Resets life, weapon, victims and attackers user stats. */
|
||||
native reset_user_wstats(index);
|
||||
|
||||
/* Gets overall stats which stored in stats.dat file in amx folder
|
||||
* and updated on every mapchange or user disconnect.
|
||||
* Function returns next index of stats entry or 0 if no more exists. */
|
||||
native get_stats(index,stats[8],bodyhits[8],name[],len,authid[] = "",authidlen = 0);
|
||||
|
||||
/* Returns number of all entries in stats. */
|
||||
native get_statsnum();
|
||||
|
||||
/*
|
||||
* new stats:
|
||||
* 0 - total defusions
|
||||
* 1 - bomb defused
|
||||
* 2 - bomb plants
|
||||
* 3 - bomb explosions
|
||||
*/
|
||||
native get_user_stats2(index,stats[4]);
|
||||
native get_stats2(index,stats[4],authid[] = "",authidlen = 0);
|
||||
@@ -0,0 +1,355 @@
|
||||
/* Counter-Strike functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _cstrike_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _cstrike_included
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib cstrike
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib cstrike
|
||||
#endif
|
||||
#else
|
||||
#pragma library cstrike
|
||||
#endif
|
||||
|
||||
/* Returns player deaths.
|
||||
*/
|
||||
native cs_get_user_deaths(index);
|
||||
|
||||
/* Sets player deaths.
|
||||
*/
|
||||
native cs_set_user_deaths(index, newdeaths);
|
||||
|
||||
/* Returns index of entity (does not have to be a player) which hostage is following. 0 is hostage doesn't follow anything.
|
||||
* Note: this native does not work on Condition Zero, which has a different hostage AI than CS.
|
||||
*/
|
||||
native cs_get_hostage_foll(index);
|
||||
|
||||
/* Set hostage to follow entity specified in followedindex. Does not have to be a player. If followedindex is 0 the hostage will stop following.
|
||||
* Note: this native does not work on Condition Zero, which has a different hostage AI than CS.
|
||||
*/
|
||||
native cs_set_hostage_foll(index, followedindex = 0);
|
||||
|
||||
/* Get unique hostage id.
|
||||
*/
|
||||
native cs_get_hostage_id(index);
|
||||
|
||||
/* Get amount of ammo in backpack on a user for a specific weapon.
|
||||
* Look in amxconst.inc for weapon types: CSW_*.
|
||||
* Weapons on the same line uses the same ammo type:
|
||||
* awm
|
||||
* scout, ak, g3
|
||||
* para
|
||||
* famas, m4a1, aug, sg550, galil, sg552
|
||||
* m3, xm
|
||||
* usp, ump, mac
|
||||
* fiveseven, p90
|
||||
* deagle
|
||||
* p228
|
||||
* glock, mp5, tmp, elites
|
||||
* flash
|
||||
* he
|
||||
* smoke
|
||||
*/
|
||||
native cs_get_user_bpammo(index, weapon);
|
||||
|
||||
/* Restock/remove ammo in a user's backpack.
|
||||
*/
|
||||
native cs_set_user_bpammo(index, weapon, amount);
|
||||
|
||||
/* Returns 1 if user has a defuse kit.
|
||||
*/
|
||||
native cs_get_user_defuse(index);
|
||||
|
||||
/* If defusekit is 1, the user will have a defuse kit.
|
||||
* You can specify a different colour for the defuse kit icon showing on hud. Default is the normal green.
|
||||
* You can specify an icon. Default is "defuser". Set flash to 1 if you want the icon to flash red.
|
||||
*/
|
||||
native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0);
|
||||
|
||||
/* Is user in buyzone? Returns 1 when true, 0 when false.
|
||||
*/
|
||||
native cs_get_user_buyzone(index);
|
||||
|
||||
/* Returns 1 when user has a primary weapon OR a shield in inventory, else 0.
|
||||
*/
|
||||
native cs_get_user_hasprim(index);
|
||||
|
||||
/* Get user model.
|
||||
*/
|
||||
native cs_get_user_model(index, model[], len);
|
||||
|
||||
/* Set user model.
|
||||
*/
|
||||
native cs_set_user_model(index, const model[]);
|
||||
|
||||
/* Use to reset model to standard selected model.
|
||||
*/
|
||||
native cs_reset_user_model(index);
|
||||
|
||||
/* Returns users money.
|
||||
*/
|
||||
native cs_get_user_money(index);
|
||||
|
||||
/* Gives money to user. If flash is 1, the difference between new and old amount will flash red or green.
|
||||
*/
|
||||
native cs_set_user_money(index, money, flash = 1);
|
||||
|
||||
/* Does user have night vision goggles?
|
||||
*/
|
||||
native cs_get_user_nvg(index);
|
||||
|
||||
/* Set nvgoggles to 1 to give night vision goggles to index. Set it to 0 to remove them.
|
||||
*/
|
||||
native cs_set_user_nvg(index, nvgoggles = 1);
|
||||
|
||||
/* Returns 1 if user has the "skill" to plant bomb, else 0. Normally this would only be true for a terrorist carrying a bomb.
|
||||
*/
|
||||
native cs_get_user_plant(index);
|
||||
|
||||
/* If plant is 1, a user will be set to be able to plant bomb within the usual bomb target areas if having one.
|
||||
* You should use this if you give a player a weapon_c4, or he won't be able to plant it
|
||||
* without dropping it and picking it up again (only possible for terrorists).
|
||||
* If showbombicon is 1, the green C4 icon will be shown on user hud (if plant "skill" was enabled).
|
||||
*/
|
||||
native cs_set_user_plant(index, plant = 1, showbombicon = 1);
|
||||
|
||||
/* Set user team without killing player.
|
||||
* If model is anything other than CS_DONTCHANGE, that will be set as player's model.
|
||||
*/
|
||||
enum CsInternalModel {
|
||||
CS_DONTCHANGE = 0,
|
||||
CS_CT_URBAN = 1,
|
||||
CS_T_TERROR = 2,
|
||||
CS_T_LEET = 3,
|
||||
CS_T_ARCTIC = 4,
|
||||
CS_CT_GSG9 = 5,
|
||||
CS_CT_GIGN = 6,
|
||||
CS_CT_SAS = 7,
|
||||
CS_T_GUERILLA = 8,
|
||||
CS_CT_VIP = 9,
|
||||
CZ_T_MILITIA = 10,
|
||||
CZ_CT_SPETSNAZ = 11
|
||||
};
|
||||
native cs_set_user_team(index, {CsTeams,_}:team, {CsInternalModel,_}:model = CS_DONTCHANGE);
|
||||
|
||||
/* Get team directly from player's entity.
|
||||
* 1 = terrorist
|
||||
* 2 = counter-terrorist
|
||||
* 3 = spectator
|
||||
*/
|
||||
enum CsTeams {
|
||||
CS_TEAM_UNASSIGNED = 0,
|
||||
CS_TEAM_T = 1,
|
||||
CS_TEAM_CT = 2,
|
||||
CS_TEAM_SPECTATOR = 3
|
||||
};
|
||||
native CsTeams:cs_get_user_team(index, &{CsInternalModel,_}:model = CS_DONTCHANGE);
|
||||
|
||||
/* Is user vip? Returns 1 if true, 0 if false.
|
||||
*/
|
||||
native cs_get_user_vip(index);
|
||||
|
||||
/* If vip = 1, user is set to vip.
|
||||
* If model = 1, then user's model will be changed to VIP model or random CT model if vip = 0.
|
||||
* If scoreboard = 1, then scoreboard will be updated to show that user is VIP.
|
||||
* This shouldn't be used for players on teams other than CT.
|
||||
* NOTE: this is mostly useful for unsetting vips, so they can change teams and/or buy items properly.
|
||||
* It does not alter game play; the one being VIP at start of round will retain internal status as VIP; terrorists
|
||||
* can terminate him and accomplish their objective, etc.
|
||||
*/
|
||||
native cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1);
|
||||
|
||||
/* Returns 1 of specified user has tk:ed (team killed).
|
||||
*/
|
||||
native cs_get_user_tked(index);
|
||||
|
||||
/* Returns 1 of specified user has TKed (team killed).
|
||||
* tk = 1: player has TKed
|
||||
* tk = 0: player hasn't TKed
|
||||
* Set subtract to how many frags to subtract. Set subtract to negative value to add frags.
|
||||
*/
|
||||
native cs_set_user_tked(index, tk = 1, subtract = 1);
|
||||
|
||||
/* Returns different values depending on if user is driving a vehicle - and if so at what speed.
|
||||
* 0: no driving
|
||||
* 1: driving, but standing still
|
||||
* 2-4: driving, different positive speeds
|
||||
* 5: driving, negative speed (backing)
|
||||
* Note: these values were tested quickly, they may differ.
|
||||
*/
|
||||
native cs_get_user_driving(index);
|
||||
|
||||
/* Returns 1 if user has a shield, else 0.
|
||||
*/
|
||||
native cs_get_user_shield(index);
|
||||
|
||||
/* Returns 1 if user is using a stationary gun, else 0.
|
||||
*/
|
||||
native cs_get_user_stationary(index);
|
||||
|
||||
/* Returns armor value and sets by reference the armor type in second parameter.
|
||||
*/
|
||||
enum CsArmorType {
|
||||
CS_ARMOR_NONE = 0, // no armor
|
||||
CS_ARMOR_KEVLAR = 1, // armor
|
||||
CS_ARMOR_VESTHELM = 2 // armor and helmet
|
||||
};
|
||||
native cs_get_user_armor(index, &CsArmorType:armortype);
|
||||
|
||||
/* Use this instead of fun's set_user_armor.
|
||||
* Appropriate message to update client's HUD will be sent if armortype is kevlar or vesthelm.
|
||||
*/
|
||||
native cs_set_user_armor(index, armorvalue, CsArmorType:armortype);
|
||||
|
||||
/* Returns 1 if specified weapon is in burst mode.
|
||||
*/
|
||||
native cs_get_weapon_burst(index);
|
||||
|
||||
/* If burstmode = 1, weapon will be changed to burst mode, 0 and non-burst mode (semiautomatic/automatic) will be activated.
|
||||
* Only GLOCK and FAMAS can enter/leave burst mode.
|
||||
*/
|
||||
native cs_set_weapon_burst(index, burstmode = 1);
|
||||
|
||||
/* Returns 1 if weapon is silenced, else 0.
|
||||
*/
|
||||
native cs_get_weapon_silen(index);
|
||||
|
||||
/* If silence = 1, weapon will be silenced, 0 and silencer will be removed. Only USP and M4A1 can be silenced.
|
||||
*/
|
||||
native cs_set_weapon_silen(index, silence = 1, draw_animation = 1);
|
||||
|
||||
/* Returns amount of ammo in weapon's clip.
|
||||
*/
|
||||
native cs_get_weapon_ammo(index);
|
||||
|
||||
/* Set amount of ammo in weapon's clip.
|
||||
*/
|
||||
native cs_set_weapon_ammo(index, newammo);
|
||||
|
||||
/* Get weapon type. Corresponds to CSW_* in amxconst.inc: 1 is CSW_P228, 2 is CSW_SCOUT and so on...
|
||||
*/
|
||||
native cs_get_weapon_id(index);
|
||||
|
||||
/* Returns 1 if no knives mode is enabled, else 0.
|
||||
*/
|
||||
native cs_get_no_knives();
|
||||
|
||||
/* Enabled no knives mode by calling this with value 1. Disabled with 0.
|
||||
* No knives mode means that player will not be given a knife when spawning.
|
||||
* You can still give knives (ie through fun's give_item).
|
||||
*/
|
||||
native cs_set_no_knives(noknives = 0);
|
||||
|
||||
/* Spawns a Counter-Strike player
|
||||
*/
|
||||
native cs_user_spawn(player);
|
||||
|
||||
/* Get what weapon type (CSW_*) an armoury_entity is.
|
||||
*/
|
||||
native cs_get_armoury_type(index);
|
||||
|
||||
/* Set an armoury_entity to be of specified type. You will have to set the appropriate model.
|
||||
* The second argument, type, should be a CSW_* constant. Not all weapons are supported by Counter-strike.
|
||||
* Supported weapons/items: CSW_MP5NAVY, CSW_TMP, CSW_P90, CSW_MAC10, CSW_AK47, CSW_SG552, CSW_M4A1, CSW_AUG, CSW_SCOUT
|
||||
* CSW_G3SG1, CSW_AWP, CSW_M3, CSW_XM1014, CSW_M249, CSW_FLASHBANG, CSW_HEGRENADE, CSW_VEST, CSW_VESTHELM, CSW_SMOKEGRENADE
|
||||
*/
|
||||
native cs_set_armoury_type(index, type);
|
||||
|
||||
#define CS_MAPZONE_BUY (1<<0)
|
||||
#define CS_MAPZONE_BOMBTARGET (1<<1)
|
||||
#define CS_MAPZONE_HOSTAGE_RESCUE (1<<2)
|
||||
#define CS_MAPZONE_ESCAPE (1<<3)
|
||||
#define CS_MAPZONE_VIP_SAFETY (1<<4)
|
||||
|
||||
/* Returns in bitwise form if the user is in a specific map zone.
|
||||
* NOTE: If user can't plant (cs_get_user_plant(index) is 0) then cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET will return 0 too.
|
||||
*/
|
||||
native cs_get_user_mapzones(index);
|
||||
|
||||
/* Zoom type enum. Used for get/set_user_zoom() natives.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
CS_RESET_ZOOM = 0, // Reset any zoom blocking (when using this type, mode has no effect)
|
||||
CS_SET_NO_ZOOM, // Disable any sort of zoom (ie: to disable zoom in all weapons use this with mode=0)
|
||||
CS_SET_FIRST_ZOOM, // Set first zoom (awp style)
|
||||
CS_SET_SECOND_ZOOM, // Set second zoom (awp style)
|
||||
CS_SET_AUGSG552_ZOOM, // Set aug/sg552 zoom style
|
||||
};
|
||||
/* Sets a weapon zoom type on a player, any zoom type will work for all weapons, so you can even set an awp zoom to pistols :D
|
||||
* The 2nd param has to be one of the above zoom types in the enum. Mode can only be 0 or 1.
|
||||
* If mode=0 (blocking mode), the user will be forced to use the zoom type set by the native, and wont be able to change it (even by changing weapon)
|
||||
* until the native resets the zoom with CS_RESET_ZOOM.
|
||||
* If mode=1 the user will be able to restore back to a normal view by changing weapon.
|
||||
*/
|
||||
native cs_set_user_zoom(index, type, mode);
|
||||
|
||||
/* Returns how a user is zooming during the native call. Values correspond to the above enum, but will return 0 if an error occurred.
|
||||
*/
|
||||
native cs_get_user_zoom(index);
|
||||
|
||||
/* Returns the submodel setting of the player.
|
||||
* If this is 1, then the user has a backpack or defuser on their model (depending on team)
|
||||
*/
|
||||
native cs_get_user_submodel(index);
|
||||
|
||||
/* Sets the submodel setting of the player.
|
||||
* If this is 1, then the user has a backpack or defuser on their model (depending on team)
|
||||
* 0 removes it.
|
||||
*/
|
||||
native cs_set_user_submodel(index, value);
|
||||
|
||||
/* Gets or sets the user's last activity time. This is the time that CS's internal afk kicker
|
||||
* checks to see who has been afk too long.
|
||||
*/
|
||||
native Float:cs_get_user_lastactivity(index);
|
||||
|
||||
native cs_set_user_lastactivity(index, Float:value);
|
||||
|
||||
/* Gets or sets the number of hostages that a user has killed.
|
||||
*/
|
||||
native cs_get_user_hostagekills(index);
|
||||
|
||||
native cs_set_user_hostagekills(index, value);
|
||||
|
||||
/* Gets or sets the time that the hostage was last used.
|
||||
*/
|
||||
native Float:cs_get_hostage_lastuse(index);
|
||||
|
||||
native cs_set_hostage_lastuse(index, Float:value);
|
||||
|
||||
/* Gets or sets the time which the hostage can next be used.
|
||||
*/
|
||||
native Float:cs_get_hostage_nextuse(index);
|
||||
|
||||
native cs_set_hostage_nextuse(index, Float:value);
|
||||
|
||||
/* Gets or sets the time in which the C4 will explode.
|
||||
*/
|
||||
native Float:cs_get_c4_explode_time(index);
|
||||
|
||||
native cs_set_c4_explode_time(index, Float:value);
|
||||
|
||||
/* Gets or sets whether the C4 is being defused.
|
||||
*/
|
||||
native bool:cs_get_c4_defusing(c4index);
|
||||
|
||||
native cs_set_c4_defusing(c4index, bool:defusing);
|
||||
/**
|
||||
* Called when CS internally fires a command to a player. It does this for a few
|
||||
* functions, most notably rebuy/autobuy functionality. This is also used to pass
|
||||
* commands to CZ bots internally.
|
||||
*
|
||||
* @param id Client index.
|
||||
* @param cmd Command string.
|
||||
* @return PLUGIN_HANDLED to block, PLUGIN_CONTINUE for normal operation.
|
||||
*/
|
||||
forward CS_InternalCommand(id, const cmd[]);
|
||||
@@ -0,0 +1,68 @@
|
||||
/* CSX functions
|
||||
*
|
||||
* (c) 2004, SidLuke
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _csx_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _csx_included
|
||||
|
||||
#include <csstats>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqclass xstats
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma defclasslib xstats csx
|
||||
#endif
|
||||
#else
|
||||
#pragma library csx
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Forwards
|
||||
*/
|
||||
|
||||
/* Function is called after player to player attacks ,
|
||||
* if players were damaged by teammate TA is set to 1 */
|
||||
forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA);
|
||||
|
||||
/* Function is called after player death ,
|
||||
* if player was killed by teammate TK is set to 1 */
|
||||
forward client_death(killer,victim,wpnindex,hitplace,TK);
|
||||
|
||||
forward grenade_throw( index,greindex,wId );
|
||||
|
||||
forward bomb_planting(planter);
|
||||
forward bomb_planted(planter);
|
||||
forward bomb_explode(planter,defuser);
|
||||
forward bomb_defusing(defuser);
|
||||
forward bomb_defused(defuser);
|
||||
|
||||
/************* Shared Natives Start ********************************/
|
||||
|
||||
/* Custom Weapon Support */
|
||||
/* function will return index of new weapon */
|
||||
native custom_weapon_add( const wpnname[],melee = 0,const logname[]="" );
|
||||
/* Function will pass damage done by this custom weapon to stats module and other plugins */
|
||||
native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 );
|
||||
/* Function will pass info about custom weapon shot to stats module */
|
||||
native custom_weapon_shot( weapon,index ); // weapon id , player id
|
||||
|
||||
/* function will return 1 if true */
|
||||
native xmod_is_melee_wpn(wpnindex);
|
||||
|
||||
/* Returns weapon name. */
|
||||
native xmod_get_wpnname(wpnindex,name[],len);
|
||||
|
||||
/* Returns weapon logname. */
|
||||
native xmod_get_wpnlogname(wpnindex,name[],len);
|
||||
|
||||
/* Returns weapons array size */
|
||||
native xmod_get_maxweapons();
|
||||
|
||||
/* Returns stats array size */
|
||||
native xmod_get_stats_size();
|
||||
|
||||
/************* Shared Natives End ********************************/
|
||||
@@ -0,0 +1,145 @@
|
||||
/* SQL Database API
|
||||
* By the AMX Mod X Development Team
|
||||
* Notes - Read the comments! Make sure your plugins use
|
||||
* nice ANSI SQL and don't use database column names like "key"
|
||||
* otherwise this API will be a nightmare
|
||||
* Never do error checking with the not operator! This is bad:
|
||||
* if (!dbi_query())
|
||||
* You should do:
|
||||
* ret = dbi_query()
|
||||
* if (ret < 0)
|
||||
* This is because DBI functions can and will return negative numbers
|
||||
* Negative numbers evaluate to "true" in AMX.
|
||||
*/
|
||||
|
||||
#if defined _dbi_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _dbi_included
|
||||
|
||||
// You can't include SQLX first!
|
||||
// there's really no reason to anyway.
|
||||
#assert !defined _sqlx_included
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqclass dbi
|
||||
#else
|
||||
#pragma library dbi
|
||||
#endif
|
||||
|
||||
enum Sql
|
||||
{
|
||||
SQL_FAILED=0,
|
||||
SQL_OK
|
||||
};
|
||||
|
||||
enum Result
|
||||
{
|
||||
RESULT_FAILED=-1,
|
||||
RESULT_NONE,
|
||||
RESULT_OK
|
||||
};
|
||||
|
||||
/* This will return a number equal to or below 0 on failure.
|
||||
* If it does fail, the error will be mirrored in dbi_error()
|
||||
* The return value will otherwise be a resource handle, not an
|
||||
* OK code or cell pointer.
|
||||
*/
|
||||
native Sql:dbi_connect(_host[], _user[], _pass[], _dbname[], _error[]="", _maxlength=0);
|
||||
|
||||
/* This will do a simple query execution on the SQL server.
|
||||
* If it fails, it will return a number BELOW ZERO (0)
|
||||
* If zero, it succeeded with NO RETURN RESULT.
|
||||
* If greater than zero, make sure to call dbi_free_result() on it!
|
||||
* The return is a handle to the result set
|
||||
*/
|
||||
native Result:dbi_query(Sql:_sql, _query[], any:...);
|
||||
|
||||
/* Has the same usage as dbi_query, but this native returns by
|
||||
* reference the number of rows affected in the query. If the
|
||||
* query fails rows will be equal to -1.
|
||||
*/
|
||||
native Result:dbi_query2(Sql:_sql, &rows, _query[], any:...);
|
||||
|
||||
/* Returns 0 on failure or End of Results.
|
||||
* Advances result pointer by one row.
|
||||
*/
|
||||
native dbi_nextrow(Result:_result);
|
||||
|
||||
/* Gets a field by number. Returns 0 on failure.
|
||||
* Although internally fields always start from 0,
|
||||
* This function takes fieldnum starting from 1.
|
||||
* No extra params: returns int
|
||||
* One extra param: returns Float: byref
|
||||
* Two extra param: Stores string with length
|
||||
*/
|
||||
native dbi_field(Result:_result, _fieldnum, {Float,_}:... );
|
||||
|
||||
/* Gets a field by name. Returns 0 on failure.
|
||||
* One extra param: returns Float: byref
|
||||
* Two extra param: Stores string with length
|
||||
*/
|
||||
native dbi_result(Result:_result, _field[], {Float,_}:... );
|
||||
|
||||
/* Returns the number of rows returned from a query
|
||||
*/
|
||||
native dbi_num_rows(Result:_result);
|
||||
|
||||
/* Frees memory used by a result handle. Do this or get memory leaks.
|
||||
*/
|
||||
native dbi_free_result(&Result:result);
|
||||
|
||||
/* Closes a database handle. Internally, it will also
|
||||
* mark the handle as free, so this particular handle may
|
||||
* be re-used in the future to save time.
|
||||
*/
|
||||
native dbi_close(&Sql:_sql);
|
||||
|
||||
/* Returns an error message set. For PGSQL and MySQL,
|
||||
* this is a direct error return from the database handle/API.
|
||||
* For MSSQL, it returns the last error message found from a
|
||||
* thrown exception.
|
||||
*/
|
||||
native dbi_error(Sql:_sql, _error[], _len);
|
||||
|
||||
/* Returns the type of database being used. So far:
|
||||
* "mysql", "pgsql", "mssql", "sqlite"
|
||||
*/
|
||||
native dbi_type(_type[], _len);
|
||||
|
||||
/* Returns the number of fields/colums in a result set.
|
||||
* Unlike dbi_nextrow, you must pass a valid result handle.
|
||||
*/
|
||||
native dbi_num_fields(Result:result);
|
||||
|
||||
/* Retrieves the name of a field/column in a result set.
|
||||
* Requires a valid result handle, and columns are numbered 1 to n.
|
||||
*/
|
||||
native dbi_field_name(Result:result, field, name[], maxLength);
|
||||
|
||||
/* This function can be used to find out if a table in a Sqlite database exists.
|
||||
*/
|
||||
stock bool:sqlite_table_exists(Sql:sql, table[])
|
||||
{
|
||||
new bool:exists;
|
||||
new query[128];
|
||||
format(query, 127, "SELECT name FROM sqlite_master WHERE type='table' AND name='%s' LIMIT 1;", table);
|
||||
|
||||
new Result:result = dbi_query(sql, query);
|
||||
|
||||
if (dbi_nextrow(result))
|
||||
{
|
||||
exists = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
exists = false;
|
||||
}
|
||||
|
||||
if (result > RESULT_NONE)
|
||||
{
|
||||
dbi_free_result(result);
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
#if defined _dhudmessage_included
|
||||
#endinput
|
||||
#endif
|
||||
|
||||
#define _dhudmessage_included
|
||||
|
||||
#include <amxmodx>
|
||||
|
||||
stock __dhud_color;
|
||||
stock __dhud_x;
|
||||
stock __dhud_y;
|
||||
stock __dhud_effect;
|
||||
stock __dhud_fxtime;
|
||||
stock __dhud_holdtime;
|
||||
stock __dhud_fadeintime;
|
||||
stock __dhud_fadeouttime;
|
||||
stock __dhud_reliable;
|
||||
|
||||
stock set_dhudmessage( red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 6.0, Float:holdtime = 3.0, Float:fadeintime = 0.1, Float:fadeouttime = 1.5, bool:reliable = false )
|
||||
{
|
||||
#define clamp_byte(%1) ( clamp( %1, 0, 255 ) )
|
||||
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
|
||||
|
||||
__dhud_color = pack_color( clamp_byte( red ), clamp_byte( green ), clamp_byte( blue ) );
|
||||
__dhud_x = _:x;
|
||||
__dhud_y = _:y;
|
||||
__dhud_effect = effects;
|
||||
__dhud_fxtime = _:fxtime;
|
||||
__dhud_holdtime = _:holdtime;
|
||||
__dhud_fadeintime = _:fadeintime;
|
||||
__dhud_fadeouttime = _:fadeouttime;
|
||||
__dhud_reliable = _:reliable;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock show_dhudmessage( index, const message[], any:... )
|
||||
{
|
||||
new buffer[ 128 ];
|
||||
new numArguments = numargs();
|
||||
|
||||
if( numArguments == 2 )
|
||||
{
|
||||
send_dhudMessage( index, message );
|
||||
}
|
||||
else if( index || numArguments == 3 )
|
||||
{
|
||||
vformat( buffer, charsmax( buffer ), message, 3 );
|
||||
send_dhudMessage( index, buffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
new playersList[ 32 ], numPlayers;
|
||||
get_players( playersList, numPlayers, "ch" );
|
||||
|
||||
if( !numPlayers )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
new Array:handleArrayML = ArrayCreate();
|
||||
|
||||
for( new i = 2, j; i < numArguments; i++ )
|
||||
{
|
||||
if( getarg( i ) == LANG_PLAYER )
|
||||
{
|
||||
while( ( buffer[ j ] = getarg( i + 1, j++ ) ) ) {}
|
||||
j = 0;
|
||||
|
||||
if( GetLangTransKey( buffer ) != TransKey_Bad )
|
||||
{
|
||||
ArrayPushCell( handleArrayML, i++ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new size = ArraySize( handleArrayML );
|
||||
|
||||
if( !size )
|
||||
{
|
||||
vformat( buffer, charsmax( buffer ), message, 3 );
|
||||
send_dhudMessage( index, buffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( new i = 0, j; i < numPlayers; i++ )
|
||||
{
|
||||
index = playersList[ i ];
|
||||
|
||||
for( j = 0; j < size; j++ )
|
||||
{
|
||||
setarg( ArrayGetCell( handleArrayML, j ), 0, index );
|
||||
}
|
||||
|
||||
vformat( buffer, charsmax( buffer ), message, 3 );
|
||||
send_dhudMessage( index, buffer );
|
||||
}
|
||||
}
|
||||
|
||||
ArrayDestroy( handleArrayML );
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock send_dhudMessage( const index, const message[] )
|
||||
{
|
||||
message_begin( __dhud_reliable ? ( index ? MSG_ONE : MSG_ALL ) : ( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST ), SVC_DIRECTOR, _, index );
|
||||
{
|
||||
write_byte( strlen( message ) + 31 );
|
||||
write_byte( DRC_CMD_MESSAGE );
|
||||
write_byte( __dhud_effect );
|
||||
write_long( __dhud_color );
|
||||
write_long( __dhud_x );
|
||||
write_long( __dhud_y );
|
||||
write_long( __dhud_fadeintime );
|
||||
write_long( __dhud_fadeouttime );
|
||||
write_long( __dhud_holdtime );
|
||||
write_long( __dhud_fxtime );
|
||||
write_string( message );
|
||||
}
|
||||
message_end();
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/* DoDX functions
|
||||
*
|
||||
* (c) 2004, SidLuke
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _dodconst_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _dodconst_included
|
||||
|
||||
/* DoD teams */
|
||||
#define ALLIES 1
|
||||
#define AXIS 2
|
||||
|
||||
#define FT_NEW 1<<0
|
||||
#define FT_OLD 1<<1
|
||||
|
||||
#define STAMINA_SET 0
|
||||
#define STAMINA_RESET 1
|
||||
|
||||
#define FUSE_SET 0
|
||||
#define FUSE_RESET 1
|
||||
|
||||
#define DODMAX_WEAPONS 46 // 5 slots for custom weapons
|
||||
|
||||
// DoD Weapon Types
|
||||
enum
|
||||
{
|
||||
DODWT_PRIMARY = 0,
|
||||
DODWT_SECONDARY,
|
||||
DODWT_MELEE,
|
||||
DODWT_GRENADE,
|
||||
DODWT_OTHER
|
||||
};
|
||||
|
||||
// Ammo Channels
|
||||
#define AMMO_SMG 1 // thompson, greasegun, sten, mp40
|
||||
#define AMMO_ALTRIFLE 2 // carbine, k43, mg34
|
||||
#define AMMO_RIFLE 3 // garand, enfield, scoped enfield, k98, scoped k98
|
||||
#define AMMO_PISTOL 4 // colt, webley, luger
|
||||
#define AMMO_SPRING 5 // springfield
|
||||
#define AMMO_HEAVY 6 // bar, bren, stg44, fg42, scoped fg42
|
||||
#define AMMO_MG42 7 // mg42
|
||||
#define AMMO_30CAL 8 // 30cal
|
||||
#define AMMO_GREN 9 // grenades (should be all 3 types)
|
||||
#define AMMO_ROCKET 13 // bazooka, piat, panzerschreck
|
||||
enum {
|
||||
PS_NOPRONE =0,
|
||||
PS_PRONE,
|
||||
PS_PRONEDEPLOY,
|
||||
PS_DEPLOY,
|
||||
};
|
||||
|
||||
/* info types for dod_get_map_info native */
|
||||
enum {
|
||||
MI_ALLIES_TEAM = 0,
|
||||
MI_ALLIES_PARAS,
|
||||
MI_AXIS_PARAS,
|
||||
};
|
||||
|
||||
/* DoD weapons */
|
||||
enum {
|
||||
DODW_AMERKNIFE = 1,
|
||||
DODW_GERKNIFE,
|
||||
DODW_COLT,
|
||||
DODW_LUGER,
|
||||
DODW_GARAND,
|
||||
DODW_SCOPED_KAR,
|
||||
DODW_THOMPSON,
|
||||
DODW_STG44,
|
||||
DODW_SPRINGFIELD,
|
||||
DODW_KAR,
|
||||
DODW_BAR,
|
||||
DODW_MP40,
|
||||
DODW_HANDGRENADE,
|
||||
DODW_STICKGRENADE,
|
||||
DODW_STICKGRENADE_EX,
|
||||
DODW_HANDGRENADE_EX,
|
||||
DODW_MG42,
|
||||
DODW_30_CAL,
|
||||
DODW_SPADE,
|
||||
DODW_M1_CARBINE,
|
||||
DODW_MG34,
|
||||
DODW_GREASEGUN,
|
||||
DODW_FG42,
|
||||
DODW_K43,
|
||||
DODW_ENFIELD,
|
||||
DODW_STEN,
|
||||
DODW_BREN,
|
||||
DODW_WEBLEY,
|
||||
DODW_BAZOOKA,
|
||||
DODW_PANZERSCHRECK,
|
||||
DODW_PIAT,
|
||||
DODW_SCOPED_FG42,
|
||||
DODW_FOLDING_CARBINE,
|
||||
DODW_KAR_BAYONET,
|
||||
DODW_SCOPED_ENFIELD,
|
||||
DODW_MILLS_BOMB,
|
||||
DODW_BRITKNIFE,
|
||||
DODW_GARAND_BUTT,
|
||||
DODW_ENFIELD_BAYONET,
|
||||
DODW_MORTAR,
|
||||
DODW_K43_BUTT,
|
||||
};
|
||||
|
||||
/* DoD Classes */
|
||||
enum {
|
||||
DODC_GARAND = 1,
|
||||
DODC_CARBINE,
|
||||
DODC_THOMPSON,
|
||||
DODC_GREASE,
|
||||
DODC_SNIPER,
|
||||
DODC_BAR,
|
||||
DODC_30CAL,
|
||||
DODC_BAZOOKA,
|
||||
//DODC_ALLIES_MORTAR,
|
||||
DODC_KAR = 10,
|
||||
DODC_K43,
|
||||
DODC_MP40,
|
||||
DODC_MP44,
|
||||
DODC_SCHARFSCHUTZE,
|
||||
DODC_FG42,
|
||||
DODC_SCOPED_FG42,
|
||||
DODC_MG34,
|
||||
DODC_MG42,
|
||||
DODC_PANZERJAGER,
|
||||
//DODC_AXIS_MORTAR,
|
||||
DODC_ENFIELD = 21,
|
||||
DODC_STEN,
|
||||
DODC_MARKSMAN,
|
||||
DODC_BREN,
|
||||
DODC_PIAT,
|
||||
//DODC_BRIT_MORTAR,
|
||||
};
|
||||
@@ -0,0 +1,149 @@
|
||||
/* DoDFun functions
|
||||
*
|
||||
* (c) 2004-2005, SidLuke
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _dodfun_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _dodfun_included
|
||||
|
||||
#include <dodconst>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib dodfun
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib dodfun
|
||||
#endif
|
||||
#else
|
||||
#pragma library dodfun
|
||||
#endif
|
||||
|
||||
/* Function is called after grenade throw */
|
||||
forward grenade_throw(index,greindex,wId);
|
||||
|
||||
/* Function is called after a rocket is shot */
|
||||
forward rocket_shoot(index,rocketindex,wId);
|
||||
|
||||
/* Example: for full stamina use dod_player_stamina(1,STAMINA_SET,100,100) */
|
||||
/* value is from 0 - 100 */
|
||||
native dod_set_stamina(index,set=STAMINA_SET,minvalue=0,maxvalue=100);
|
||||
|
||||
/* Sets fuse for grenades. Valid number is from 0.1-20.0 */
|
||||
/* types : new or preprimed */
|
||||
native dod_set_fuse(index,set=FUSE_SET,Float:newFuse=5.0, Type=FT_NEW);
|
||||
|
||||
/* Sets player class */
|
||||
native dod_set_user_class(index,classId);
|
||||
|
||||
/* Sets player team and random class. Don't work for spectators. */
|
||||
native dod_set_user_team(index,teamId,refresh=1);
|
||||
|
||||
/* Returns next player class. Usefull is player is using random class */
|
||||
native dod_get_next_class(index);
|
||||
|
||||
/* Returns 1 if player choose random class */
|
||||
native dod_is_randomclass(index);
|
||||
|
||||
/* Returns player deaths */
|
||||
native dod_get_pl_deaths(index);
|
||||
|
||||
/* Sets player deaths.
|
||||
* Note if you opt to refresh the scoreboard, it
|
||||
* will make the player appear as "DEAD" in the scoreboard.
|
||||
*/
|
||||
native dod_set_pl_deaths(index,value,refresh=1);
|
||||
|
||||
/* Returns player deaths. */
|
||||
native dod_get_user_kills(index);
|
||||
|
||||
/* Sets player kills. */
|
||||
native dod_set_user_kills(index,value,refresh=1);
|
||||
|
||||
/* Sets player score. */
|
||||
native dod_set_user_score(index,value,refresh=1);
|
||||
|
||||
/* Sets new team name for this player */
|
||||
native dod_set_pl_teamname(index,const szName[]);
|
||||
|
||||
/* Gets player team name */
|
||||
native dod_get_pl_teamname(index,szName[],len);
|
||||
|
||||
/* Returns 1 is player weapon is deployed (bar,mg..) */
|
||||
native dod_is_deployed(index);
|
||||
|
||||
/*Sets the ammo of the specified weapon entity id */
|
||||
native dod_set_user_ammo(index,wid,value);
|
||||
|
||||
/*Gets the ammo of the specified weapon entity id */
|
||||
native dod_get_user_ammo(index,wid);
|
||||
|
||||
/* called after first InitObj */
|
||||
forward controlpoints_init();
|
||||
|
||||
enum CP_VALUE {
|
||||
CP_edict = 1, // read only
|
||||
CP_area, // read only
|
||||
CP_index, // read only
|
||||
CP_owner,
|
||||
CP_default_owner,
|
||||
CP_visible, // reinit after change
|
||||
CP_icon_neutral, // reinit after change
|
||||
CP_icon_allies, // reinit after change
|
||||
CP_icon_axis, // reinit after change
|
||||
CP_origin_x, // reinit after change
|
||||
CP_origin_y, // reinit after change
|
||||
|
||||
CP_can_touch,
|
||||
CP_pointvalue,
|
||||
|
||||
CP_points_for_cap,
|
||||
CP_team_points,
|
||||
|
||||
CP_model_body_neutral,
|
||||
CP_model_body_allies,
|
||||
CP_model_body_axis,
|
||||
|
||||
// strings
|
||||
CP_name,
|
||||
CP_reset_capsound,
|
||||
CP_allies_capsound,
|
||||
CP_axis_capsound,
|
||||
CP_targetname,
|
||||
|
||||
CP_model_neutral,
|
||||
CP_model_allies,
|
||||
CP_model_axis,
|
||||
};
|
||||
|
||||
/* returns number of objectives */
|
||||
native objectives_get_num();
|
||||
|
||||
/* use this function to update client(s) hud. You need to do this sometimes. Check CP_VALUE comments.
|
||||
if player is 0 , all clients will get this message */
|
||||
native objectives_reinit( player=0 );
|
||||
|
||||
/* use this function to get info about specified control point */
|
||||
native objective_get_data( index, CP_VALUE:key, szValue[]="", len=0 );
|
||||
|
||||
/* use this function to change control point's data */
|
||||
native objective_set_data( index, CP_VALUE:key , iValue=-1, const szValue[]="" );
|
||||
|
||||
enum CA_VALUE {
|
||||
CA_edict = 1,
|
||||
CA_allies_numcap,
|
||||
CA_axis_numcap,
|
||||
CA_timetocap,
|
||||
CA_can_cap,
|
||||
|
||||
// strings
|
||||
CA_target,
|
||||
CA_sprite,
|
||||
};
|
||||
|
||||
/* use this function to get info about specified control point's area */
|
||||
native area_get_data( index, CA_VALUE:key, szValue[]="", len=0 );
|
||||
|
||||
/* use this function to change control point's area data */
|
||||
native area_set_data( index, CA_VALUE:key , iValue=-1, const szValue[]="" );
|
||||
@@ -0,0 +1,62 @@
|
||||
/* DoDX Stats functions
|
||||
*
|
||||
* (c) 2004, SidLuke
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _dodstats_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _dodstats_included
|
||||
|
||||
/* Gets stats from given weapon index. If wpnindex is 0
|
||||
* then the stats are from all weapons. If weapon has not been used function
|
||||
* returns 0 in other case 1. Fields in stats are:
|
||||
* 0 - kills
|
||||
* 1 - deaths
|
||||
* 2 - headshots
|
||||
* 3 - teamkilling
|
||||
* 4 - shots
|
||||
* 5 - hits
|
||||
* 6 - damage
|
||||
* 7 - score
|
||||
* For body hits fields see amxconst.inc. */
|
||||
native get_user_wstats(index,wpnindex,stats[9],bodyhits[8]);
|
||||
|
||||
/* Gets round stats from given weapon index.*/
|
||||
native get_user_wrstats(index,wpnindex,stats[9],bodyhits[8]);
|
||||
|
||||
/* Gets life (from spawn to spawn) stats from given weapon index.*/
|
||||
native get_user_wlstats(index,wpnindex,stats[9],bodyhits[8]);
|
||||
|
||||
/* Gets overall stats which are stored in file on server
|
||||
* and updated on every respawn or user disconnect.
|
||||
* Function returns the position in stats by diff. kills to deaths. */
|
||||
native get_user_stats(index,stats[9],bodyhits[8]);
|
||||
|
||||
/* Gets round stats of player. */
|
||||
native get_user_rstats(index,stats[9],bodyhits[8]);
|
||||
|
||||
/* Gets life (from spawn to spawn) stats of player. */
|
||||
native get_user_lstats(index,stats[9],bodyhits[8]);
|
||||
|
||||
/* Gets stats with which user have killed/hurt his victim. If victim is 0
|
||||
* then stats are from all victims. If victim has not been hurt, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_vstats(index,victim,stats[9],bodyhits[8],wpnname[]="",len=0);
|
||||
|
||||
/* Gets stats with which user have been killed/hurt. If killer is 0
|
||||
* then stats are from all attacks. If killer has not hurt user, function
|
||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
||||
native get_user_astats(index,wpnindex,stats[9],bodyhits[8],wpnname[]="",len=0);
|
||||
|
||||
/* Resets life, weapon, victims and attackers user stats. */
|
||||
native reset_user_wstats(index);
|
||||
|
||||
/* Gets overall stats which stored in stats.dat file in amx folder
|
||||
* and updated on every mapchange or user disconnect.
|
||||
* Function returns next index of stats entry or 0 if no more exists. */
|
||||
native get_stats(index,stats[9],bodyhits[8],name[],len);
|
||||
|
||||
/* Returns number of all entries in stats. */
|
||||
native get_statsnum();
|
||||
@@ -0,0 +1,158 @@
|
||||
/* DoDX functions
|
||||
*
|
||||
* (c) 2004, SidLuke
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _dodx_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _dodx_included
|
||||
|
||||
#include <dodconst>
|
||||
#include <dodstats>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqclass xstats
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma defclasslib xstats dodx
|
||||
#endif
|
||||
#else
|
||||
#pragma library dodx
|
||||
#endif
|
||||
|
||||
/************* Shared Natives Start ********************************/
|
||||
|
||||
/* Forward types */
|
||||
enum {
|
||||
XMF_DAMAGE = 0,
|
||||
XMF_DEATH,
|
||||
XMF_SCORE,
|
||||
};
|
||||
|
||||
/* Use this function to register forwards */
|
||||
native register_statsfwd(ftype);
|
||||
|
||||
/* Function is called after player to player attacks ,
|
||||
* if players were damaged by teammate TA is set to 1 */
|
||||
forward client_damage(attacker, victim, damage, wpnindex, hitplace, TA);
|
||||
|
||||
/* Function is called after player death ,
|
||||
* if player was killed by teammate TK is set to 1 */
|
||||
forward client_death(killer, victim, wpnindex, hitplace, TK);
|
||||
|
||||
/* Function is called if player scored */
|
||||
forward client_score(id, score, total);
|
||||
|
||||
/* This Forward is called when a player changes team */
|
||||
forward dod_client_changeteam(id, team, oldteam);
|
||||
|
||||
/* This Forward is called if a player changes class, but just after spawn */
|
||||
forward dod_client_changeclass(id, class, oldclass);
|
||||
|
||||
/* This Forward is called when a player spawns */
|
||||
forward dod_client_spawn(id);
|
||||
|
||||
/* This will be called whenever a player scopes or unscopes
|
||||
value = 1 scope up
|
||||
value = 0 scope down */
|
||||
forward dod_client_scope(id, value);
|
||||
|
||||
/* This will be called whenever a player drops a weapon
|
||||
weapon is weapon dropped or picked up
|
||||
value = 1 picked up
|
||||
value = 0 dropped */
|
||||
forward dod_client_weaponpickup(id, weapon, value);
|
||||
|
||||
/* Called whenever the the player goes to or comes from prone position
|
||||
value = 1 going down
|
||||
value = 0 getting up */
|
||||
forward dod_client_prone(id, value);
|
||||
|
||||
/* This will be called whenever a player switches a weapon */
|
||||
forward dod_client_weaponswitch(id, wpnew, wpnold);
|
||||
|
||||
/* Forward for when a grenade explodes and its location */
|
||||
forward dod_grenade_explosion(id, pos[3], wpnid);
|
||||
|
||||
/* Forward for when a rocket explodes and its location */
|
||||
forward dod_rocket_explosion(id, pos[3], wpnid);
|
||||
|
||||
/* Forward for when a player picks up a object */
|
||||
forward dod_client_objectpickup(id, objid, pos[3], value);
|
||||
|
||||
/* Forward for when a users stamina decreases */
|
||||
forward dod_client_stamina(id, stamina);
|
||||
|
||||
/* We want to get just the weapon of whichever type that the player is on him
|
||||
Use DODWT_* in dodconst.inc for type */
|
||||
native dod_weapon_type(id, type);
|
||||
|
||||
/* This native will change the position of a weapon within the users slots and its ammo ammount */
|
||||
native dod_set_weaponlist(id, wpnID, slot, dropslot, totalrds);
|
||||
|
||||
/* Sets the model for a player */
|
||||
native dod_set_model(id, const model[]);
|
||||
|
||||
/* Sets the model for a player */
|
||||
native dod_set_body_number(id, bodynumber);
|
||||
|
||||
/* Un-Sets the model for a player */
|
||||
native dod_clear_model(id);
|
||||
|
||||
/* Custom Weapon Support */
|
||||
/* function will return index of new weapon */
|
||||
native custom_weapon_add( const wpnname[], melee = 0, const logname[]="" );
|
||||
|
||||
/* Function will pass damage done by this custom weapon to stats module and other plugins */
|
||||
native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 );
|
||||
|
||||
/* Function will pass info about custom weapon shot to stats module */
|
||||
native custom_weapon_shot( weapon, index ); // weapon id , player id
|
||||
|
||||
/* function will return 1 if true */
|
||||
native xmod_is_melee_wpn(wpnindex);
|
||||
|
||||
/* Returns weapon name. */
|
||||
native xmod_get_wpnname(wpnindex, name[], len);
|
||||
|
||||
/* Returns weapon logname. */
|
||||
native xmod_get_wpnlogname(wpnindex, name[], len);
|
||||
|
||||
/* Returns weapons array size */
|
||||
native xmod_get_maxweapons();
|
||||
|
||||
/* Returns stats array size ex. 8 in TS , 9 in DoD */
|
||||
native xmod_get_stats_size();
|
||||
|
||||
/* Returns 1 if true */
|
||||
native xmod_is_custom_wpn(wpnindex);
|
||||
|
||||
/************* Shared Natives End ********************************/
|
||||
|
||||
/* weapon logname to weapon name convertion */
|
||||
native dod_wpnlog_to_name(const logname[],name[],len);
|
||||
|
||||
/* weapon logname to weapon index convertion */
|
||||
native dod_wpnlog_to_id(const logname[]);
|
||||
|
||||
native dod_get_map_info( info );
|
||||
|
||||
/* Returns id of currently carried weapon. Gets also
|
||||
* ammount of ammo in clip and backpack. */
|
||||
native dod_get_user_weapon(index,&clip=0,&ammo=0);
|
||||
|
||||
/* Returns team score */
|
||||
native dod_get_team_score(teamId);
|
||||
|
||||
/* Returns player class id */
|
||||
native dod_get_user_class(index);
|
||||
|
||||
/* Returns player score */
|
||||
native dod_get_user_score(index);
|
||||
|
||||
/* values are: 0-no prone, 1-prone, 2-prone + w_deploy */
|
||||
native dod_get_pronestate(index);
|
||||
|
||||
/* It is not as safe as original but player deaths will not be increased */
|
||||
native dod_user_kill(index);
|
||||
@@ -0,0 +1,241 @@
|
||||
/* Engine functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* thanks to Vexd and mahnsawce
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _engine_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _engine_included
|
||||
|
||||
#include <engine_const>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib engine
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib engine
|
||||
#endif
|
||||
#else
|
||||
#pragma library engine
|
||||
#endif
|
||||
|
||||
native traceresult(type,any:...);
|
||||
|
||||
/* Registers a client impulse to a function. Function is passed the ID of the user. */
|
||||
native register_impulse(impulse, const function[]);
|
||||
|
||||
/* Registers a touch action to a function by classnames. Use * to specify any classname. */
|
||||
native register_touch(const Touched[], const Toucher[], const function[]);
|
||||
|
||||
/* Registers a think action to a function by classname. */
|
||||
native register_think(const Classname[], const function[]);
|
||||
|
||||
/* NOTE: In old engine versions, this was not the case. Values are now WINDOWS values.
|
||||
* You must pass with the windows offset (e.g. if 230 on windows, pass 230 no matter what)
|
||||
* The module will automatically add +5 for Linux.
|
||||
*/
|
||||
|
||||
/* Precaches an event. */
|
||||
native precache_event(type, const Name[], any:...);
|
||||
|
||||
/* set/get a user's speak flags */
|
||||
native set_speak(iIndex, iSpeakFlags);
|
||||
native get_speak(iIndex);
|
||||
|
||||
/* Drops an entity to the floor (work?) */
|
||||
native drop_to_floor(entity);
|
||||
|
||||
/* Get whole buffer containing keys and their data. */
|
||||
native get_info_keybuffer(id, buffer[], length);
|
||||
|
||||
/* Use an entity with another entity. "entUsed" could be a hostage, "entUser" a player. */
|
||||
native force_use(entUsed, entUser);
|
||||
|
||||
/* Get globals from server. */
|
||||
native Float:get_global_float(variable);
|
||||
native get_global_int(variable);
|
||||
native get_global_string(variable, string[], maxlen);
|
||||
native get_global_vector(variable, Float:vector[3]);
|
||||
native get_global_edict(variable);
|
||||
|
||||
/* Set entity bounds. */
|
||||
native entity_set_size(index, const Float:mins[3], const Float:maxs[3]);
|
||||
|
||||
/* Get decal index */
|
||||
native get_decal_index(const szDecalName[]);
|
||||
|
||||
/* Returns the distance between two entities. */
|
||||
native Float:entity_range(ida,idb);
|
||||
|
||||
/* Sets/gets things in an entities Entvars Struct. */
|
||||
native entity_get_int(iIndex, iKey);
|
||||
native entity_set_int(iIndex, iKey, iVal);
|
||||
native Float:entity_get_float(iIndex, iKey);
|
||||
native entity_set_float(iIndex, iKey, Float:iVal);
|
||||
native entity_get_vector(iIndex, iKey, Float:vRetVector[3]);
|
||||
native entity_set_vector(iIndex, iKey, const Float:vNewVector[3]);
|
||||
native entity_get_edict(iIndex, iKey);
|
||||
native entity_set_edict(iIndex, iKey, iNewIndex);
|
||||
native entity_get_string(iIndex, iKey, szReturn[], iRetLen);
|
||||
native entity_set_string(iIndex, iKey, const szNewVal[]);
|
||||
native entity_get_byte(iIndex, iKey);
|
||||
native entity_set_byte(iIndex, iKey, iVal);
|
||||
|
||||
/* Creates an entity, will return the index of the created entity. ClassName must be valid. */
|
||||
native create_entity(const szClassname[]);
|
||||
|
||||
/* Finds an entity in the world, will return 0 if nothing is found */
|
||||
native find_ent_by_class(iIndex, const szClass[]);
|
||||
//optionally you can set a jghg2 type
|
||||
// 1: target, 2:targetname, 0:classname (default)
|
||||
native find_ent_by_owner(iIndex, const szClass[], iOwner, iJghgType=0);
|
||||
native find_ent_by_target(iIndex, const szClass[]);
|
||||
native find_ent_by_tname(iIndex, const szClass[]);
|
||||
native find_ent_by_model(iIndex, const szClass[], const szModel[]);
|
||||
native find_ent_in_sphere(start_from_ent, const Float:origin[3], Float:radius);
|
||||
|
||||
//this will CBaseEntity::Think() or something from the entity
|
||||
native call_think(entity);
|
||||
|
||||
/* Is entity valid? */
|
||||
native is_valid_ent(iIndex);
|
||||
|
||||
/* Proper origin setting, keeps updated with Half-Life engine. */
|
||||
native entity_set_origin(iIndex, const Float:fNewOrigin[3]);
|
||||
|
||||
/* Sets the model of an Entity. */
|
||||
native entity_set_model(iIndex, const szModel[]);
|
||||
|
||||
/* Remove an entity from the world. */
|
||||
native remove_entity(iIndex);
|
||||
|
||||
/* Return current number of entities in the map */
|
||||
native entity_count();
|
||||
|
||||
/* Simulate two entities colliding/touching. */
|
||||
native fake_touch(entTouched, entToucher);
|
||||
|
||||
/* 2 formats.
|
||||
Format: DispatchKeyValue("KeyName","Value") - sets keyvalues for the entity specified in the keyvalue() forward.
|
||||
Format: DispatchKeyValue(index,"KeyName","Value") - Sets keyvalue for entity not specified in keyvalue() forward. */
|
||||
#if !defined AMXMOD_BCOMPAT
|
||||
native DispatchKeyValue(...);
|
||||
#endif
|
||||
|
||||
native get_keyvalue(entity, const szKey[], value[], maxLength);
|
||||
|
||||
native copy_keyvalue(szClassName[],sizea,szKeyName[],sizeb,szValue[],sizec);
|
||||
|
||||
/* Runs the GameDLL's DispatchSpawn for an entity, I think it's used with DispatchKeyValue. */
|
||||
native DispatchSpawn(iIndex);
|
||||
|
||||
/* Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage. */
|
||||
#if !defined AMXMOD_BCOMPAT
|
||||
native radius_damage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
|
||||
#endif
|
||||
|
||||
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
|
||||
native point_contents(const Float:fCheckAt[3]);
|
||||
|
||||
/* Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]
|
||||
* and an entity index if an entity is hit. */
|
||||
#if !defined AMXMOD_BCOMPAT
|
||||
native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
|
||||
#endif
|
||||
|
||||
/* Traces a hull. */
|
||||
native trace_hull(const Float:origin[3],hull,ignoredent=0,ignoremonsters=0);
|
||||
|
||||
/* Traces a line, and returns the normal to the plane hit in vReturn.
|
||||
* Returns 0 if theres no normal. */
|
||||
native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
|
||||
|
||||
/* Gets the ID of a grenade. */
|
||||
native get_grenade_id(id, model[], len, grenadeid = 0);
|
||||
|
||||
/* Gets gpGlobals->time from Half-Life */
|
||||
native Float:halflife_time();
|
||||
|
||||
/* Sets map lighting, #OFF to disable. */
|
||||
native set_lights(const Lighting[]);
|
||||
|
||||
/* Sets Player's View to entity iTargetIndex. */
|
||||
native attach_view(iIndex, iTargetIndex);
|
||||
|
||||
/* Sets Player's View Mode.
|
||||
* rpgrocket.mdl must be precached in order for this function to work */
|
||||
native set_view(iIndex, ViewType);
|
||||
|
||||
/* Direct copy of PLAYBACK_EVENT_FULL from Metamod/HLSDK. If you don't know how that works, you probably shouldn't be using it. */
|
||||
native playback_event(flags,invoker,eventindex,Float:delay,const Float:origin[3],const Float:angles[3],Float:fparam1,Float:fparam2,iparam1,iparam2,bparam1,bparam2);
|
||||
|
||||
/* Gets parameters sent from CmdStart.
|
||||
Note that you will receive modified values if any other plugin have
|
||||
changed them. */
|
||||
native get_usercmd(type,any:...);
|
||||
|
||||
/* Sets the parameters sent from CmdStart.
|
||||
Note that your changes will be seen by any other plugin doing get_usercmd() */
|
||||
native set_usercmd(type,any:...);
|
||||
|
||||
/* Converts a string offset into a real string. Some of the forwards in fakemeta
|
||||
uses string offsets. (FM_CreateNamedEntity) */
|
||||
native eng_get_string(_string, _returnString[], _len);
|
||||
|
||||
/* FORWARDS
|
||||
**********/
|
||||
|
||||
/* Called when 2 entities touch.
|
||||
* ptr - touched entity
|
||||
* ptd - toucher entity
|
||||
*/
|
||||
forward pfn_touch(ptr, ptd);
|
||||
|
||||
/* Called once every server frame. May cause lag. */
|
||||
forward server_frame();
|
||||
|
||||
/* Called when a client types kill in console. */
|
||||
forward client_kill(id);
|
||||
|
||||
/* Forward for PreThink()/PostThink() on a player. */
|
||||
forward client_PreThink(id);
|
||||
forward client_PostThink(id);
|
||||
|
||||
/* Forward for impulses. */
|
||||
forward client_impulse(id, impulse);
|
||||
|
||||
/* Called when an entity "thinks" (DispatchThink) */
|
||||
forward pfn_think(entid);
|
||||
|
||||
/* Called when an event is played */
|
||||
forward pfn_playbackevent(flags, entid, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2);
|
||||
|
||||
/* Called when an entity gets a keyvalue set on it from the engine (ie: map load) Use copy_keyvalue to get the keyvalue information */
|
||||
forward pfn_keyvalue(entid);
|
||||
|
||||
/* Called when an entity is spawned */
|
||||
forward pfn_spawn(entid);
|
||||
|
||||
//from jghg2
|
||||
/* As above, but returns number of ents stored in entlist. Use to find a specific type of entity classname (specify in _lookforclassname) around a
|
||||
* certain entity specified in aroundent. All matching ents are stored in entlist. Specify max amount of entities to find in maxents.
|
||||
* If aroundent is 0 its origin is not used, but origin in 6th parameter. Ie, do not specify 6th parameter (origin) if you specified an entity
|
||||
* in aroundent.
|
||||
*/
|
||||
native find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3] = {0.0, 0.0, 0.0});
|
||||
|
||||
/* SDK function - checks if an origin is in an entity's view cone
|
||||
* Set use3d to 1 to do the calculation in 3D. Otherwise it will be in 2D.
|
||||
*/
|
||||
native is_in_viewcone(entity, const Float:origin[3], use3d = 0);
|
||||
|
||||
//SDK function - checks if an entity is visible to an entity
|
||||
native is_visible(entity, target);
|
||||
|
||||
//Added at twistedeuphoria's request, see funcwiki for details
|
||||
native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh);
|
||||
|
||||
#include <engine_stocks>
|
||||
@@ -0,0 +1,261 @@
|
||||
/* Engine constants
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _engine_const_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _engine_const_included
|
||||
|
||||
#include <hlsdk_const>
|
||||
|
||||
#define SPEAK_NORMAL 0
|
||||
#define SPEAK_MUTED 1
|
||||
#define SPEAK_ALL 2
|
||||
#define SPEAK_LISTENALL 4
|
||||
|
||||
#define CAMERA_NONE 0
|
||||
#define CAMERA_3RDPERSON 1
|
||||
#define CAMERA_UPLEFT 2
|
||||
#define CAMERA_TOPDOWN 3
|
||||
|
||||
/* Int */
|
||||
enum {
|
||||
EV_INT_gamestate = 0,
|
||||
EV_INT_oldbuttons,
|
||||
EV_INT_groupinfo,
|
||||
EV_INT_iuser1,
|
||||
EV_INT_iuser2,
|
||||
EV_INT_iuser3,
|
||||
EV_INT_iuser4,
|
||||
EV_INT_weaponanim,
|
||||
EV_INT_pushmsec,
|
||||
EV_INT_bInDuck,
|
||||
EV_INT_flTimeStepSound,
|
||||
EV_INT_flSwimTime,
|
||||
EV_INT_flDuckTime,
|
||||
EV_INT_iStepLeft,
|
||||
EV_INT_movetype,
|
||||
EV_INT_solid,
|
||||
EV_INT_skin,
|
||||
EV_INT_body,
|
||||
EV_INT_effects,
|
||||
EV_INT_light_level,
|
||||
EV_INT_sequence,
|
||||
EV_INT_gaitsequence,
|
||||
EV_INT_modelindex,
|
||||
EV_INT_playerclass,
|
||||
EV_INT_waterlevel,
|
||||
EV_INT_watertype,
|
||||
EV_INT_spawnflags,
|
||||
EV_INT_flags,
|
||||
EV_INT_colormap,
|
||||
EV_INT_team,
|
||||
EV_INT_fixangle,
|
||||
EV_INT_weapons,
|
||||
EV_INT_rendermode,
|
||||
EV_INT_renderfx,
|
||||
EV_INT_button,
|
||||
EV_INT_impulse,
|
||||
EV_INT_deadflag,
|
||||
};
|
||||
|
||||
/* Float */
|
||||
enum {
|
||||
EV_FL_impacttime = 0,
|
||||
EV_FL_starttime,
|
||||
EV_FL_idealpitch,
|
||||
EV_FL_pitch_speed,
|
||||
EV_FL_ideal_yaw,
|
||||
EV_FL_yaw_speed,
|
||||
EV_FL_ltime,
|
||||
EV_FL_nextthink,
|
||||
EV_FL_gravity,
|
||||
EV_FL_friction,
|
||||
EV_FL_frame,
|
||||
EV_FL_animtime,
|
||||
EV_FL_framerate,
|
||||
EV_FL_health,
|
||||
EV_FL_frags,
|
||||
EV_FL_takedamage,
|
||||
EV_FL_max_health,
|
||||
EV_FL_teleport_time,
|
||||
EV_FL_armortype,
|
||||
EV_FL_armorvalue,
|
||||
EV_FL_dmg_take,
|
||||
EV_FL_dmg_save,
|
||||
EV_FL_dmg,
|
||||
EV_FL_dmgtime,
|
||||
EV_FL_speed,
|
||||
EV_FL_air_finished,
|
||||
EV_FL_pain_finished,
|
||||
EV_FL_radsuit_finished,
|
||||
EV_FL_scale,
|
||||
EV_FL_renderamt,
|
||||
EV_FL_maxspeed,
|
||||
EV_FL_fov,
|
||||
EV_FL_flFallVelocity,
|
||||
EV_FL_fuser1,
|
||||
EV_FL_fuser2,
|
||||
EV_FL_fuser3,
|
||||
EV_FL_fuser4,
|
||||
};
|
||||
|
||||
/* Vector */
|
||||
enum {
|
||||
EV_VEC_origin = 0,
|
||||
EV_VEC_oldorigin,
|
||||
EV_VEC_velocity,
|
||||
EV_VEC_basevelocity,
|
||||
EV_VEC_clbasevelocity,
|
||||
EV_VEC_movedir,
|
||||
EV_VEC_angles,
|
||||
EV_VEC_avelocity,
|
||||
EV_VEC_punchangle,
|
||||
EV_VEC_v_angle,
|
||||
EV_VEC_endpos,
|
||||
EV_VEC_startpos,
|
||||
EV_VEC_absmin,
|
||||
EV_VEC_absmax,
|
||||
EV_VEC_mins,
|
||||
EV_VEC_maxs,
|
||||
EV_VEC_size,
|
||||
EV_VEC_rendercolor,
|
||||
EV_VEC_view_ofs,
|
||||
EV_VEC_vuser1,
|
||||
EV_VEC_vuser2,
|
||||
EV_VEC_vuser3,
|
||||
EV_VEC_vuser4,
|
||||
};
|
||||
|
||||
/* Edict */
|
||||
enum {
|
||||
EV_ENT_chain = 0,
|
||||
EV_ENT_dmg_inflictor,
|
||||
EV_ENT_enemy,
|
||||
EV_ENT_aiment,
|
||||
EV_ENT_owner,
|
||||
EV_ENT_groundentity,
|
||||
EV_ENT_pContainingEntity,
|
||||
EV_ENT_euser1,
|
||||
EV_ENT_euser2,
|
||||
EV_ENT_euser3,
|
||||
EV_ENT_euser4,
|
||||
};
|
||||
|
||||
/* String */
|
||||
enum {
|
||||
EV_SZ_classname = 0,
|
||||
EV_SZ_globalname,
|
||||
EV_SZ_model,
|
||||
EV_SZ_target,
|
||||
EV_SZ_targetname,
|
||||
EV_SZ_netname,
|
||||
EV_SZ_message,
|
||||
EV_SZ_noise,
|
||||
EV_SZ_noise1,
|
||||
EV_SZ_noise2,
|
||||
EV_SZ_noise3,
|
||||
EV_SZ_viewmodel,
|
||||
EV_SZ_weaponmodel,
|
||||
};
|
||||
|
||||
/* Byte */
|
||||
enum {
|
||||
EV_BYTE_controller1 = 0,
|
||||
EV_BYTE_controller2,
|
||||
EV_BYTE_controller3,
|
||||
EV_BYTE_controller4,
|
||||
EV_BYTE_blending1,
|
||||
EV_BYTE_blending2,
|
||||
};
|
||||
|
||||
#if defined _jghg_enums
|
||||
#endinput
|
||||
#endif
|
||||
#define _jghg_enums
|
||||
enum {
|
||||
// Edict
|
||||
GL_trace_ent = 0,
|
||||
|
||||
// Float
|
||||
GL_coop,
|
||||
GL_deathmatch,
|
||||
GL_force_retouch,
|
||||
GL_found_secrets,
|
||||
GL_frametime,
|
||||
GL_serverflags,
|
||||
GL_teamplay,
|
||||
GL_time,
|
||||
GL_trace_allsolid,
|
||||
GL_trace_fraction,
|
||||
GL_trace_inopen,
|
||||
GL_trace_inwater,
|
||||
GL_trace_plane_dist,
|
||||
GL_trace_startsolid,
|
||||
|
||||
// Int
|
||||
GL_cdAudioTrack,
|
||||
GL_maxClients,
|
||||
GL_maxEntities,
|
||||
GL_msg_entity,
|
||||
GL_trace_flags,
|
||||
GL_trace_hitgroup,
|
||||
|
||||
// String
|
||||
GL_pStringBase,
|
||||
GL_mapname,
|
||||
GL_startspot,
|
||||
|
||||
// Vector
|
||||
GL_trace_endpos,
|
||||
GL_trace_plane_normal,
|
||||
GL_v_forward,
|
||||
GL_v_right,
|
||||
GL_v_up,
|
||||
GL_vecLandmarkOffset,
|
||||
|
||||
// Void (not supported)
|
||||
GL_pSaveData
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
usercmd_float_start,
|
||||
usercmd_forwardmove, // Float
|
||||
usercmd_sidemove, // Float
|
||||
usercmd_upmove, // Float
|
||||
usercmd_float_end,
|
||||
usercmd_int_start,
|
||||
usercmd_lerp_msec, // short
|
||||
usercmd_msec, // byte
|
||||
usercmd_lightlevel, // byte
|
||||
usercmd_buttons, // unsigned short
|
||||
usercmd_impulse, // byte
|
||||
usercmd_weaponselect, // byte
|
||||
usercmd_impact_index, // int
|
||||
usercmd_int_end,
|
||||
usercmd_vec_start,
|
||||
usercmd_viewangles, // Vector
|
||||
usercmd_impact_position, // vec
|
||||
usercmd_vec_end
|
||||
};
|
||||
|
||||
// Used by the traceresult() native.
|
||||
enum
|
||||
{
|
||||
TR_AllSolid, // (int) if true, plane is not valid
|
||||
TR_StartSolid, // (int) if true, the initial point was in a solid area
|
||||
TR_InOpen, // (int)
|
||||
TR_InWater, // (int)
|
||||
TR_Fraction, // (float) time completed, 1.0 = didn't hit anything
|
||||
TR_EndPos, // (vector) final position
|
||||
TR_PlaneDist, // (float)
|
||||
TR_PlaneNormal, // (vector) surface normal at impact
|
||||
TR_Hit, // (entity) entity the surface is on
|
||||
TR_Hitgroup // (int) 0 == generic, non zero is specific body part
|
||||
};
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
/* Engine stocks
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* thanks to AssKicR, Freecode and T(+)rget
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _engine_stocks_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _engine_stocks_included
|
||||
|
||||
#if !defined _amxmodx_included
|
||||
#include <amxmodx>
|
||||
#endif
|
||||
|
||||
#if !defined _engine_included
|
||||
#include <engine>
|
||||
#endif
|
||||
|
||||
stock fakedamage(idvictim,const szClassname[],Float:takedmgdamage,damagetype)
|
||||
{
|
||||
new entity = create_entity("trigger_hurt");
|
||||
if (entity)
|
||||
{
|
||||
DispatchKeyValue(entity,"classname","trigger_hurt");
|
||||
new szDamage[16];
|
||||
// Takedamages only do half damage per attack (damage is damage per second, and it's triggered in 0.5 second intervals).
|
||||
// Compensate for that.
|
||||
format(szDamage,15,"%f",takedmgdamage * 2);
|
||||
DispatchKeyValue(entity,"dmg",szDamage);
|
||||
format(szDamage,15,"%i",damagetype);
|
||||
DispatchKeyValue(entity,"damagetype",szDamage);
|
||||
DispatchKeyValue(entity,"origin","8192 8192 8192");
|
||||
DispatchSpawn(entity);
|
||||
entity_set_string(entity, EV_SZ_classname, szClassname);
|
||||
fake_touch(entity,idvictim);
|
||||
remove_entity(entity);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//wrapper for find_ent_by_class
|
||||
stock find_ent(iStart, const szClassname[])
|
||||
{
|
||||
return find_ent_by_class(iStart, szClassname);
|
||||
}
|
||||
|
||||
/* Get the Button(s) user is pressing */
|
||||
stock get_user_button(id)
|
||||
{
|
||||
return entity_get_int(id, EV_INT_button);
|
||||
}
|
||||
|
||||
stock get_user_oldbutton(id)
|
||||
{
|
||||
return entity_get_int(id, EV_INT_oldbuttons);
|
||||
}
|
||||
|
||||
/* Get flags an entity is flagged with */
|
||||
stock get_entity_flags(ent)
|
||||
{
|
||||
return entity_get_int(ent, EV_INT_flags);
|
||||
}
|
||||
|
||||
/* Get the distance between two entities */
|
||||
stock get_entity_distance(ent1, ent2)
|
||||
{
|
||||
return floatround(entity_range(ent1, ent2));
|
||||
}
|
||||
|
||||
/* Get grenade thrown by this user */
|
||||
stock get_grenade(id)
|
||||
{
|
||||
new iGrenade = find_ent_by_class(-1, "grenade");
|
||||
while(iGrenade > 0)
|
||||
{
|
||||
if(entity_get_edict(iGrenade, EV_ENT_owner) == id)
|
||||
return iGrenade;
|
||||
|
||||
iGrenade = find_ent_by_class(iGrenade, "grenade");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get origin of a brush entity */
|
||||
stock get_brush_entity_origin(ent, Float:orig[3])
|
||||
{
|
||||
new Float:Min[3], Float:Max[3];
|
||||
|
||||
entity_get_vector(ent, EV_VEC_origin, orig);
|
||||
entity_get_vector(ent, EV_VEC_mins, Min);
|
||||
entity_get_vector(ent, EV_VEC_maxs, Max);
|
||||
|
||||
orig[0] += (Min[0] + Max[0]) * 0.5;
|
||||
orig[1] += (Min[1] + Max[1]) * 0.5;
|
||||
orig[2] += (Min[2] + Max[2]) * 0.5;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Remove entity by name */
|
||||
stock remove_entity_name(const eName[])
|
||||
{
|
||||
new iEntity = find_ent_by_class(-1, eName);
|
||||
while (iEntity > 0)
|
||||
{
|
||||
remove_entity(iEntity);
|
||||
iEntity = find_ent_by_class(-1, eName);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get the contents of the point a user is aiming at */
|
||||
stock ViewContents(id)
|
||||
{
|
||||
new origin[3], Float:Orig[3];
|
||||
get_user_origin(id, origin, 3);
|
||||
Orig[0] = float(origin[0]);
|
||||
Orig[1] = float(origin[1]);
|
||||
Orig[2] = float(origin[2]);
|
||||
|
||||
return point_contents(Orig);
|
||||
}
|
||||
|
||||
stock get_speed(ent)
|
||||
{
|
||||
new Float:Vel[3];
|
||||
entity_get_vector(ent, EV_VEC_velocity, Vel);
|
||||
|
||||
return floatround(vector_length(Vel));
|
||||
}
|
||||
|
||||
/* Set rendering of an entity */
|
||||
stock set_rendering(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16)
|
||||
{
|
||||
entity_set_int(index,EV_INT_renderfx,fx);
|
||||
new Float:RenderColor[3];
|
||||
RenderColor[0] = float(r);
|
||||
RenderColor[1] = float(g);
|
||||
RenderColor[2] = float(b);
|
||||
entity_set_vector(index,EV_VEC_rendercolor,RenderColor);
|
||||
entity_set_int(index,EV_INT_rendermode,render);
|
||||
entity_set_float(index,EV_FL_renderamt,float(amount));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Set flags on an entity */
|
||||
stock set_entity_flags(ent,flag,onoff)
|
||||
{
|
||||
if ((entity_get_int(ent,EV_INT_flags)&flag) > 0)
|
||||
{
|
||||
if (onoff == 1)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
entity_set_int(ent,EV_INT_flags,entity_get_int(ent,EV_INT_flags)-flag);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (onoff == 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
entity_set_int(ent,EV_INT_flags,entity_get_int(ent,EV_INT_flags)+flag);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If visible = 1, entity will be set to be visible, else invisible. */
|
||||
stock set_entity_visibility(entity, visible = 1)
|
||||
{
|
||||
entity_set_int(entity, EV_INT_effects, visible == 1 ? entity_get_int(entity, EV_INT_effects) & ~EF_NODRAW : entity_get_int(entity, EV_INT_effects) | EF_NODRAW);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Returns 1 if entity is visible. */
|
||||
stock get_entity_visibility(entity)
|
||||
{
|
||||
return !(entity_get_int(entity, EV_INT_effects) & EF_NODRAW);
|
||||
}
|
||||
|
||||
stock set_user_velocity(entity, const Float:vec[3])
|
||||
{
|
||||
return entity_set_vector(entity, EV_VEC_velocity, vec);
|
||||
}
|
||||
|
||||
stock get_user_velocity(entity, Float:vec[3])
|
||||
{
|
||||
return entity_get_vector(entity, EV_VEC_velocity, vec);
|
||||
}
|
||||
|
||||
/* Backwards compatible */
|
||||
/* Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage. */
|
||||
stock RadiusDamage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier)
|
||||
{
|
||||
return radius_damage(fExplodeAt, iDamageMultiplier, iRadiusMultiplier);
|
||||
}
|
||||
/* Gives you a velocity in the direction a player is looking, iVelocity is the multiplier. */
|
||||
stock VelocityByAim(iIndex,iVelocity, Float:vRetValue[3])
|
||||
{
|
||||
return velocity_by_aim(iIndex,iVelocity,vRetValue);
|
||||
}
|
||||
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
|
||||
stock PointContents(const Float:fCheckAt[3])
|
||||
{
|
||||
return point_contents(fCheckAt);
|
||||
}
|
||||
|
||||
stock set_size(index, const Float:mins[3], const Float:maxs[3])
|
||||
{
|
||||
return entity_set_size(index,mins,maxs);
|
||||
}
|
||||
|
||||
//by Twilight Suzuka, request addition at29428
|
||||
//"Lifted from HLSDK"
|
||||
stock IsInWorld( ent )
|
||||
{
|
||||
new Float:origin[3];
|
||||
entity_get_vector(ent,EV_VEC_origin,origin);
|
||||
|
||||
if (origin[0] >= 4096.0) return 0;
|
||||
if (origin[1] >= 4096.0) return 0;
|
||||
if (origin[2] >= 4096.0) return 0;
|
||||
if (origin[0] <= -4096.0) return 0;
|
||||
if (origin[1] <= -4096.0) return 0;
|
||||
if (origin[2] <= -4096.0) return 0;
|
||||
|
||||
new Float:velocity[3];
|
||||
entity_get_vector(ent,EV_VEC_velocity,velocity);
|
||||
|
||||
if (velocity[0] >= 2000) return 0;
|
||||
if (velocity[1] >= 2000) return 0;
|
||||
if (velocity[2] >= 2000) return 0;
|
||||
if (velocity[0] <= -2000) return 0;
|
||||
if (velocity[1] <= -2000) return 0;
|
||||
if (velocity[2] <= -2000) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/***********************************************
|
||||
|
||||
[ Corona-Bytes.NET ] EvolutionX Core Plugin
|
||||
|
||||
(c) Corona - Bytes .NET coders :: coders@corona-bytes.net
|
||||
|
||||
> 2005 Corona Bytes :: http://www.corona-bytes.net
|
||||
|
||||
***********************************************/
|
||||
|
||||
#if defined __EVOLUTION_CORE__
|
||||
#endinput
|
||||
#endif
|
||||
#define __EVOLUTION_CORE__
|
||||
|
||||
#pragma library EvolutionXCore
|
||||
|
||||
native setClientPL ( Client, PowerLevel );
|
||||
native getClientPL ( Client );
|
||||
native setClientACPL ( Client, ActualPowerLevel );
|
||||
native getClientACPL ( Client );
|
||||
native setClientADPL ( Client, AfterDeathPowerLevel );
|
||||
native getClientADPL ( Client );
|
||||
native setClientSPL ( Client, PowerLevel );
|
||||
native setClientPLtoADPL ( Client );
|
||||
|
||||
native setClientKI ( Client, Ki );
|
||||
native getClientKI ( Client );
|
||||
|
||||
native setClientHP ( Client, Health );
|
||||
native getClientHP ( Client );
|
||||
native setClientMHP ( Client, MaximumHealth );
|
||||
native getClientMHP ( Client );
|
||||
|
||||
native setClientSPEED ( Client, Speed );
|
||||
native getClientSPEED ( Client );
|
||||
native setClientSWOOPSPEED ( Client, SwoopSpeed );
|
||||
native getClientSWOOPSPEED ( Client );
|
||||
|
||||
native setClientPROTECT ( Client, bool:Enable = true );
|
||||
native getClientPROTECT ( Client );
|
||||
|
||||
native setClientFROZEN ( Client, bool:Enable = true );
|
||||
native getClientFROZEN ( Client );
|
||||
|
||||
native setClientGOD ( Client, bool:Enable = true );
|
||||
native getClientGOD ( Client );
|
||||
|
||||
native getClientFLY ( Client );
|
||||
|
||||
native setClientHiddenTURBO ( Client, bool:Enable = true );
|
||||
native getClientTURBO ( Client );
|
||||
|
||||
native getClientBLOCK ( Client );
|
||||
|
||||
native setClientHiddenPOWERUP ( Client, bool:Enable = true );
|
||||
native getClientPOWERUP ( Client );
|
||||
|
||||
native getClientSWOOPING ( Client );
|
||||
native getClientATKSHOOT ( Client );
|
||||
native getClientATKCHARGE ( Client );
|
||||
native getClientMELEE ( Client );
|
||||
native getClientTHROWAWAY ( Client );
|
||||
native getClientTHROW ( Client );
|
||||
native getClientWALLGND ( Client );
|
||||
native getClientINFREEFALL ( Client );
|
||||
native getClientBEAMJUMP ( Client );
|
||||
|
||||
// kills a player without score/death msg
|
||||
native silentClientKILL ( Client );
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* (C)2004-2005 AMX Mod X Development Team
|
||||
* based on the stocks and information provided by LynX
|
||||
* organized and released by BAILOPAN
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _esfconst_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _esfconst_included
|
||||
|
||||
enum
|
||||
{
|
||||
Character_Buu = 1,
|
||||
Character_Goku = 2,
|
||||
Character_Gohan = 3, //my favorite :)
|
||||
Character_Krillin = 4,
|
||||
Character_Frieza = 5,
|
||||
Character_Piccolo = 6,
|
||||
Character_Trunks = 7,
|
||||
Character_Vegeta = 8,
|
||||
Character_Cell = 9,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Explosion_Blue = 0,
|
||||
Explosion_Green,
|
||||
Explosion_Orange,
|
||||
Explosion_Purple,
|
||||
Explosion_Yellow,
|
||||
Explosion_Red,
|
||||
Explosion_White,
|
||||
Explosions_Total,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Attack_Kamehameha=1,
|
||||
Attack_SpiritBomb,
|
||||
Attack_GalletGun,
|
||||
Attack_FinalFlash,
|
||||
Attack_Renzoku,
|
||||
Attack_Kametorpedo,
|
||||
Attack_GenericBeam,
|
||||
Attack_Throw,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Direction_Left=1,
|
||||
Direction_Right,
|
||||
Direction_Up,
|
||||
Direction_Down,
|
||||
Direction_Forward,
|
||||
Direction_Backward,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Recovery_Kicked=1,
|
||||
Recovery_Tumbled,
|
||||
Recovery_Lying,
|
||||
Recovery_Thrown,
|
||||
};
|
||||
|
||||
#define ESF_CHARGING 1
|
||||
#define ESF_CONTROLLING 2
|
||||
#define ESF_SHOOTING 3
|
||||
#define ESF_SHOT 4
|
||||
@@ -0,0 +1,260 @@
|
||||
/* FakeMeta functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _fakemeta_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fakemeta_included
|
||||
|
||||
#include <fakemeta_const>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib fakemeta
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib fakemeta
|
||||
#endif
|
||||
#else
|
||||
#pragma library fakemeta
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns entvar data from an entity. Use the pev_* enum (in fakemeta_const.inc) to specify which data you want retrieved.
|
||||
*
|
||||
* @note This function uses "read_data" style data syntax. It returns integer values,
|
||||
* by-references float data, and sets a buffer for string data.
|
||||
*
|
||||
* @note If retrieving strings, you may optionally get a pointer into the global string table. Depending on
|
||||
* your situation, there are two ways to do this.
|
||||
* 1: This simply gets the pointer.
|
||||
* new ptr = pev(entid, pev_classname)
|
||||
* 2: The pointer will be stored in ptr AND the actual string is retrieved.
|
||||
* new ptr, classname[32]
|
||||
* pev(entid, pev_classname, ptr, classname, 31)
|
||||
*
|
||||
* @param _index The entity index to lookup.
|
||||
* @param _value The pev field to lookup (look in fakemeta_const.inc)
|
||||
*/
|
||||
native pev(_index,_value,any:...);
|
||||
|
||||
/**
|
||||
* Sets entvar data for an entity. Use the pev_* enum from fakemeta_const.inc for reference.
|
||||
*
|
||||
* @note Setting string data will automatically allocate a new string (via AllocString)
|
||||
* If you have a string already allocated with your own call to AllocString, use
|
||||
* set_pev_string_ptr instead.
|
||||
*
|
||||
* @param _index The entity index to set the value on.
|
||||
* @param _value The pev field to set, (look in fakemeta_const.inc)
|
||||
*/
|
||||
native set_pev(_index,_value,any:...);
|
||||
|
||||
/**
|
||||
* Use this native to set a pev field to a string that is already allocated (via a function such
|
||||
* as EngFunc_AllocString).
|
||||
*
|
||||
* @note If you specify _value as anything other than string fields, an error will be thrown.
|
||||
* @note Pass 0 as the _string field to set it to an empty string.
|
||||
*
|
||||
* @param _index The entity index to set the value on.
|
||||
* @param _value The pev field to set - MUST be a string field.
|
||||
* @param _string The string handle, retrieved from places like AllocString.
|
||||
*/
|
||||
native set_pev_string(_index, _value, _string);
|
||||
|
||||
|
||||
/**
|
||||
* Checks the validity of an entity.
|
||||
*
|
||||
* @param entindex The entity id to check.
|
||||
*
|
||||
* @return 0 on invalid entity
|
||||
* 1 on entity is valid
|
||||
* 2 on entity is valid and it has private data (safe to use pdata natives on).
|
||||
*/
|
||||
native pev_valid(entindex);
|
||||
|
||||
/**
|
||||
* Returns the serial number for each entity. The serial number is a unique identity
|
||||
* generated when an entity is created.
|
||||
*
|
||||
* @param entindex The entity id.
|
||||
*
|
||||
* @return The serial number for the entity.
|
||||
*/
|
||||
native pev_serial(entindex);
|
||||
|
||||
/* Returns any global variable inside globalvars_t structure. Use the glb_* enum.
|
||||
*
|
||||
* When returning data from glb_pStringBase (the global string table), you may give a pointer into that table
|
||||
* in order to get different strings.
|
||||
* Example:
|
||||
* new model[128]
|
||||
* new ptr = pev(id, pev_viewmodel)
|
||||
* global_get(glb_pStringBase, ptr, model, 127)
|
||||
*/
|
||||
native global_get(_value, any:...);
|
||||
|
||||
/* Returns an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
native get_pdata_int(_index,_Offset,_linuxdiff=5,_macdiff=5);
|
||||
|
||||
/* Sets an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
native set_pdata_int(_index,_Offset,_Value,_linuxdiff=5,_macdiff=5);
|
||||
|
||||
/* Returns a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
native Float:get_pdata_float(_index,_Offset,_linuxdiff=5,_macdiff=5);
|
||||
|
||||
/* Sets a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
native set_pdata_float(_index,_Offset,Float:_Value,_linuxdiff=5,_macdiff=5);
|
||||
|
||||
/**
|
||||
* Tries to retrieve an edict (entity encapsulation) pointer from an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
|
||||
* get_pdata_end searches in increments of 1.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return -2 if an invalid entity was found.
|
||||
* -1 if an empty entity was found.
|
||||
* Otherwise, an entity index is returned.
|
||||
*/
|
||||
native get_pdata_ent(_index, _offset, _linuxdiff=20, _macdiff=20);
|
||||
|
||||
/* Registers a forward.
|
||||
* Returns an id you can pass to unregister_forward
|
||||
*/
|
||||
native register_forward(_forwardType,const _function[],_post=0);
|
||||
|
||||
/* Unregisters a forward.
|
||||
* The registerId must be from register_forward, and
|
||||
* post/forwardtype must match what you registered the forward as.
|
||||
*/
|
||||
native unregister_forward(_forwardType, registerId, post=0);
|
||||
|
||||
/* Returns data for metamod */
|
||||
native forward_return(type,any:...);
|
||||
|
||||
/* Returns the original return value of an engine function.
|
||||
* This is only valid in forwards that were registered as post.
|
||||
*
|
||||
* get_orig_retval() - no params, retrieves integer return value
|
||||
* get_orig_retval(&Float:value) - retrieves float return value by reference
|
||||
* get_orig_retval(value[], len) - retrives string return value
|
||||
*/
|
||||
native get_orig_retval({Float,_}:...);
|
||||
|
||||
native engfunc(type,any:...);
|
||||
native dllfunc(type,any:...);
|
||||
|
||||
//only use this with functions that pass a Trace
|
||||
// get: zero extra params - return int, one extra param = byref float or vector
|
||||
// set: use anything
|
||||
native get_tr(TraceResult:tr_member, {Float,_}:...);
|
||||
native set_tr(TraceResult:tr_member, {Float,_}:...);
|
||||
|
||||
//Upgraded version takes in a TraceResult handle, optionally passed in as the last parameter to the
|
||||
//TraceResult forward. Use 0 to specify the global traceresult handle set from calling
|
||||
// some of the Engfucs.
|
||||
native get_tr2(tr_handle, {TraceResult,_}:tr_member, {Float,_}:...);
|
||||
native set_tr2(tr_handle, {TraceResult,_}:tr_member, {Float,_}:...);
|
||||
|
||||
/**
|
||||
* Creates a traceresult handle. This value should never be altered.
|
||||
* The handle can be used in get/set_tr2 and various traceresult engine functions.
|
||||
*
|
||||
* NOTE: You must call free_tr2() on every handle made with create_tr2().
|
||||
*
|
||||
* @return A new TraceResult handle.
|
||||
*/
|
||||
native create_tr2();
|
||||
|
||||
/**
|
||||
* Frees a traceresult handle created with free_tr2(). Do not call
|
||||
* this more than once per handle, or on handles not created through
|
||||
* create_tr2().
|
||||
*
|
||||
* @param tr_handle TraceResult handle created via create_tr2().
|
||||
* @noreturn
|
||||
*/
|
||||
native free_tr2(tr_handle);
|
||||
|
||||
//Same as above, use either a kvd_handle or 0 for global reserved kvd data
|
||||
//kvd_handle is passed by the kvd hook, last param
|
||||
native get_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
|
||||
|
||||
//Using set_kvd with the handle from the hook for anything under KV_fHandled
|
||||
// is considered an undefined operation (it could crash). You should fire a new
|
||||
// keyvalues structure rather than changing the internal engine strings.
|
||||
native set_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
|
||||
|
||||
// These functions are used with the clientdata data structure (FM_UpdateClientData)
|
||||
// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector; 2 extra params - string and length
|
||||
// Set: Use anything
|
||||
// Use 0 for cd_handle to specify the global clientdata handle
|
||||
native get_cd(cd_handle, ClientData:member, {Float,_}:...);
|
||||
native set_cd(cd_handle, ClientData:member, {Float,_}:...);
|
||||
|
||||
// These functions are used with the entity_state data structure (FM_AddToFullPack)
|
||||
// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector or array
|
||||
// Set: Use anything
|
||||
// Use 0 for es_handle to specify the global entity_state handle
|
||||
native get_es(es_handle, EntityState:member, {Float,_}:...);
|
||||
native set_es(es_handle, EntityState:member, {Float,_}:...);
|
||||
|
||||
// These functions are used with the usercmd data structure (FM_CmdStart)
|
||||
// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector
|
||||
// Set: Use anything
|
||||
// Use 0 for uc_handle to specify the global usercmd handle
|
||||
native get_uc(uc_handle, UserCmd:member, {Float,_}:...);
|
||||
native set_uc(uc_handle, UserCmd:member, {Float,_}:...);
|
||||
|
||||
//NOTE that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset
|
||||
//In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half.
|
||||
//Gets a string from a private offset. If byref is false, the string is treated as static rather than dynamic.
|
||||
//linux value is what to add to the offset for linux servers.
|
||||
//mac value is what to add to the offset for os x servers. Default (cellmin) means that linux value will be used.
|
||||
//this cannot use a default value due to older version using an awkward default value.
|
||||
native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux, mac=cellmin);
|
||||
|
||||
//Sets a string in a private offset.
|
||||
//realloc = -1 - nonbyref copy (static
|
||||
//realloc = 0 - copy byref, no realloc *(char **)
|
||||
//realloc = 1 - reallocate new string with free+malloc
|
||||
//realloc = 2 - reallocate new string with delete[]+new[]
|
||||
//linux value is what to add to the offset for linux servers.
|
||||
//mac value iswhat to add to the offset for os x servers.
|
||||
//this cannot use a default value due to older version using an awkward default value.
|
||||
native set_pdata_string(entity, offset, const source[], realloc=2, linux, mac=cellmin);
|
||||
|
||||
// Copies the given infoBuffer pointer into out[]
|
||||
// An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer
|
||||
native copy_infokey_buffer(infoBuffer, out[], maxlen);
|
||||
|
||||
|
||||
/**
|
||||
* Looks up the sequence for the entity.
|
||||
*
|
||||
* @param entity The entity id to lookup.
|
||||
* @param name The sequence name to lookup, case insensitive. ("JUMP" would match "jump")
|
||||
* @param framerate The framerate of the sequence, if found.
|
||||
* @param loops Whether or not the sequence loops.
|
||||
* @param groundspeed The groundspeed setting of the sequence.
|
||||
* @return -1 on failed lookup, the sequence number on successful lookup.
|
||||
*/
|
||||
native lookup_sequence(entity, const name[], &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
|
||||
|
||||
/**
|
||||
* Sets a bone controller with the specified value.
|
||||
*
|
||||
* @param entity The entity id to set the value on.
|
||||
* @param controller Which controller to set (0 through 3).
|
||||
* @param value The value to set it to.
|
||||
* @return The percentage that the controller is extended (0.0 through 1.0)
|
||||
*/
|
||||
native Float:set_controller(entity, controller, Float:value);
|
||||
@@ -0,0 +1,749 @@
|
||||
/* FakeMeta constants
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _fakemeta_const_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fakemeta_const_included
|
||||
|
||||
// For forward_return
|
||||
#define FMV_STRING 1
|
||||
#define FMV_FLOAT 2
|
||||
#define FMV_CELL 3
|
||||
|
||||
#include <hlsdk_const>
|
||||
|
||||
/* The actual return value of the function, use these instead of PLUGIN_HANDLED etc when
|
||||
* returning from registered forwards.
|
||||
*/
|
||||
#define FMRES_IGNORED 1 // Calls target function, returns normal value
|
||||
#define FMRES_HANDLED 2 // Tells metamod you did something, still calls target function and returns normal value
|
||||
#define FMRES_OVERRIDE 3 // Supposed to still call the target function but return your value instead
|
||||
// however this does not work properly with metamod; use supercede instead.
|
||||
#define FMRES_SUPERCEDE 4 // Block the target call, and use your return value (if applicable)
|
||||
|
||||
// Use this with GetInfoKeyBuffer if you want the server's localinfo buffer
|
||||
#define FM_NULLENT -1
|
||||
|
||||
|
||||
/* Used with engfunc()
|
||||
*/
|
||||
enum {
|
||||
EngFunc_PrecacheModel, // int ) (char *s);
|
||||
EngFunc_PrecacheSound, // int ) (char *s);
|
||||
EngFunc_SetModel, // void ) (edict_t *e, const char *m);
|
||||
EngFunc_ModelIndex, // int ) (const char *m);
|
||||
EngFunc_ModelFrames, // int ) (int modelIndex);
|
||||
EngFunc_SetSize, // void ) (edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
EngFunc_ChangeLevel, // void ) (char* s1, char* s2);
|
||||
EngFunc_VecToYaw, // float) (const float *rgflVector);
|
||||
EngFunc_VecToAngles, // void ) (const float *rgflVectorIn, float *rgflVectorOut);
|
||||
EngFunc_MoveToOrigin, // void ) (edict_t *ent, const float *pflGoal, float dist, int iMoveType);
|
||||
EngFunc_ChangeYaw, // void ) (edict_t* ent);
|
||||
EngFunc_ChangePitch, // void ) (edict_t* ent);
|
||||
EngFunc_FindEntityByString, // edict) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
|
||||
EngFunc_GetEntityIllum, // int ) (edict_t* pEnt);
|
||||
EngFunc_FindEntityInSphere, // edict) (edict_t *pEdictStartSearchAfter, const float *org, float rad);
|
||||
EngFunc_FindClientInPVS, // edict) (edict_t *pEdict);
|
||||
EngFunc_EntitiesInPVS, // edict) (edict_t *pplayer);
|
||||
EngFunc_MakeVectors, // void ) (const float *rgflVector);
|
||||
EngFunc_AngleVectors, // void ) (const float *rgflVector, float *forward, float *right, float *up);
|
||||
EngFunc_CreateEntity, // edict) (void);
|
||||
EngFunc_RemoveEntity, // void ) (edict_t *e);
|
||||
EngFunc_CreateNamedEntity, // edict) (int className);
|
||||
EngFunc_MakeStatic, // void ) (edict_t *ent);
|
||||
EngFunc_EntIsOnFloor, // int ) (edict_t *e);
|
||||
EngFunc_DropToFloor, // int ) (edict_t *e);
|
||||
EngFunc_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode);
|
||||
EngFunc_SetOrigin, // void ) (edict_t *e, const float *rgflOrigin);
|
||||
EngFunc_EmitSound, // void ) (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
|
||||
EngFunc_EmitAmbientSound, // void ) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
|
||||
|
||||
//With 1.71 you can pass an optional TraceLine ptr for trace natives
|
||||
// it can be 0, for meaning "global tr handle" (for get/set_tr2), or
|
||||
// it can be any other TR handle (such as one from a TR hook)
|
||||
EngFunc_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
||||
EngFunc_TraceToss, // void ) (edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
|
||||
EngFunc_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
||||
EngFunc_TraceHull, // void ) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
|
||||
EngFunc_TraceModel, // void ) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
|
||||
EngFunc_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 );
|
||||
EngFunc_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
|
||||
|
||||
EngFunc_GetAimVector, // void ) (edict_t *ent, float speed, float *rgflReturn);
|
||||
EngFunc_ParticleEffect, // void ) (const float *org, const float *dir, float color, float count);
|
||||
EngFunc_LightStyle, // void ) (int style, char *val);
|
||||
EngFunc_DecalIndex, // int ) (const char *name);
|
||||
EngFunc_PointContents, // int ) (const float *rgflVector);
|
||||
EngFunc_FreeEntPrivateData, // void ) (edict_t *pEdict);
|
||||
EngFunc_SzFromIndex, // const char *) (int iString);
|
||||
EngFunc_AllocString, // int ) (const char *szValue);
|
||||
EngFunc_RegUserMsg, // int ) (const char *pszName, int iSize);
|
||||
EngFunc_AnimationAutomove, // void ) (const edict_t *pEdict, float flTime);
|
||||
EngFunc_GetBonePosition, // void ) (const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles);
|
||||
EngFunc_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles);
|
||||
EngFunc_SetView, // void ) (const edict_t *pClient, const edict_t *pViewent);
|
||||
EngFunc_Time, // float) ( void );
|
||||
EngFunc_CrosshairAngle, // void ) (const edict_t *pClient, float pitch, float yaw);
|
||||
EngFunc_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
|
||||
EngFunc_SetClientMaxspeed, // void ) (const edict_t *pEdict, float fNewMaxspeed);
|
||||
EngFunc_CreateFakeClient, // edict) (const char *netname); // returns NULL if fake client can't be created
|
||||
EngFunc_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
|
||||
EngFunc_NumberOfEntities, // int ) ( void );
|
||||
EngFunc_StaticDecal, // void ) (const float *origin, int decalIndex, int entityIndex, int modelIndex);
|
||||
EngFunc_PrecacheGeneric, // int ) (char* s);
|
||||
EngFunc_BuildSoundMsg, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
||||
EngFunc_GetPhysicsKeyValue, // const char *) (const edict_t *pClient, const char *key);
|
||||
EngFunc_SetPhysicsKeyValue, // void ) (const edict_t *pClient, const char *key, const char *value);
|
||||
EngFunc_GetPhysicsInfoString, // const char *) (const edict_t *pClient);
|
||||
EngFunc_PrecacheEvent, // unsigned short) (int type, const char*psz);
|
||||
EngFunc_PlaybackEvent, // void ) (int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
||||
EngFunc_CheckVisibility, // int ) (const edict_t *entity, unsigned char *pset);
|
||||
EngFunc_GetCurrentPlayer, // int ) ( void );
|
||||
EngFunc_CanSkipPlayer, // int ) (const edict_t *player);
|
||||
EngFunc_SetGroupMask, // void ) (int mask, int op);
|
||||
EngFunc_GetClientListening, // bool ) (int iReceiver, int iSender)
|
||||
EngFunc_SetClientListening, // bool ) (int iReceiver, int iSender, bool Listen)
|
||||
EngFunc_MessageBegin, // void ) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
|
||||
EngFunc_WriteCoord, // void ) (float flValue)
|
||||
EngFunc_WriteAngle, // void ) (float flValue)
|
||||
EngFunc_InfoKeyValue, // char*) (char *infobuffer, char *key);
|
||||
EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value);
|
||||
EngFunc_SetClientKeyValue, // void ) (int clientIndex, char *infobuffer, char *key, char *value);
|
||||
EngFunc_CreateInstBaseline, // int ) (int classname, struct entity_state_s *baseline);
|
||||
|
||||
// Returns pointer to info buffer that can be used with the infobuffer param of InfoKeyValue, SetKeyValue, and SetClientKeyValue
|
||||
EngFunc_GetInfoKeyBuffer, // char*) (edict_t *e);
|
||||
EngFunc_AlertMessage, // void ) (ALERT_TYPE atype, char *szFmt, ...);
|
||||
EngFunc_ClientPrintf, // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg);
|
||||
EngFunc_ServerPrint // void ) (const char *szMsg);
|
||||
};
|
||||
|
||||
/* Used with dllfunc()
|
||||
*/
|
||||
enum
|
||||
{
|
||||
DLLFunc_GameInit, // void ) ( void );
|
||||
DLLFunc_Spawn, // int ) (edict_t *pent);
|
||||
DLLFunc_Think, // void ) (edict_t *pent);
|
||||
DLLFunc_Use, // void ) (edict_t *pentUsed, edict_t *pentOther);
|
||||
DLLFunc_Touch, // void ) (edict_t *pentTouched, edict_t *pentOther);
|
||||
DLLFunc_Blocked, // void ) (edict_t *pentBlocked, edict_t *pentOther);
|
||||
|
||||
//You can pass in 0 for glb kvd handle or a kvd handle here
|
||||
DLLFunc_KeyValue, // void ) (edict_t *pentKeyvalue, KeyValueData *pkvd);
|
||||
DLLFunc_SetAbsBox, // void ) (edict_t *pent);
|
||||
DLLFunc_ClientConnect, // bool ) (edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);
|
||||
|
||||
DLLFunc_ClientDisconnect, // void ) (edict_t *pEntity);
|
||||
DLLFunc_ClientKill, // void ) (edict_t *pEntity);
|
||||
DLLFunc_ClientPutInServer, // void ) (edict_t *pEntity);
|
||||
DLLFunc_ClientCommand, // void ) (edict_t *pEntity);
|
||||
|
||||
DLLFunc_ServerDeactivate, // void ) ( void );
|
||||
|
||||
DLLFunc_PlayerPreThink, // void ) (edict_t *pEntity);
|
||||
DLLFunc_PlayerPostThink, // void ) (edict_t *pEntity);
|
||||
|
||||
DLLFunc_StartFrame, // void ) ( void );
|
||||
DLLFunc_ParmsNewLevel, // void ) ( void );
|
||||
DLLFunc_ParmsChangeLevel, // void ) ( void );
|
||||
|
||||
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
|
||||
// This also gets called when the server is queried for information (for example, by a server browser tool)
|
||||
DLLFunc_GetGameDescription, // const char *) ( void );
|
||||
|
||||
// Spectator funcs
|
||||
DLLFunc_SpectatorConnect, // void ) (edict_t *pEntity);
|
||||
DLLFunc_SpectatorDisconnect, // void ) (edict_t *pEntity);
|
||||
DLLFunc_SpectatorThink, // void ) (edict_t *pEntity);
|
||||
|
||||
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
|
||||
DLLFunc_Sys_Error, // void ) (const char *error_string);
|
||||
|
||||
DLLFunc_PM_FindTextureType, // char ) (char *name);
|
||||
DLLFunc_RegisterEncoders, // void ) ( void );
|
||||
|
||||
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
|
||||
DLLFunc_GetHullBounds, // int ) (int hullnumber, float *mins, float *maxs);
|
||||
|
||||
// Create baselines for certain "unplaced" items.
|
||||
DLLFunc_CreateInstBaselines, // void ) ( void );
|
||||
DLLFunc_pfnAllowLagCompensation, // int ) ( void );
|
||||
// I know this does not fit with DLLFUNC(), but I don't want another native just for it.
|
||||
MetaFunc_CallGameEntity, // bool ) (plid_t plid, const char *entStr,entvars_t *pev);
|
||||
DLLFunc_ClientUserInfoChanged, // void ) (edict *pEntity, char *infobuffer);
|
||||
// You can pass in 0 for global cd handle or another cd handle here
|
||||
DLLFunc_UpdateClientData, // void ) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd);
|
||||
// You can pass in 0 for global entity state handle or another entity state handle here
|
||||
DLLFunc_AddToFullPack, // int ) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
|
||||
// You can pass in 0 for global usercmd handle or another usercmd handle here
|
||||
DLLFunc_CmdStart, // void ) (const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
|
||||
DLLFunc_CmdEnd, // void ) (const edict_t *player);
|
||||
DLLFunc_CreateBaseline // void ) (int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs);
|
||||
};
|
||||
|
||||
enum {
|
||||
pev_string_start = 0,
|
||||
pev_classname,
|
||||
pev_globalname,
|
||||
pev_model,
|
||||
pev_target,
|
||||
pev_targetname,
|
||||
pev_netname,
|
||||
pev_message,
|
||||
pev_noise,
|
||||
pev_noise1,
|
||||
pev_noise2,
|
||||
pev_noise3,
|
||||
pev_string_end,
|
||||
pev_edict_start,
|
||||
pev_chain,
|
||||
pev_dmg_inflictor,
|
||||
pev_enemy,
|
||||
pev_aiment,
|
||||
pev_owner,
|
||||
pev_groundentity,
|
||||
pev_euser1,
|
||||
pev_euser2,
|
||||
pev_euser3,
|
||||
pev_euser4,
|
||||
pev_edict_end,
|
||||
pev_float_start,
|
||||
pev_impacttime,
|
||||
pev_starttime,
|
||||
pev_idealpitch,
|
||||
pev_ideal_yaw,
|
||||
pev_pitch_speed,
|
||||
pev_yaw_speed,
|
||||
pev_ltime,
|
||||
pev_nextthink,
|
||||
pev_gravity,
|
||||
pev_friction,
|
||||
pev_frame,
|
||||
pev_animtime,
|
||||
pev_framerate,
|
||||
pev_scale,
|
||||
pev_renderamt,
|
||||
pev_health,
|
||||
pev_frags,
|
||||
pev_takedamage,
|
||||
pev_max_health,
|
||||
pev_teleport_time,
|
||||
pev_armortype,
|
||||
pev_armorvalue,
|
||||
pev_dmg_take,
|
||||
pev_dmg_save,
|
||||
pev_dmg,
|
||||
pev_dmgtime,
|
||||
pev_speed,
|
||||
pev_air_finished,
|
||||
pev_pain_finished,
|
||||
pev_radsuit_finished,
|
||||
pev_maxspeed,
|
||||
pev_fov,
|
||||
pev_flFallVelocity,
|
||||
pev_fuser1,
|
||||
pev_fuser2,
|
||||
pev_fuser3,
|
||||
pev_fuser4,
|
||||
pev_float_end,
|
||||
pev_int_start,
|
||||
pev_fixangle,
|
||||
pev_modelindex,
|
||||
pev_viewmodel,
|
||||
pev_weaponmodel,
|
||||
pev_movetype,
|
||||
pev_solid,
|
||||
pev_skin,
|
||||
pev_body,
|
||||
pev_effects,
|
||||
pev_light_level,
|
||||
pev_sequence,
|
||||
pev_gaitsequence,
|
||||
pev_rendermode,
|
||||
pev_renderfx,
|
||||
pev_weapons,
|
||||
pev_deadflag,
|
||||
pev_button,
|
||||
pev_impulse,
|
||||
pev_spawnflags,
|
||||
pev_flags,
|
||||
pev_colormap,
|
||||
pev_team,
|
||||
pev_waterlevel,
|
||||
pev_watertype,
|
||||
pev_playerclass,
|
||||
pev_weaponanim,
|
||||
pev_pushmsec,
|
||||
pev_bInDuck,
|
||||
pev_flTimeStepSound,
|
||||
pev_flSwimTime,
|
||||
pev_flDuckTime,
|
||||
pev_iStepLeft,
|
||||
pev_gamestate,
|
||||
pev_oldbuttons,
|
||||
pev_groupinfo,
|
||||
pev_iuser1,
|
||||
pev_iuser2,
|
||||
pev_iuser3,
|
||||
pev_iuser4,
|
||||
pev_int_end,
|
||||
pev_byte_start,
|
||||
pev_controller_0,
|
||||
pev_controller_1,
|
||||
pev_controller_2,
|
||||
pev_controller_3,
|
||||
pev_blending_0,
|
||||
pev_blending_1,
|
||||
pev_byte_end,
|
||||
pev_bytearray_start,
|
||||
pev_controller,
|
||||
pev_blending,
|
||||
pev_bytearray_end,
|
||||
pev_vecarray_start,
|
||||
pev_origin,
|
||||
pev_oldorigin,
|
||||
pev_velocity,
|
||||
pev_basevelocity,
|
||||
pev_clbasevelocity,
|
||||
pev_movedir,
|
||||
pev_angles,
|
||||
pev_avelocity,
|
||||
pev_v_angle,
|
||||
pev_endpos,
|
||||
pev_startpos,
|
||||
pev_absmin,
|
||||
pev_absmax,
|
||||
pev_mins,
|
||||
pev_maxs,
|
||||
pev_size,
|
||||
pev_rendercolor,
|
||||
pev_view_ofs,
|
||||
pev_vuser1,
|
||||
pev_vuser2,
|
||||
pev_vuser3,
|
||||
pev_vuser4,
|
||||
pev_punchangle,
|
||||
pev_vecarray_end,
|
||||
pev_string2_begin, /* anything after here are string corrections */
|
||||
pev_weaponmodel2,
|
||||
pev_viewmodel2,
|
||||
pev_string2_end,
|
||||
pev_edict2_start, /* edict corrections */
|
||||
pev_pContainingEntity,
|
||||
pev_absolute_end
|
||||
};
|
||||
|
||||
/* Used with global_get()
|
||||
*/
|
||||
enum
|
||||
{
|
||||
glb_start_int = 0,
|
||||
glb_trace_hitgroup,
|
||||
glb_trace_flags,
|
||||
glb_msg_entity,
|
||||
glb_cdAudioTrack,
|
||||
glb_maxClients,
|
||||
glb_maxEntities,
|
||||
glb_end_int,
|
||||
glb_start_float,
|
||||
glb_time,
|
||||
glb_frametime,
|
||||
glb_force_retouch,
|
||||
glb_deathmatch,
|
||||
glb_coop,
|
||||
glb_teamplay,
|
||||
glb_serverflags,
|
||||
glb_found_secrets,
|
||||
glb_trace_allsolid,
|
||||
glb_trace_startsolid,
|
||||
glb_trace_fraction,
|
||||
glb_trace_plane_dist,
|
||||
glb_trace_inopen,
|
||||
glb_trace_inwater,
|
||||
glb_end_float,
|
||||
glb_start_edict,
|
||||
glb_trace_ent,
|
||||
glb_end_edict,
|
||||
glb_start_vector,
|
||||
glb_v_forward,
|
||||
glb_v_up,
|
||||
glb_v_right,
|
||||
glb_trace_endpos,
|
||||
glb_trace_plane_normal,
|
||||
glb_vecLandmarkOffset,
|
||||
glb_end_vector,
|
||||
glb_start_string,
|
||||
glb_mapname,
|
||||
glb_startspot,
|
||||
glb_end_string,
|
||||
glb_start_pchar,
|
||||
glb_pStringBase,
|
||||
glb_end_pchar
|
||||
};
|
||||
|
||||
/* Used with register_forward()
|
||||
*/
|
||||
enum {
|
||||
FM_PrecacheModel = 1,
|
||||
FM_PrecacheSound,
|
||||
FM_SetModel,
|
||||
FM_ModelIndex,
|
||||
FM_ModelFrames,
|
||||
FM_SetSize,
|
||||
FM_ChangeLevel,
|
||||
FM_VecToYaw,
|
||||
FM_VecToAngles,
|
||||
FM_MoveToOrigin,
|
||||
FM_ChangeYaw,
|
||||
FM_ChangePitch,
|
||||
FM_FindEntityByString,
|
||||
FM_GetEntityIllum,
|
||||
FM_FindEntityInSphere,
|
||||
FM_FindClientInPVS,
|
||||
FM_EntitiesInPVS,
|
||||
FM_MakeVectors,
|
||||
FM_AngleVectors,
|
||||
FM_CreateEntity,
|
||||
FM_RemoveEntity,
|
||||
FM_CreateNamedEntity,
|
||||
FM_MakeStatic,
|
||||
FM_EntIsOnFloor,
|
||||
FM_DropToFloor,
|
||||
FM_WalkMove,
|
||||
FM_SetOrigin,
|
||||
FM_EmitSound,
|
||||
FM_EmitAmbientSound,
|
||||
FM_TraceLine,
|
||||
FM_TraceToss,
|
||||
FM_TraceMonsterHull,
|
||||
FM_TraceHull,
|
||||
FM_TraceModel,
|
||||
FM_TraceTexture,
|
||||
FM_TraceSphere,
|
||||
FM_GetAimVector,
|
||||
FM_ParticleEffect,
|
||||
FM_LightStyle,
|
||||
FM_DecalIndex,
|
||||
FM_PointContents,
|
||||
FM_MessageBegin,
|
||||
FM_MessageEnd,
|
||||
FM_WriteByte,
|
||||
FM_WriteChar,
|
||||
FM_WriteShort,
|
||||
FM_WriteLong,
|
||||
FM_WriteAngle,
|
||||
FM_WriteCoord,
|
||||
FM_WriteString,
|
||||
FM_WriteEntity,
|
||||
FM_CVarGetFloat,
|
||||
FM_CVarGetString,
|
||||
FM_CVarSetFloat,
|
||||
FM_CVarSetString,
|
||||
FM_FreeEntPrivateData,
|
||||
FM_SzFromIndex,
|
||||
FM_AllocString,
|
||||
FM_RegUserMsg,
|
||||
FM_AnimationAutomove,
|
||||
FM_GetBonePosition,
|
||||
FM_GetAttachment,
|
||||
FM_SetView,
|
||||
FM_Time,
|
||||
FM_CrosshairAngle,
|
||||
FM_FadeClientVolume,
|
||||
FM_SetClientMaxspeed,
|
||||
FM_CreateFakeClient,
|
||||
FM_RunPlayerMove,
|
||||
FM_NumberOfEntities,
|
||||
FM_StaticDecal,
|
||||
FM_PrecacheGeneric,
|
||||
FM_BuildSoundMsg,
|
||||
FM_GetPhysicsKeyValue,
|
||||
FM_SetPhysicsKeyValue,
|
||||
FM_GetPhysicsInfoString,
|
||||
FM_PrecacheEvent,
|
||||
FM_PlaybackEvent,
|
||||
FM_CheckVisibility,
|
||||
FM_GetCurrentPlayer,
|
||||
FM_CanSkipPlayer,
|
||||
FM_SetGroupMask,
|
||||
FM_Voice_GetClientListening,
|
||||
FM_Voice_SetClientListening,
|
||||
FM_InfoKeyValue,
|
||||
FM_SetKeyValue,
|
||||
FM_SetClientKeyValue,
|
||||
FM_GetPlayerAuthId,
|
||||
FM_GetPlayerWONId,
|
||||
FM_IsMapValid,
|
||||
|
||||
FM_Spawn,
|
||||
FM_Think,
|
||||
FM_Use,
|
||||
FM_Touch,
|
||||
FM_Blocked,
|
||||
FM_KeyValue,
|
||||
FM_SetAbsBox,
|
||||
FM_ClientConnect,
|
||||
|
||||
FM_ClientDisconnect,
|
||||
FM_ClientKill,
|
||||
FM_ClientPutInServer,
|
||||
FM_ClientCommand,
|
||||
|
||||
FM_ServerDeactivate,
|
||||
|
||||
FM_PlayerPreThink,
|
||||
FM_PlayerPostThink,
|
||||
|
||||
FM_StartFrame,
|
||||
FM_ParmsNewLevel,
|
||||
FM_ParmsChangeLevel,
|
||||
|
||||
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
|
||||
// This also gets called when the server is queried for information (for example, by a server browser tool)
|
||||
FM_GetGameDescription,
|
||||
|
||||
// Spectator funcs
|
||||
FM_SpectatorConnect,
|
||||
FM_SpectatorDisconnect,
|
||||
FM_SpectatorThink,
|
||||
|
||||
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
|
||||
FM_Sys_Error,
|
||||
|
||||
FM_PM_FindTextureType,
|
||||
FM_RegisterEncoders,
|
||||
|
||||
// Create baselines for certain "unplaced" items.
|
||||
FM_CreateInstBaselines,
|
||||
|
||||
FM_AllowLagCompensation,
|
||||
FM_AlertMessage,
|
||||
|
||||
// NEW_DLL_FUNCTIONS:
|
||||
FM_OnFreeEntPrivateData,
|
||||
FM_GameShutdown,
|
||||
FM_ShouldCollide,
|
||||
|
||||
// LATE ADDITIONS (v1.71)
|
||||
FM_ClientUserInfoChanged,
|
||||
|
||||
// LATE ADDITIONS (v1.75)
|
||||
FM_UpdateClientData,
|
||||
FM_AddToFullPack,
|
||||
FM_CmdStart,
|
||||
FM_CmdEnd,
|
||||
FM_CreateInstBaseline,
|
||||
FM_CreateBaseline,
|
||||
FM_GetInfoKeyBuffer,
|
||||
FM_ClientPrintf,
|
||||
|
||||
// LATE ADDITIONS (v1.80)
|
||||
FM_ServerPrint
|
||||
};
|
||||
|
||||
enum TraceResult
|
||||
{
|
||||
TR_AllSolid, // int
|
||||
TR_StartSolid, // int
|
||||
TR_InOpen, // int
|
||||
TR_InWater, // int
|
||||
TR_flFraction, // float
|
||||
TR_vecEndPos, // float array[3]
|
||||
TR_flPlaneDist, // float
|
||||
TR_vecPlaneNormal, // float array[3]
|
||||
TR_pHit, // int (edict_t*)
|
||||
TR_iHitgroup, // int
|
||||
};
|
||||
|
||||
enum KeyValueData
|
||||
{
|
||||
KV_ClassName, // string
|
||||
KV_KeyName, // string
|
||||
KV_Value, // string
|
||||
KV_fHandled // int
|
||||
};
|
||||
|
||||
enum ClientData
|
||||
{
|
||||
CD_Origin, // float array[3]
|
||||
CD_Velocity, // float array[3]
|
||||
CD_ViewModel, // int
|
||||
CD_PunchAngle, // float array[3]
|
||||
CD_Flags, // int
|
||||
CD_WaterLevel, // int
|
||||
CD_WaterType, // int
|
||||
CD_ViewOfs, // float array[3]
|
||||
CD_Health, // float
|
||||
CD_bInDuck, // int
|
||||
CD_Weapons, // int
|
||||
CD_flTimeStepSound, // int
|
||||
CD_flDuckTime, // int
|
||||
CD_flSwimTime, // int
|
||||
CD_WaterJumpTime, // int
|
||||
CD_MaxSpeed, // float
|
||||
CD_FOV, // float
|
||||
CD_WeaponAnim, // int
|
||||
CD_ID, // int
|
||||
CD_AmmoShells, // int
|
||||
CD_AmmoNails, // int
|
||||
CD_AmmoCells, // int
|
||||
CD_AmmoRockets, // int
|
||||
CD_flNextAttack, // float
|
||||
CD_tfState, // int
|
||||
CD_PushMsec, // int
|
||||
CD_DeadFlag, // int
|
||||
CD_PhysInfo, // string[256]
|
||||
CD_iUser1, // int
|
||||
CD_iUser2, // int
|
||||
CD_iUser3, // int
|
||||
CD_iUser4, // int
|
||||
CD_fUser1, // float
|
||||
CD_fUser2, // float
|
||||
CD_fUser3, // float
|
||||
CD_fUser4, // float
|
||||
CD_vUser1, // float array[3]
|
||||
CD_vUser2, // float array[3]
|
||||
CD_vUser3, // float array[3]
|
||||
CD_vUser4 // float array[3]
|
||||
};
|
||||
|
||||
enum EntityState
|
||||
{
|
||||
// Fields which are filled in by routines outside of delta compression
|
||||
ES_EntityType, // int
|
||||
// Index into cl_entities array for this entity
|
||||
ES_Number, // int
|
||||
ES_MsgTime, // float
|
||||
|
||||
// Message number last time the player/entity state was updated
|
||||
ES_MessageNum, // int
|
||||
|
||||
// Fields which can be transitted and reconstructed over the network stream
|
||||
ES_Origin, // float array[3]
|
||||
ES_Angles, // float array[3]
|
||||
|
||||
ES_ModelIndex, // int
|
||||
ES_Sequence, // int
|
||||
ES_Frame, // float
|
||||
ES_ColorMap, // int
|
||||
ES_Skin, // short
|
||||
ES_Solid, // short
|
||||
ES_Effects, // int
|
||||
ES_Scale, // float
|
||||
ES_eFlags, // byte
|
||||
|
||||
// Render information
|
||||
ES_RenderMode, // int
|
||||
ES_RenderAmt, // int
|
||||
ES_RenderColor, // byte array[3], RGB value
|
||||
ES_RenderFx, // int
|
||||
|
||||
ES_MoveType, // int
|
||||
ES_AnimTime, // float
|
||||
ES_FrameRate, // float
|
||||
ES_Body, // int
|
||||
ES_Controller, // byte array[4]
|
||||
ES_Blending, // byte array[4]
|
||||
ES_Velocity, // float array[3]
|
||||
|
||||
// Send bbox down to client for use during prediction
|
||||
ES_Mins, // float array[3]
|
||||
ES_Maxs, // float array[3]
|
||||
|
||||
ES_AimEnt, // int
|
||||
// If owned by a player, the index of that player (for projectiles)
|
||||
ES_Owner, // int
|
||||
|
||||
// Friction, for prediction
|
||||
ES_Friction, // float
|
||||
// Gravity multiplier
|
||||
ES_Gravity, // float
|
||||
|
||||
// PLAYER SPECIFIC
|
||||
ES_Team, // int
|
||||
ES_PlayerClass, // int
|
||||
ES_Health, // int
|
||||
ES_Spectator, // bool
|
||||
ES_WeaponModel, // int
|
||||
ES_GaitSequence, // int
|
||||
// If standing on conveyor, e.g.
|
||||
ES_BaseVelocity, // float array[3]
|
||||
// Use the crouched hull, or the regular player hull
|
||||
ES_UseHull, // int
|
||||
// Latched buttons last time state updated
|
||||
ES_OldButtons, // int
|
||||
// -1 = in air, else pmove entity number
|
||||
ES_OnGround, // int
|
||||
ES_iStepLeft, // int
|
||||
// How fast we are falling
|
||||
ES_flFallVelocity, // float
|
||||
|
||||
ES_FOV, // float
|
||||
ES_WeaponAnim, // int
|
||||
|
||||
// Parametric movement overrides
|
||||
ES_StartPos, // float array[3]
|
||||
ES_EndPos, // float array[3]
|
||||
ES_ImpactTime, // float
|
||||
ES_StartTime, // float
|
||||
|
||||
// For mods
|
||||
ES_iUser1, // int
|
||||
ES_iUser2, // int
|
||||
ES_iUser3, // int
|
||||
ES_iUser4, // int
|
||||
ES_fUser1, // float
|
||||
ES_fUser2, // float
|
||||
ES_fUser3, // float
|
||||
ES_fUser4, // float
|
||||
ES_vUser1, // float array[3]
|
||||
ES_vUser2, // float array[3]
|
||||
ES_vUser3, // float array[3]
|
||||
ES_vUser4 // float array[3]
|
||||
};
|
||||
|
||||
enum UserCmd
|
||||
{
|
||||
// Interpolation time on client
|
||||
UC_LerpMsec, // short
|
||||
// Duration in ms of command
|
||||
UC_Msec, // byte
|
||||
// Command view angles
|
||||
UC_ViewAngles, // float array[3]
|
||||
|
||||
// Intended velocities
|
||||
// Forward velocity
|
||||
UC_ForwardMove, // float
|
||||
// Sideways velocity
|
||||
UC_SideMove, // float
|
||||
// Upward velocity
|
||||
UC_UpMove, // float
|
||||
// Light level at spot where we are standing
|
||||
UC_LightLevel, // byte
|
||||
// Attack buttons
|
||||
UC_Buttons, // unsigned short
|
||||
// Impulse command issued
|
||||
UC_Impulse, // byte
|
||||
// Current weapon id
|
||||
UC_WeaponSelect, // byte
|
||||
|
||||
// Experimental player impact stuff
|
||||
UC_ImpactIndex, // int
|
||||
UC_ImpactPosition // float array[3]
|
||||
};
|
||||
|
||||
enum AlertType
|
||||
{
|
||||
at_notice = 0,
|
||||
at_console, // same as at_notice, but forces a ConPrintf, not a message box
|
||||
at_aiconsole, // same as at_console, but only shown if developer level is 2!
|
||||
at_warning,
|
||||
at_error,
|
||||
at_logged // Server print to console (only in multiplayer games)
|
||||
};
|
||||
@@ -0,0 +1,275 @@
|
||||
/* FakeMeta stocks
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if !defined _fakemeta_included
|
||||
#include <fakemeta>
|
||||
#endif
|
||||
|
||||
#if defined _fakemeta_stocks_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fakemeta_stocks_included
|
||||
|
||||
// EngFuncs
|
||||
stock EF_PrecacheModel(const string[])
|
||||
return engfunc(EngFunc_PrecacheModel, string);
|
||||
|
||||
stock EF_PrecacheSound(const string[])
|
||||
return engfunc(EngFunc_PrecacheSound, string);
|
||||
stock EF_SetModel(const ID, const STRING[])
|
||||
return engfunc(EngFunc_SetModel, ID, STRING);
|
||||
stock EF_ModelIndex(const STRING[])
|
||||
return engfunc(EngFunc_ModelIndex, STRING);
|
||||
stock EF_ModelFrames(modelIndex)
|
||||
return engfunc(EngFunc_ModelFrames, modelIndex);
|
||||
|
||||
stock EF_SetSize(const ENTITY, const Float:MIN[3], const Float:MAX[3])
|
||||
return engfunc(EngFunc_SetSize, ENTITY, MIN, MAX);
|
||||
stock EF_ChangeLevel(const S1[], const S2[])
|
||||
return engfunc(EngFunc_ChangeLevel, S1, S2);
|
||||
stock EF_VecToYaw(const Float:VECTOR[3], &Float:returnValue)
|
||||
return engfunc(EngFunc_VecToYaw, VECTOR, returnValue);
|
||||
stock EF_VecToAngles(const Float:VECTORIN[3], const Float:VECTOROUT[3])
|
||||
return engfunc(EngFunc_VecToAngles, VECTORIN, VECTOROUT);
|
||||
stock EF_MoveToOrigin(const ENTITY, const Float:GOAL[3], const Float:DISTANCE, const MOVETYPE)
|
||||
return engfunc(EngFunc_MoveToOrigin, ENTITY, GOAL, DISTANCE, MOVETYPE);
|
||||
|
||||
stock EF_ChangeYaw(const ENTITY)
|
||||
return engfunc(EngFunc_ChangeYaw, ENTITY);
|
||||
stock EF_ChangePitch(const ENTITY)
|
||||
return engfunc(EngFunc_ChangePitch, ENTITY);
|
||||
stock EF_FindEntityByString(const STARTSEARCHAFTER, const FIELD[], const VALUE[])
|
||||
return engfunc(EngFunc_FindEntityByString, STARTSEARCHAFTER, FIELD, VALUE);
|
||||
stock EF_GetEntityIllum(const ENTITY)
|
||||
return engfunc(EngFunc_GetEntityIllum, ENTITY);
|
||||
stock EF_FindEntityInSphere(const STARTSEARCHAFTER, const Float:ORIGIN[3], Float:radius)
|
||||
return engfunc(EngFunc_FindEntityInSphere, STARTSEARCHAFTER, ORIGIN, radius);
|
||||
|
||||
stock EF_FindClientInPVS(const CLIENT)
|
||||
return engfunc(EngFunc_FindClientInPVS, CLIENT);
|
||||
stock EF_EntitiesInPVS(const CLIENT)
|
||||
return engfunc(EngFunc_EntitiesInPVS, CLIENT);
|
||||
stock EF_MakeVectors(const Float:VECTOR[3])
|
||||
return engfunc(EngFunc_MakeVectors, VECTOR);
|
||||
stock EF_AngleVectors(const Float:VECTOR[3], Float:forward_[3], Float:right[3], Float:up[3])
|
||||
return engfunc(EngFunc_AngleVectors, VECTOR, forward_, right, up);
|
||||
stock EF_CreateEntity()
|
||||
return engfunc(EngFunc_CreateEntity);
|
||||
|
||||
stock EF_RemoveEntity(const ENTITY)
|
||||
return engfunc(EngFunc_RemoveEntity, ENTITY);
|
||||
stock EF_CreateNamedEntity(const CLASSNAME)
|
||||
return engfunc(EngFunc_CreateNamedEntity, CLASSNAME);
|
||||
stock EF_MakeStatic(const ENTITY)
|
||||
return engfunc(EngFunc_MakeStatic, ENTITY);
|
||||
stock EF_EntIsOnFloor(const ENTITY)
|
||||
return engfunc(EngFunc_EntIsOnFloor, ENTITY);
|
||||
stock EF_DropToFloor(const ENTITY)
|
||||
return engfunc(EngFunc_DropToFloor, ENTITY);
|
||||
|
||||
stock EF_WalkMove(const ENTITY, Float:yaw, Float:distance, iMode)
|
||||
return engfunc(EngFunc_WalkMove, ENTITY, yaw, distance, iMode);
|
||||
stock EF_SetOrigin(const ENTITY, const Float:ORIGIN[3])
|
||||
return engfunc(EngFunc_SetOrigin, ENTITY, ORIGIN);
|
||||
stock EF_EmitSound(const ENTITY, channel, const SAMPLE[], Float:volume, Float:attenuation, fFlags, pitch)
|
||||
return engfunc(EngFunc_EmitSound, ENTITY, channel, SAMPLE, volume, attenuation, fFlags, pitch);
|
||||
stock EF_EmitAmbientSound(const ENTITY, Float:pos[3], const SAMPLE[], Float:volume, Float:attenuation, fFlags, pitch)
|
||||
return engfunc(EngFunc_EmitAmbientSound, ENTITY, pos, SAMPLE, volume, attenuation, fFlags, pitch);
|
||||
stock EF_TraceLine(const Float:V1[3], const Float:V2[3], fNoMonsters, const ENT_TO_SKIP)
|
||||
return engfunc(EngFunc_TraceLine, V1, V2, fNoMonsters, ENT_TO_SKIP);
|
||||
|
||||
stock EF_TraceToss(const ENTITY, const ENTITY_TO_IGNORE)
|
||||
return engfunc(EngFunc_TraceToss, ENTITY, ENTITY_TO_IGNORE);
|
||||
stock EF_TraceMonsterHull(const ENTITY, const Float:V1[3], const Float:V2[3], fNoMonsters, const ENTITY_TO_SKIP)
|
||||
return engfunc(EngFunc_TraceMonsterHull, ENTITY, V1, V2, fNoMonsters, ENTITY_TO_SKIP);
|
||||
stock EF_TraceHull(const Float:V1[3], const Float:V2[3], fNoMonsters, hullNumber, const ENTITY_TO_SKIP)
|
||||
return engfunc(EngFunc_TraceHull, V1, V2, fNoMonsters, hullNumber, ENTITY_TO_SKIP);
|
||||
stock EF_TraceModel(const Float:V1[3], const Float:V2[3], hullNumber, const ENTITY)
|
||||
return engfunc(EngFunc_TraceModel, V1, V2, hullNumber, ENTITY);
|
||||
stock EF_TraceTexture(const TEXTURE_ENTITY, const Float:V1[3], const Float:V2[3])
|
||||
return engfunc(EngFunc_TraceTexture, TEXTURE_ENTITY, V1, V2);
|
||||
|
||||
stock EF_TraceSphere(const Float:V1[3], const Float:V2[3], fNoMonsters, Float:radius, const ENTITY_TO_SKIP)
|
||||
return engfunc(EngFunc_TraceSphere, V1, V2, fNoMonsters, radius, ENTITY_TO_SKIP);
|
||||
stock EF_GetAimVector(const ENTITY, Float:speed, Float:returnVector[3])
|
||||
return engfunc(EngFunc_GetAimVector, ENTITY, speed, returnVector);
|
||||
stock EF_ParticleEffect(const Float:ORIGIN[3], const Float:DIRECTION[3], Float:color, Float:count)
|
||||
return engfunc(EngFunc_ParticleEffect, ORIGIN, DIRECTION, color, count);
|
||||
stock EF_LightStyle(style, val[])
|
||||
return engfunc(EngFunc_LightStyle, style, val);
|
||||
stock EF_DecalIndex(const NAME[])
|
||||
return engfunc(EngFunc_DecalIndex, NAME);
|
||||
|
||||
stock EF_PointContents(const Float:VECTOR[3])
|
||||
return engfunc(EngFunc_PointContents, VECTOR);
|
||||
stock EF_FreeEntPrivateData(const ENTITY)
|
||||
return engfunc(EngFunc_FreeEntPrivateData, ENTITY);
|
||||
stock EF_SzFromIndex(iString)
|
||||
return engfunc(EngFunc_SzFromIndex, iString);
|
||||
stock EF_AllocString(const STRING[])
|
||||
return engfunc(EngFunc_AllocString, STRING);
|
||||
stock EF_RegUserMsg(const NAME[], iSize)
|
||||
return engfunc(EngFunc_RegUserMsg, NAME, iSize);
|
||||
|
||||
stock EF_AnimationAutomove(const ENTITY, Float:flTime)
|
||||
return engfunc(EngFunc_AnimationAutomove, ENTITY, flTime);
|
||||
stock EF_GetBonePosition(const ENTITY, iBone, Float:origin[3], Float:angles[3])
|
||||
return engfunc(EngFunc_GetBonePosition, ENTITY, iBone, origin, angles);
|
||||
stock EF_GetAttachment(const ENTITY, iAttachment, Float:origin[3], Float:angles[3])
|
||||
return engfunc(EngFunc_GetAttachment, ENTITY, iAttachment, origin, angles);
|
||||
stock EF_SetView(const CLIENT, const VIEW_ENTITY)
|
||||
return engfunc(EngFunc_SetView, CLIENT, VIEW_ENTITY);
|
||||
stock EF_Time(&Float:returnValue)
|
||||
return engfunc(EngFunc_Time, returnValue);
|
||||
|
||||
stock EF_CrosshairAngle(const CLIENT, Float:pitch, Float:yaw)
|
||||
return engfunc(EngFunc_CrosshairAngle, CLIENT, pitch, yaw);
|
||||
stock EF_FadeClientVolume(const ENTITY, fadePercent, fadeOutSeconds, holdTime, fadeInSeconds)
|
||||
return engfunc(EngFunc_FadeClientVolume, ENTITY, fadePercent, fadeOutSeconds, holdTime, fadeInSeconds);
|
||||
stock EF_SetClientMaxspeed(const ENTITY, Float:newMaxspeed)
|
||||
return engfunc(EngFunc_SetClientMaxspeed, ENTITY, newMaxspeed);
|
||||
stock EF_CreateFakeClient(const NETNAME[])
|
||||
return engfunc(EngFunc_CreateFakeClient, NETNAME);
|
||||
stock EF_RunPlayerMove(const FAKECLIENT, const Float:VIEWANGLES[3], Float:forwardmove, Float:sidemove, Float:upmove, buttons, impulse, msec)
|
||||
return engfunc(EngFunc_RunPlayerMove, FAKECLIENT, VIEWANGLES, forwardmove, sidemove, upmove, buttons, impulse, msec);
|
||||
|
||||
stock EF_NumberOfEntities()
|
||||
return engfunc(EngFunc_NumberOfEntities);
|
||||
stock EF_StaticDecal(const Float:ORIGIN[3], decalIndex, entityIndex, modelIndex)
|
||||
return engfunc(EngFunc_StaticDecal, ORIGIN, decalIndex, entityIndex, modelIndex);
|
||||
stock EF_PrecacheGeneric(const STRING[])
|
||||
return engfunc(EngFunc_PrecacheGeneric, STRING);
|
||||
stock EF_BuildSoundMSG(const ENTITY, channel, const SAMPLE[], Float:volume, Float:attenuation, fFlags, pitch, msg_dest, msg_type, const Float:ORIGIN[3], const ED)
|
||||
return engfunc(EngFunc_BuildSoundMsg, ENTITY, channel, SAMPLE, volume, attenuation, fFlags, pitch, msg_dest, msg_type, ORIGIN, ED);
|
||||
stock EF_GetPhysicsKeyValue(const CLIENT, const KEY[])
|
||||
return engfunc(EngFunc_GetPhysicsKeyValue, CLIENT, KEY);
|
||||
|
||||
stock EF_SetPhysicsKeyValue(const CLIENT, const KEY[], const VALUE[])
|
||||
return engfunc(EngFunc_SetPhysicsKeyValue, CLIENT, KEY, VALUE);
|
||||
stock EF_GetPhysicsInfoString(const CLIENT, returnString[], maxLength)
|
||||
return engfunc(EngFunc_GetPhysicsInfoString, CLIENT, returnString, maxLength);
|
||||
stock EF_PrecacheEvent(type, const STRING[])
|
||||
return engfunc(EngFunc_PrecacheEvent, type, STRING);
|
||||
stock EF_PlaybackEvent(flags, const INVOKER, eventindex, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2)
|
||||
return engfunc(EngFunc_PlaybackEvent, flags, INVOKER, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2);
|
||||
stock EF_CheckVisibility(const ENTITY, set)
|
||||
return engfunc(EngFunc_CheckVisibility, ENTITY, set);
|
||||
|
||||
stock EF_GetCurrentPlayer()
|
||||
return engfunc(EngFunc_GetCurrentPlayer);
|
||||
stock EF_CanSkipPlayer(const PLAYER)
|
||||
return engfunc(EngFunc_CanSkipPlayer, PLAYER);
|
||||
stock EF_SetGroupMask(mask, op)
|
||||
return engfunc(EngFunc_SetGroupMask, mask, op);
|
||||
stock EF_GetClientListening(receiver, sender)
|
||||
return engfunc(EngFunc_GetClientListening, receiver, sender);
|
||||
stock EF_SetClientListening(receiver, sender, bool:listen)
|
||||
return engfunc(EngFunc_SetClientListening, receiver, sender, listen);
|
||||
|
||||
stock EF_MessageBegin(msg_dest, msg_type, const Float:ORIGIN[3], const ED)
|
||||
return engfunc(EngFunc_MessageBegin, msg_dest, msg_type, ORIGIN, ED);
|
||||
stock EF_WriteCoord(Float:value)
|
||||
return engfunc(EngFunc_WriteCoord, value);
|
||||
stock EF_WriteAngle(Float:value)
|
||||
return engfunc(EngFunc_WriteAngle, value);
|
||||
stock EF_InfoKeyValue(const INFOBUFFER, const KEY[], returnValue[], maxLength)
|
||||
return engfunc(EngFunc_InfoKeyValue, INFOBUFFER, KEY, returnValue, maxLength);
|
||||
stock EF_SetKeyValue(const INFOBUFFER, const KEY[], const VALUE[])
|
||||
return engfunc(EngFunc_SetKeyValue, INFOBUFFER, KEY, VALUE);
|
||||
|
||||
stock EF_SetClientKeyValue(const ID, const INFOBUFFER, const KEY[], const VALUE[])
|
||||
return engfunc(EngFunc_SetClientKeyValue, ID, INFOBUFFER, KEY, VALUE);
|
||||
|
||||
stock EF_CreateInstBaseline(CLASSNAME, baseline)
|
||||
return engfunc(EngFunc_CreateInstBaseline, CLASSNAME, baseline);
|
||||
|
||||
// Returns pointer to info buffer that can be used with the INFOBUFFER param
|
||||
// of EF_InfoKeyValue, EF_SetKeyValue, and EF_SetClientKeyValue
|
||||
stock EF_GetInfoKeyBuffer(const ENTITY)
|
||||
return engfunc(EngFunc_GetInfoKeyBuffer, ENTITY);
|
||||
stock EF_ClientPrintf(const ENTITY, const printType, const MESSAGE[])
|
||||
return engfunc(EngFunc_ClientPrintf, ENTITY, printType, MESSAGE);
|
||||
stock EF_ServerPrint(const MESSAGE[])
|
||||
return engfunc(EngFunc_ServerPrint, MESSAGE);
|
||||
|
||||
// DLLFuncs
|
||||
stock DF_GameInit()
|
||||
return dllfunc(DLLFunc_GameInit);
|
||||
stock DF_Spawn(const ENTITY)
|
||||
return dllfunc(DLLFunc_Spawn, ENTITY);
|
||||
stock DF_Think(const ENTITY)
|
||||
return dllfunc(DLLFunc_Think, ENTITY);
|
||||
stock DF_Use(const ENT_Used, const ENT_User)
|
||||
return dllfunc(DLLFunc_Use, ENT_Used, ENT_User);
|
||||
stock DF_Touch(const ENT_Touched, const ENT_Toucher)
|
||||
return dllfunc(DLLFunc_Touch, ENT_Touched, ENT_Toucher);
|
||||
|
||||
stock DF_Blocked(const ENT_Blocked, const ENT_Other)
|
||||
return dllfunc(DLLFunc_Blocked, ENT_Blocked, ENT_Other);
|
||||
stock DF_SetAbsBox(const ENTITY)
|
||||
return dllfunc(DLLFunc_SetAbsBox, ENTITY);
|
||||
stock DF_ClientConnect(const ENTITY, const NAME[], const ADDRESS[], RejectReason[128])
|
||||
return dllfunc(DLLFunc_ClientConnect, ENTITY, NAME, ADDRESS, RejectReason);
|
||||
stock DF_ClientDisconnect(const ENTITY)
|
||||
return dllfunc(DLLFunc_ClientDisconnect, ENTITY);
|
||||
stock DF_ClientKill(const ENTITY)
|
||||
return dllfunc(DLLFunc_ClientKill, ENTITY);
|
||||
|
||||
stock DF_ClientPutInServer(const ENTITY)
|
||||
return dllfunc(DLLFunc_ClientPutInServer, ENTITY);
|
||||
stock DF_ClientCommand(const ENTITY)
|
||||
return dllfunc(DLLFunc_ClientCommand, ENTITY);
|
||||
stock DF_ServerDeactivate()
|
||||
return dllfunc(DLLFunc_ServerDeactivate);
|
||||
stock DF_PlayerPreThink(const ENTITY)
|
||||
return dllfunc(DLLFunc_PlayerPreThink, ENTITY);
|
||||
stock DF_PlayerPostThink(const ENTITY)
|
||||
return dllfunc(DLLFunc_PlayerPostThink, ENTITY);
|
||||
|
||||
stock DF_StartFrame()
|
||||
return dllfunc(DLLFunc_StartFrame);
|
||||
stock DF_ParmsNewLevel()
|
||||
return dllfunc(DLLFunc_ParmsNewLevel);
|
||||
stock DF_ParmsChangeLevel()
|
||||
return dllfunc(DLLFunc_ParmsChangeLevel);
|
||||
stock DF_GetGameDescription()
|
||||
return dllfunc(DLLFunc_GetGameDescription);
|
||||
stock DF_SpectatorConnect(const ENTITY)
|
||||
return dllfunc(DLLFunc_SpectatorConnect, ENTITY);
|
||||
|
||||
stock DF_SpectatorDisconnect(const ENTITY)
|
||||
return dllfunc(DLLFunc_SpectatorDisconnect, ENTITY);
|
||||
stock DF_SpectatorThink(const ENTITY)
|
||||
return dllfunc(DLLFunc_SpectatorThink, ENTITY);
|
||||
stock DF_Sys_Error(const ERROR_STRING[])
|
||||
return dllfunc(DLLFunc_Sys_Error, ERROR_STRING);
|
||||
stock DF_PM_FindTextureType(name[])
|
||||
return dllfunc(DLLFunc_PM_FindTextureType, name);
|
||||
stock DF_RegisterEncoders()
|
||||
return dllfunc(DLLFunc_RegisterEncoders);
|
||||
|
||||
stock DF_GetHullBounds(hullnumber, Float:mins[3], Float:maxs[3])
|
||||
return dllfunc(DLLFunc_GetHullBounds, hullnumber, mins, maxs);
|
||||
stock DF_CreateInstBaselines()
|
||||
return dllfunc(DLLFunc_CreateInstBaselines);
|
||||
stock DF_pfnAllowLagCompensation()
|
||||
return dllfunc(DLLFunc_pfnAllowLagCompensation);
|
||||
stock DF_MetaFunc_CallGameEntity(const STRING[], const ENTITY)
|
||||
return dllfunc(MetaFunc_CallGameEntity, STRING, ENTITY);
|
||||
stock DF_ClientUserInfoChanged(const IDPLAYER)
|
||||
return dllfunc(DLLFunc_ClientUserInfoChanged, IDPLAYER);
|
||||
|
||||
stock DF_UpdateClientData(const ENTITY, sendweapons, const cd/* = 0*/)
|
||||
return dllfunc(DLLFunc_UpdateClientData, ENTITY, sendweapons, cd);
|
||||
stock DF_AddToFullPack(const STATE/* = 0*/, e, ENT, HOST, hostflags, player, set)
|
||||
return dllfunc(DLLFunc_AddToFullPack, STATE, e, ENT, HOST, hostflags, player, set);
|
||||
stock DF_CmdStart(const PLAYER, const CMD/* = 0*/, randomSeed)
|
||||
return dllfunc(DLLFunc_CmdStart, PLAYER, CMD, randomSeed);
|
||||
stock DF_CmdEnd(const PLAYER)
|
||||
return dllfunc(DLLFunc_CmdEnd, PLAYER);
|
||||
stock DF_CreateBaseline(PLAYER, eIndex, baseline, playerModelIndex, Float:playerMins[3], Float:playerMaxs[3])
|
||||
return dllfunc(DLLFunc_CreateBaseline, PLAYER, eIndex, baseline, playerModelIndex, playerMins, playerMaxs);
|
||||
@@ -0,0 +1,882 @@
|
||||
/**
|
||||
* This file provides various utility functions that use the Fakemeta module.
|
||||
* This file is created and maintained by VEN.
|
||||
* For support and issues, see:
|
||||
* http://forums.alliedmods.net/showthread.php?t=28284
|
||||
*/
|
||||
|
||||
|
||||
/* Fakemeta Utilities
|
||||
*
|
||||
* by VEN
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if !defined _fakemeta_included
|
||||
#include <fakemeta>
|
||||
#endif
|
||||
|
||||
#if defined _fakemeta_util_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fakemeta_util_included
|
||||
|
||||
#include <xs>
|
||||
|
||||
|
||||
/* Engine functions */
|
||||
|
||||
#define fm_precache_generic(%1) engfunc(EngFunc_PrecacheGeneric, %1)
|
||||
/* stock fm_precache_generic(const file[])
|
||||
return engfunc(EngFunc_PrecacheGeneric, file) */
|
||||
|
||||
#define fm_precache_event(%1,%2) engfunc(EngFunc_PrecacheEvent, %1, %2)
|
||||
/* stock fm_precache_event(type, const name[])
|
||||
return engfunc(EngFunc_PrecacheEvent, type, name) */
|
||||
|
||||
// ported by v3x
|
||||
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor, %1)
|
||||
/* stock fm_drop_to_floor(entity)
|
||||
return engfunc(EngFunc_DropToFloor, entity) */
|
||||
|
||||
#define fm_force_use(%1,%2) dllfunc(DLLFunc_Use, %2, %1)
|
||||
/* stock fm_force_use(user, used)
|
||||
return dllfunc(DLLFunc_Use, used, user) */
|
||||
|
||||
#define fm_entity_set_size(%1,%2,%3) engfunc(EngFunc_SetSize, %1, %2, %3)
|
||||
/* stock fm_entity_set_size(index, const Float:mins[3], const Float:maxs[3])
|
||||
return engfunc(EngFunc_SetSize, index, mins, maxs) */
|
||||
|
||||
#define fm_get_decal_index(%1) engfunc(EngFunc_DecalIndex, %1)
|
||||
/* stock fm_get_decal_index(const decalname[])
|
||||
return engfunc(EngFunc_DecalIndex, decalname) */
|
||||
|
||||
stock Float:fm_entity_range(ent1, ent2) {
|
||||
new Float:origin1[3], Float:origin2[3];
|
||||
pev(ent1, pev_origin, origin1);
|
||||
pev(ent2, pev_origin, origin2);
|
||||
|
||||
return get_distance_f(origin1, origin2);
|
||||
}
|
||||
|
||||
// based on KoST's port, upgraded version fits into the macros
|
||||
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
|
||||
/* stock fm_create_entity(const classname[])
|
||||
return engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classname)) */
|
||||
|
||||
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
|
||||
/* stock fm_find_ent_by_class(index, const classname[])
|
||||
return engfunc(EngFunc_FindEntityByString, index, "classname", classname) */
|
||||
|
||||
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
|
||||
new strtype[11] = "classname", ent = index;
|
||||
switch (jghgtype) {
|
||||
case 1: strtype = "target";
|
||||
case 2: strtype = "targetname";
|
||||
}
|
||||
|
||||
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
#define fm_find_ent_by_target(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "target", %2)
|
||||
/* stock fm_find_ent_by_target(index, const target[])
|
||||
return engfunc(EngFunc_FindEntityByString, index, "target", target) */
|
||||
|
||||
#define fm_find_ent_by_tname(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "targetname", %2)
|
||||
/* stock fm_find_ent_by_tname(index, const targetname[])
|
||||
return engfunc(EngFunc_FindEntityByString, index, "targetname", targetname) */
|
||||
|
||||
stock fm_find_ent_by_model(index, const classname[], const model[]) {
|
||||
new ent = index, mdl[72];
|
||||
while ((ent = fm_find_ent_by_class(ent, classname))) {
|
||||
pev(ent, pev_model, mdl, sizeof mdl - 1);
|
||||
if (equal(mdl, model))
|
||||
return ent;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define fm_find_ent_in_sphere(%1,%2,%3) engfunc(EngFunc_FindEntityInSphere, %1, %2, %3)
|
||||
/* stock fm_find_ent_in_sphere(index, const Float:origin[3], Float:radius)
|
||||
return engfunc(EngFunc_FindEntityInSphere, index, origin, radius) */
|
||||
|
||||
#define fm_call_think(%1) dllfunc(DLLFunc_Think, %1)
|
||||
/* stock fm_call_think(entity)
|
||||
return dllfunc(DLLFunc_Think, entity) */
|
||||
|
||||
#define fm_is_valid_ent(%1) pev_valid(%1)
|
||||
/* stock fm_is_valid_ent(index)
|
||||
return pev_valid(index) */
|
||||
|
||||
stock fm_entity_set_origin(index, const Float:origin[3]) {
|
||||
new Float:mins[3], Float:maxs[3];
|
||||
pev(index, pev_mins, mins);
|
||||
pev(index, pev_maxs, maxs);
|
||||
engfunc(EngFunc_SetSize, index, mins, maxs);
|
||||
|
||||
return engfunc(EngFunc_SetOrigin, index, origin);
|
||||
}
|
||||
|
||||
#define fm_entity_set_model(%1,%2) engfunc(EngFunc_SetModel, %1, %2)
|
||||
/* stock fm_entity_set_model(index, const model[])
|
||||
return engfunc(EngFunc_SetModel, index, model) */
|
||||
|
||||
// ported by v3x
|
||||
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
|
||||
/* stock fm_remove_entity(index)
|
||||
return engfunc(EngFunc_RemoveEntity, index) */
|
||||
|
||||
#define fm_entity_count() engfunc(EngFunc_NumberOfEntities)
|
||||
/* stock fm_entity_count()
|
||||
return engfunc(EngFunc_NumberOfEntities) */
|
||||
|
||||
#define fm_fake_touch(%1,%2) dllfunc(DLLFunc_Touch, %1, %2)
|
||||
/* stock fm_fake_touch(toucher, touched)
|
||||
return dllfunc(DLLFunc_Touch, toucher, touched) */
|
||||
|
||||
#define fm_DispatchSpawn(%1) dllfunc(DLLFunc_Spawn, %1)
|
||||
/* stock fm_DispatchSpawn(entity)
|
||||
return dllfunc(DLLFunc_Spawn, entity) */
|
||||
|
||||
// ported by v3x
|
||||
#define fm_point_contents(%1) engfunc(EngFunc_PointContents, %1)
|
||||
/* stock fm_point_contents(const Float:point[3])
|
||||
return engfunc(EngFunc_PointContents, point) */
|
||||
|
||||
stock fm_trace_line(ignoreent, const Float:start[3], const Float:end[3], Float:ret[3]) {
|
||||
engfunc(EngFunc_TraceLine, start, end, ignoreent == -1 ? 1 : 0, ignoreent, 0);
|
||||
|
||||
new ent = get_tr2(0, TR_pHit);
|
||||
get_tr2(0, TR_vecEndPos, ret);
|
||||
|
||||
return pev_valid(ent) ? ent : 0;
|
||||
}
|
||||
|
||||
stock fm_trace_hull(const Float:origin[3], hull, ignoredent = 0, ignoremonsters = 0) {
|
||||
new result = 0;
|
||||
engfunc(EngFunc_TraceHull, origin, origin, ignoremonsters, hull, ignoredent > 0 ? ignoredent : 0, 0);
|
||||
|
||||
if (get_tr2(0, TR_StartSolid))
|
||||
result += 1;
|
||||
if (get_tr2(0, TR_AllSolid))
|
||||
result += 2;
|
||||
if (!get_tr2(0, TR_InOpen))
|
||||
result += 4;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
stock fm_trace_normal(ignoreent, const Float:start[3], const Float:end[3], Float:ret[3]) {
|
||||
engfunc(EngFunc_TraceLine, start, end, 0, ignoreent, 0);
|
||||
get_tr2(0, TR_vecPlaneNormal, ret);
|
||||
|
||||
new Float:fraction;
|
||||
get_tr2(0, TR_flFraction, fraction);
|
||||
if (fraction >= 1.0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// note that for CS planted C4 has a "grenade" classname as well
|
||||
stock fm_get_grenade_id(id, model[], len, grenadeid = 0) {
|
||||
new ent = fm_find_ent_by_owner(grenadeid, "grenade", id);
|
||||
if (ent && len > 0)
|
||||
pev(ent, pev_model, model, len);
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
#define fm_halflife_time() get_gametime()
|
||||
/* stock Float:fm_halflife_time()
|
||||
return get_gametime() */
|
||||
|
||||
#define fm_attach_view(%1,%2) engfunc(EngFunc_SetView, %1, %2)
|
||||
/* stock fm_attach_view(index, entity)
|
||||
return engfunc(EngFunc_SetView, index, entity) */
|
||||
|
||||
stock fm_playback_event(flags, invoker, eventindex, Float:delay, const Float:origin[3], const Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2) {
|
||||
return engfunc(EngFunc_PlaybackEvent, flags, invoker, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2);
|
||||
}
|
||||
|
||||
#define fm_eng_get_string(%1,%2,%3) engfunc(EngFunc_SzFromIndex, %1, %2, %3)
|
||||
/* stock fm_eng_get_string(istring, string[], len)
|
||||
return engfunc(EngFunc_SzFromIndex, istring, string, len) */
|
||||
|
||||
|
||||
/* HLSDK functions */
|
||||
|
||||
// the dot product is performed in 2d, making the view cone infinitely tall
|
||||
stock bool:fm_is_in_viewcone(index, const Float:point[3]) {
|
||||
new Float:angles[3];
|
||||
pev(index, pev_angles, angles);
|
||||
engfunc(EngFunc_MakeVectors, angles);
|
||||
global_get(glb_v_forward, angles);
|
||||
angles[2] = 0.0;
|
||||
|
||||
new Float:origin[3], Float:diff[3], Float:norm[3];
|
||||
pev(index, pev_origin, origin);
|
||||
xs_vec_sub(point, origin, diff);
|
||||
diff[2] = 0.0;
|
||||
xs_vec_normalize(diff, norm);
|
||||
|
||||
new Float:dot, Float:fov;
|
||||
dot = xs_vec_dot(norm, angles);
|
||||
pev(index, pev_fov, fov);
|
||||
if (dot >= floatcos(fov * M_PI / 360))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
stock bool:fm_is_visible(index, const Float:point[3], ignoremonsters = 0) {
|
||||
new Float:start[3], Float:view_ofs[3];
|
||||
pev(index, pev_origin, start);
|
||||
pev(index, pev_view_ofs, view_ofs);
|
||||
xs_vec_add(start, view_ofs, start);
|
||||
|
||||
engfunc(EngFunc_TraceLine, start, point, ignoremonsters, index, 0);
|
||||
|
||||
new Float:fraction;
|
||||
get_tr2(0, TR_flFraction, fraction);
|
||||
if (fraction == 1.0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Engine_stocks functions */
|
||||
|
||||
stock fm_fakedamage(victim, const classname[], Float:takedmgdamage, damagetype) {
|
||||
new class[] = "trigger_hurt";
|
||||
new entity = fm_create_entity(class);
|
||||
if (!entity)
|
||||
return 0;
|
||||
|
||||
new value[16];
|
||||
float_to_str(takedmgdamage * 2, value, sizeof value - 1);
|
||||
fm_set_kvd(entity, "dmg", value, class);
|
||||
|
||||
num_to_str(damagetype, value, sizeof value - 1);
|
||||
fm_set_kvd(entity, "damagetype", value, class);
|
||||
|
||||
fm_set_kvd(entity, "origin", "8192 8192 8192", class);
|
||||
fm_DispatchSpawn(entity);
|
||||
|
||||
set_pev(entity, pev_classname, classname);
|
||||
fm_fake_touch(entity, victim);
|
||||
fm_remove_entity(entity);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define fm_find_ent(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
|
||||
/* stock fm_find_ent(index, const classname[])
|
||||
return engfunc(EngFunc_FindEntityByString, index, "classname", classname) */
|
||||
|
||||
#define fm_get_user_button(%1) pev(%1, pev_button)
|
||||
/* stock fm_get_user_button(index)
|
||||
return pev(index, pev_button) */
|
||||
|
||||
#define fm_get_user_oldbutton(%1) pev(%1, pev_oldbuttons)
|
||||
/* stock fm_get_user_oldbutton(index)
|
||||
return pev(index, pev_oldbuttons) */
|
||||
|
||||
#define fm_get_entity_flags(%1) pev(%1, pev_flags)
|
||||
/* stock fm_get_entity_flags(index)
|
||||
return pev(index, pev_flags) */
|
||||
|
||||
#define fm_get_entity_distance(%1,%2) floatround(fm_entity_range(%1, %2))
|
||||
/* stock fm_get_entity_distance(ent1, ent2)
|
||||
return floatround(fm_entity_range(ent1, ent2)) */
|
||||
|
||||
#define fm_get_grenade(%1) fm_get_grenade_id(%1, "", 0)
|
||||
/* stock fm_get_grenade(id)
|
||||
return fm_get_grenade_id(id, "", 0) */
|
||||
|
||||
// optimization idea by Orangutanz
|
||||
stock fm_get_brush_entity_origin(index, Float:origin[3]) {
|
||||
new Float:mins[3], Float:maxs[3];
|
||||
|
||||
pev(index, pev_origin, origin);
|
||||
pev(index, pev_mins, mins);
|
||||
pev(index, pev_maxs, maxs);
|
||||
|
||||
origin[0] += (mins[0] + maxs[0]) * 0.5;
|
||||
origin[1] += (mins[1] + maxs[1]) * 0.5;
|
||||
origin[2] += (mins[2] + maxs[2]) * 0.5;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// based on v3x's port, upgraded version returns number of removed entities
|
||||
stock fm_remove_entity_name(const classname[]) {
|
||||
new ent = -1, num = 0;
|
||||
while ((ent = fm_find_ent_by_class(ent, classname)))
|
||||
num += fm_remove_entity(ent);
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
stock fm_ViewContents(id) {
|
||||
new origin[3], Float:Orig[3];
|
||||
get_user_origin(id, origin, 3);
|
||||
IVecFVec(origin, Orig);
|
||||
|
||||
return fm_point_contents(Orig);
|
||||
}
|
||||
|
||||
stock fm_get_speed(entity) {
|
||||
new Float:Vel[3];
|
||||
pev(entity, pev_velocity, Vel);
|
||||
|
||||
return floatround(vector_length(Vel));
|
||||
}
|
||||
|
||||
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
|
||||
new Float:RenderColor[3];
|
||||
RenderColor[0] = float(r);
|
||||
RenderColor[1] = float(g);
|
||||
RenderColor[2] = float(b);
|
||||
|
||||
set_pev(entity, pev_renderfx, fx);
|
||||
set_pev(entity, pev_rendercolor, RenderColor);
|
||||
set_pev(entity, pev_rendermode, render);
|
||||
set_pev(entity, pev_renderamt, float(amount));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock fm_set_entity_flags(index, flag, onoff) {
|
||||
new flags = pev(index, pev_flags);
|
||||
if ((flags & flag) > 0)
|
||||
return onoff == 1 ? 2 : 1 + 0 * set_pev(index, pev_flags, flags - flag);
|
||||
else
|
||||
return onoff == 0 ? 2 : 1 + 0 * set_pev(index, pev_flags, flags + flag);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock fm_set_entity_visibility(index, visible = 1) {
|
||||
set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define fm_get_entity_visibility(%1) (!(pev(%1, pev_effects) & EF_NODRAW))
|
||||
/* stock fm_get_entity_visibility(index)
|
||||
return !(pev(index, pev_effects) & EF_NODRAW) */
|
||||
|
||||
stock fm_set_user_velocity(entity, const Float:vector[3]) {
|
||||
set_pev(entity, pev_velocity, vector);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define fm_get_user_velocity(%1,%2) pev(%1, pev_velocity, %2)
|
||||
/* stock fm_get_user_velocity(entity, Float:vector[3])
|
||||
return pev(entity, pev_velocity, vector) */
|
||||
|
||||
|
||||
/* Fun functions */
|
||||
|
||||
#define fm_get_client_listen(%1,%2) engfunc(EngFunc_GetClientListening, %1, %2)
|
||||
/* stock fm_get_client_listen(receiver, sender)
|
||||
return engfunc(EngFunc_GetClientListening, receiver, sender) */
|
||||
|
||||
#define fm_set_client_listen(%1,%2,%3) engfunc(EngFunc_SetClientListening, %1, %2, %3)
|
||||
/* stock fm_set_client_listen(receiver, sender, listen)
|
||||
return engfunc(EngFunc_SetClientListening, receiver, sender, listen) */
|
||||
|
||||
stock fm_get_user_godmode(index) {
|
||||
new Float:val;
|
||||
pev(index, pev_takedamage, val);
|
||||
|
||||
return (val == DAMAGE_NO);
|
||||
}
|
||||
|
||||
stock fm_set_user_godmode(index, godmode = 0) {
|
||||
set_pev(index, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock fm_set_user_armor(index, armor) {
|
||||
set_pev(index, pev_armorvalue, float(armor));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock fm_set_user_health(index, health) {
|
||||
health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock fm_set_user_origin(index, /* const */ origin[3]) {
|
||||
new Float:orig[3];
|
||||
IVecFVec(origin, orig);
|
||||
|
||||
return fm_entity_set_origin(index, orig);
|
||||
}
|
||||
|
||||
stock fm_set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
|
||||
return fm_set_rendering(index, fx, r, g, b, render, amount);
|
||||
}
|
||||
|
||||
stock fm_give_item(index, const item[]) {
|
||||
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
|
||||
return 0;
|
||||
|
||||
new ent = fm_create_entity(item);
|
||||
if (!pev_valid(ent))
|
||||
return 0;
|
||||
|
||||
new Float:origin[3];
|
||||
pev(index, pev_origin, origin);
|
||||
set_pev(ent, pev_origin, origin);
|
||||
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
|
||||
dllfunc(DLLFunc_Spawn, ent);
|
||||
|
||||
new save = pev(ent, pev_solid);
|
||||
dllfunc(DLLFunc_Touch, ent, index);
|
||||
if (pev(ent, pev_solid) != save)
|
||||
return ent;
|
||||
|
||||
engfunc(EngFunc_RemoveEntity, ent);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
stock fm_set_user_maxspeed(index, Float:speed = -1.0) {
|
||||
engfunc(EngFunc_SetClientMaxspeed, index, speed);
|
||||
set_pev(index, pev_maxspeed, speed);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock Float:fm_get_user_maxspeed(index) {
|
||||
new Float:speed;
|
||||
pev(index, pev_maxspeed, speed);
|
||||
|
||||
return speed;
|
||||
}
|
||||
|
||||
stock fm_set_user_gravity(index, Float:gravity = 1.0) {
|
||||
set_pev(index, pev_gravity, gravity);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock Float:fm_get_user_gravity(index) {
|
||||
new Float:gravity;
|
||||
pev(index, pev_gravity, gravity);
|
||||
|
||||
return gravity;
|
||||
}
|
||||
|
||||
/* interferes with FM_Spawn enum, just use fm_DispatchSpawn
|
||||
stock fm_spawn(entity) {
|
||||
return dllfunc(DLLFunc_Spawn, entity)
|
||||
}
|
||||
*/
|
||||
|
||||
stock fm_set_user_noclip(index, noclip = 0) {
|
||||
set_pev(index, pev_movetype, noclip == 1 ? MOVETYPE_NOCLIP : MOVETYPE_WALK);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define fm_get_user_noclip(%1) (pev(%1, pev_movetype) == MOVETYPE_NOCLIP)
|
||||
/* stock fm_get_user_noclip(index)
|
||||
return (pev(index, pev_movetype) == MOVETYPE_NOCLIP) */
|
||||
|
||||
// note: get_user_weapon will still return former weapon index
|
||||
stock fm_strip_user_weapons(index) {
|
||||
new ent = fm_create_entity("player_weaponstrip");
|
||||
if (!pev_valid(ent))
|
||||
return 0;
|
||||
|
||||
dllfunc(DLLFunc_Spawn, ent);
|
||||
dllfunc(DLLFunc_Use, ent, index);
|
||||
engfunc(EngFunc_RemoveEntity, ent);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock fm_set_user_frags(index, frags) {
|
||||
set_pev(index, pev_frags, float(frags));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Cstrike functions */
|
||||
|
||||
stock fm_cs_user_spawn(index) {
|
||||
set_pev(index, pev_deadflag, DEAD_RESPAWNABLE);
|
||||
dllfunc(DLLFunc_Spawn, index);
|
||||
set_pev(index, pev_iuser1, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Custom functions */
|
||||
|
||||
// based on Basic-Master's set_keyvalue, upgraded version accepts an optional classname (a bit more efficient if it is passed)
|
||||
stock fm_set_kvd(entity, const key[], const value[], const classname[] = "") {
|
||||
if (classname[0])
|
||||
set_kvd(0, KV_ClassName, classname);
|
||||
else {
|
||||
new class[32];
|
||||
pev(entity, pev_classname, class, sizeof class - 1);
|
||||
set_kvd(0, KV_ClassName, class);
|
||||
}
|
||||
|
||||
set_kvd(0, KV_KeyName, key);
|
||||
set_kvd(0, KV_Value, value);
|
||||
set_kvd(0, KV_fHandled, 0);
|
||||
|
||||
return dllfunc(DLLFunc_KeyValue, entity, 0);
|
||||
}
|
||||
|
||||
stock fm_find_ent_by_integer(index, pev_field, value) {
|
||||
static maxents;
|
||||
if (!maxents)
|
||||
maxents = global_get(glb_maxEntities);
|
||||
|
||||
for (new i = index + 1; i < maxents; ++i) {
|
||||
if (pev_valid(i) && pev(i, pev_field) == value)
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock fm_find_ent_by_flags(index, pev_field, flags) {
|
||||
static maxents;
|
||||
if (!maxents)
|
||||
maxents = global_get(glb_maxEntities);
|
||||
|
||||
for (new i = index + 1; i < maxents; ++i) {
|
||||
if (pev_valid(i) && (pev(i, pev_field) & flags) == flags)
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock Float:fm_distance_to_box(const Float:point[3], const Float:mins[3], const Float:maxs[3]) {
|
||||
new Float:dist[3];
|
||||
for (new i = 0; i < 3; ++i) {
|
||||
if (point[i] > maxs[i])
|
||||
dist[i] = point[i] - maxs[i];
|
||||
else if (mins[i] > point[i])
|
||||
dist[i] = mins[i] - point[i];
|
||||
}
|
||||
|
||||
return vector_length(dist);
|
||||
}
|
||||
|
||||
stock Float:fm_boxes_distance(const Float:mins1[3], const Float:maxs1[3], const Float:mins2[3], const Float:maxs2[3]) {
|
||||
new Float:dist[3];
|
||||
for (new i = 0; i < 3; ++i) {
|
||||
if (mins1[i] > maxs2[i])
|
||||
dist[i] = mins1[i] - maxs2[i];
|
||||
else if (mins2[i] > maxs1[i])
|
||||
dist[i] = mins2[i] - maxs1[i];
|
||||
}
|
||||
|
||||
return vector_length(dist);
|
||||
}
|
||||
|
||||
stock Float:fm_distance_to_boxent(entity, boxent) {
|
||||
new Float:point[3];
|
||||
pev(entity, pev_origin, point);
|
||||
|
||||
new Float:mins[3], Float:maxs[3];
|
||||
pev(boxent, pev_absmin, mins);
|
||||
pev(boxent, pev_absmax, maxs);
|
||||
|
||||
return fm_distance_to_box(point, mins, maxs);
|
||||
}
|
||||
|
||||
stock Float:fm_boxents_distance(boxent1, boxent2) {
|
||||
new Float:mins1[3], Float:maxs1[3];
|
||||
pev(boxent1, pev_absmin, mins1);
|
||||
pev(boxent1, pev_absmax, maxs1);
|
||||
|
||||
new Float:mins2[3], Float:maxs2[3];
|
||||
pev(boxent2, pev_absmin, mins2);
|
||||
pev(boxent2, pev_absmax, maxs2);
|
||||
|
||||
return fm_boxes_distance(mins1, maxs1, mins2, maxs2);
|
||||
}
|
||||
|
||||
// projects a center of a player's feet base (originally by P34nut, improved)
|
||||
stock Float:fm_distance_to_floor(index, ignoremonsters = 1) {
|
||||
new Float:start[3], Float:dest[3], Float:end[3];
|
||||
pev(index, pev_origin, start);
|
||||
dest[0] = start[0];
|
||||
dest[1] = start[1];
|
||||
dest[2] = -8191.0;
|
||||
|
||||
engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index, 0);
|
||||
get_tr2(0, TR_vecEndPos, end);
|
||||
|
||||
pev(index, pev_absmin, start);
|
||||
new Float:ret = start[2] - end[2];
|
||||
|
||||
return ret > 0 ? ret : 0.0;
|
||||
}
|
||||
|
||||
// potential to crash (?) if used on weaponbox+weapon_* entity pair (use fm_remove_weaponbox instead)
|
||||
stock fm_kill_entity(index) {
|
||||
set_pev(index, pev_flags, pev(index, pev_flags) | FL_KILLME);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if weapon index isn't passed then assuming that it's the current weapon
|
||||
stock fm_get_user_weapon_entity(id, wid = 0) {
|
||||
new weap = wid, clip, ammo;
|
||||
if (!weap && !(weap = get_user_weapon(id, clip, ammo)))
|
||||
return 0;
|
||||
|
||||
new class[32];
|
||||
get_weaponname(weap, class, sizeof class - 1);
|
||||
|
||||
return fm_find_ent_by_owner(-1, class, id);
|
||||
}
|
||||
|
||||
// only weapon index or its name can be passed, if neither is passed then the current gun will be stripped
|
||||
stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") {
|
||||
new ent_class[32];
|
||||
if (!wid && wname[0])
|
||||
copy(ent_class, sizeof ent_class - 1, wname);
|
||||
else {
|
||||
new weapon = wid, clip, ammo;
|
||||
if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
|
||||
return false;
|
||||
|
||||
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
|
||||
}
|
||||
|
||||
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index);
|
||||
if (!ent_weap)
|
||||
return false;
|
||||
|
||||
engclient_cmd(index, "drop", ent_class);
|
||||
|
||||
new ent_box = pev(ent_weap, pev_owner);
|
||||
if (!ent_box || ent_box == index)
|
||||
return false;
|
||||
|
||||
dllfunc(DLLFunc_Think, ent_box);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// only weapon index or its name can be passed, if neither is passed then the current gun will be transferred
|
||||
stock bool:fm_transfer_user_gun(index1, index2, wid = 0, const wname[] = "") {
|
||||
new ent_class[32];
|
||||
if (!wid && wname[0])
|
||||
copy(ent_class, sizeof ent_class - 1, wname);
|
||||
else {
|
||||
new weapon = wid, clip, ammo;
|
||||
if (!weapon && !(weapon = get_user_weapon(index1, clip, ammo)))
|
||||
return false;
|
||||
|
||||
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
|
||||
}
|
||||
|
||||
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index1);
|
||||
if (!ent_weap)
|
||||
return false;
|
||||
|
||||
engclient_cmd(index1, "drop", ent_class);
|
||||
|
||||
new ent_box = pev(ent_weap, pev_owner);
|
||||
if (!ent_box || ent_box == index1)
|
||||
return false;
|
||||
|
||||
set_pev(ent_box, pev_flags, pev(ent_box, pev_flags) | FL_ONGROUND);
|
||||
dllfunc(DLLFunc_Touch, ent_box, index2);
|
||||
if (pev(ent_weap, pev_owner) != index2)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
stock bool:fm_is_ent_visible(index, entity, ignoremonsters = 0) {
|
||||
new Float:start[3], Float:dest[3];
|
||||
pev(index, pev_origin, start);
|
||||
pev(index, pev_view_ofs, dest);
|
||||
xs_vec_add(start, dest, start);
|
||||
|
||||
pev(entity, pev_origin, dest);
|
||||
engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index, 0);
|
||||
|
||||
new Float:fraction;
|
||||
get_tr2(0, TR_flFraction, fraction);
|
||||
if (fraction == 1.0 || get_tr2(0, TR_pHit) == entity)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ported from AMXX's core get_user_origin(..., 3) (suggested by Greenberet)
|
||||
stock fm_get_aim_origin(index, Float:origin[3]) {
|
||||
new Float:start[3], Float:view_ofs[3];
|
||||
pev(index, pev_origin, start);
|
||||
pev(index, pev_view_ofs, view_ofs);
|
||||
xs_vec_add(start, view_ofs, start);
|
||||
|
||||
new Float:dest[3];
|
||||
pev(index, pev_v_angle, dest);
|
||||
engfunc(EngFunc_MakeVectors, dest);
|
||||
global_get(glb_v_forward, dest);
|
||||
xs_vec_mul_scalar(dest, 9999.0, dest);
|
||||
xs_vec_add(start, dest, dest);
|
||||
|
||||
engfunc(EngFunc_TraceLine, start, dest, 0, index, 0);
|
||||
get_tr2(0, TR_vecEndPos, origin);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock bool:fm_get_user_longjump(index) {
|
||||
new value[2];
|
||||
engfunc(EngFunc_GetPhysicsKeyValue, index, "slj", value, 1);
|
||||
switch (value[0]) {
|
||||
case '1': return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
stock fm_set_user_longjump(index, bool:longjump = true, bool:tempicon = true) {
|
||||
if (longjump == fm_get_user_longjump(index))
|
||||
return;
|
||||
|
||||
if (longjump) {
|
||||
engfunc(EngFunc_SetPhysicsKeyValue, index, "slj", "1");
|
||||
if (tempicon) {
|
||||
static msgid_itempickup;
|
||||
if (!msgid_itempickup)
|
||||
msgid_itempickup = get_user_msgid("ItemPickup");
|
||||
|
||||
message_begin(MSG_ONE, msgid_itempickup, _, index);
|
||||
write_string("item_longjump");
|
||||
message_end();
|
||||
}
|
||||
}
|
||||
else
|
||||
engfunc(EngFunc_SetPhysicsKeyValue, index, "slj", "0");
|
||||
}
|
||||
|
||||
#define WEAPON_SUIT 31
|
||||
|
||||
stock bool:fm_get_user_suit(index) {
|
||||
return bool:(!(!(pev(index, pev_weapons) & (1<<WEAPON_SUIT)))); // i'm not insane, this is a trick!
|
||||
}
|
||||
|
||||
stock fm_set_user_suit(index, bool:suit = true, bool:sound = true) {
|
||||
new weapons = pev(index, pev_weapons);
|
||||
if (!suit)
|
||||
set_pev(index, pev_weapons, weapons & ~(1<<WEAPON_SUIT));
|
||||
else if (!(weapons & (1<<WEAPON_SUIT))) {
|
||||
set_pev(index, pev_weapons, weapons | (1<<WEAPON_SUIT));
|
||||
if (sound)
|
||||
emit_sound(index, CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
|
||||
}
|
||||
}
|
||||
|
||||
#define FEV_RELIABLE (1<<1)
|
||||
#define FEV_GLOBAL (1<<2)
|
||||
|
||||
// removes all created decals and players' corpses from the world
|
||||
// set a specific index to remove decals only for the given client
|
||||
stock fm_cs_remove_decals(index = 0) {
|
||||
static eventindex_decal_reset;
|
||||
if (!eventindex_decal_reset)
|
||||
eventindex_decal_reset = engfunc(EngFunc_PrecacheEvent, 1, "events/decal_reset.sc");
|
||||
|
||||
new flags = FEV_RELIABLE;
|
||||
if (!index)
|
||||
flags |= FEV_GLOBAL;
|
||||
|
||||
engfunc(EngFunc_PlaybackEvent, flags, index, eventindex_decal_reset, 0.0, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0}, 0.0, 0.0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
// checks whether the entity's classname is equal to the passed classname
|
||||
stock bool:fm_is_ent_classname(index, const classname[]) {
|
||||
if (!pev_valid(index))
|
||||
return false;
|
||||
|
||||
new class[32];
|
||||
pev(index, pev_classname, class, sizeof class - 1);
|
||||
if (equal(class, classname))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// the same as AMXX's core user_kill but fixes the issue when the scoreboard doesn't update immediately if flag is set to 1
|
||||
stock fm_user_kill(index, flag = 0) {
|
||||
if (flag) {
|
||||
new Float:frags;
|
||||
pev(index, pev_frags, frags);
|
||||
set_pev(index, pev_frags, ++frags);
|
||||
}
|
||||
|
||||
dllfunc(DLLFunc_ClientKill, index);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// returns a degree angle between player-to-point and player's view vectors
|
||||
stock Float:fm_get_view_angle_diff(index, const Float:point[3]) {
|
||||
new Float:vec[3], Float:ofs[3], Float:aim[3];
|
||||
pev(index, pev_origin, vec);
|
||||
pev(index, pev_view_ofs, ofs);
|
||||
xs_vec_add(vec, ofs, vec);
|
||||
xs_vec_sub(point, vec, vec);
|
||||
xs_vec_normalize(vec, vec);
|
||||
|
||||
pev(index, pev_v_angle, aim);
|
||||
engfunc(EngFunc_MakeVectors, aim);
|
||||
global_get(glb_v_forward, aim);
|
||||
|
||||
return xs_vec_angle(vec, aim);
|
||||
}
|
||||
|
||||
// gets a weapon type of the linked to weaponbox weapon_* entity
|
||||
stock fm_get_weaponbox_type(entity) {
|
||||
static max_clients, max_entities;
|
||||
if (!max_clients)
|
||||
max_clients = global_get(glb_maxClients);
|
||||
if (!max_entities)
|
||||
max_entities = global_get(glb_maxEntities);
|
||||
|
||||
for (new i = max_clients + 1; i < max_entities; ++i) {
|
||||
if (pev_valid(i) && entity == pev(i, pev_owner)) {
|
||||
new wname[32];
|
||||
pev(i, pev_classname, wname, sizeof wname - 1);
|
||||
return get_weaponid(wname);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// safe removal of weaponbox+weapon_* entity pair (delay =~= 0.03 second)
|
||||
#define fm_remove_weaponbox(%1) dllfunc(DLLFunc_Think, %1)
|
||||
/* stock fm_remove_weaponbox(entity)
|
||||
return dllfunc(DLLFunc_Think, entity) */
|
||||
@@ -0,0 +1,143 @@
|
||||
/* Files functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _file_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _file_included
|
||||
|
||||
/* Reads content from directory.
|
||||
* Returns index of next element or 0 when end of dir. is reached. */
|
||||
native read_dir(const dirname[],pos,output[],len,&outlen);
|
||||
|
||||
/* Reads line from file. Returns index of next line or 0 when end of file is reached. */
|
||||
native read_file(const file[],line,text[],len,&txtlen);
|
||||
|
||||
/* Writes text to file. Function returns 0 on failure.
|
||||
* When line is set to -1, the text is added at the end of file. */
|
||||
native write_file(const file[],const text[],line = -1);
|
||||
|
||||
/* Deletes file. Function returns 1 on success, 0 on failure. */
|
||||
native delete_file(const file[]);
|
||||
|
||||
/* Checks for file. If file exists function returns 1, in other case 0. */
|
||||
native file_exists(const file[]);
|
||||
|
||||
/* renames a file. returns 0 on failure, 1 on success.
|
||||
* if relative true, rename_file will act like other natives which
|
||||
* use the moddir as a base directory. otherwise, the current directory is
|
||||
* undefined (but assumed to be hlds).
|
||||
*/
|
||||
native rename_file(const oldname[], const newname[], relative=0);
|
||||
|
||||
/* Checks if a directory exists */
|
||||
native dir_exists(const dir[]);
|
||||
|
||||
/* Returns a file size in bytes if flag is set to 0.
|
||||
* When flag is set to 1 returns number of lines in the file,
|
||||
* and when flags is 2, function returns 1 if the file ends
|
||||
* with line feed. If file doesn't exist returns -1. */
|
||||
native file_size(const file[], flag=0);
|
||||
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
//Open a file, returns a handle or 0 on failure
|
||||
native fopen(const filename[],const mode[]);
|
||||
|
||||
//Closes a file handle
|
||||
native fclose(file);
|
||||
|
||||
#define BLOCK_INT 4
|
||||
#define BLOCK_SHORT 2
|
||||
#define BLOCK_CHAR 1
|
||||
#define BLOCK_BYTE 1
|
||||
|
||||
//The following functions work as such:
|
||||
// RAW - means the array you pass is a raw bytestream, for experts only
|
||||
// BLOCK - means you are passing in an array where each element will be written
|
||||
// NORMAL - means you are writing only one element
|
||||
// RAW and BLOCK return the number of blocks acted upon successfully
|
||||
// NORMAL returns 1 on success
|
||||
|
||||
native fread(file, &data, mode);
|
||||
native fread_blocks(file, data[], blocks, mode);
|
||||
native fread_raw(file, stream[], blocksize, blocks);
|
||||
native fwrite(file, data, mode);
|
||||
native fwrite_blocks(file, const data[], blocks, mode);
|
||||
native fwrite_raw(file, const stream[], blocksize, mode);
|
||||
|
||||
//Returns 1 if the file is ended, 0 otherwise
|
||||
native feof(file);
|
||||
|
||||
//Reads a line from a text file -- includes newline!
|
||||
native fgets(file, buffer[], maxlength);
|
||||
|
||||
//Writes a line to a text file. Returns # of characters written.
|
||||
native fputs(file, const text[]);
|
||||
|
||||
//Writes a line to the file
|
||||
native fprintf(file, const fmt[], any:...);
|
||||
|
||||
//Sets the current position in a file (see SEEK_ values above)
|
||||
native fseek(file, position, start);
|
||||
|
||||
//Returns the current position in a file
|
||||
native ftell(file);
|
||||
|
||||
//These are straight from the C standard.
|
||||
native fgetc(file);
|
||||
native fputc(file, data);
|
||||
native fungetc(file, data);
|
||||
|
||||
//Return the size of a file
|
||||
native filesize(const filename[], any:...);
|
||||
|
||||
//Attempts to remove a directory.
|
||||
//Note that you cannot remove a directory that has files on most
|
||||
// operating systems.
|
||||
native rmdir(const path[]);
|
||||
|
||||
/* Returns 0 on success, like the POSIX specification */
|
||||
native mkdir(const dirname[]);
|
||||
|
||||
|
||||
//Delete a file (delete_file macro)
|
||||
native unlink(const filename[]);
|
||||
|
||||
//Returns a handle to a directory
|
||||
native open_dir(dir[], firstfile[], length);
|
||||
native next_file(dirh, buffer[], length);
|
||||
native close_dir(dirh);
|
||||
|
||||
/**
|
||||
* Loads a file using the LoadFileForMe engine function.
|
||||
*
|
||||
* The data is truncated if there is not enough space. No null-terminator
|
||||
* is applied; the data is the raw contents of the file.
|
||||
*
|
||||
* @param file File to load (may be a file from the GCF).
|
||||
* @param buffer Buffer to store file contents.
|
||||
* @param maxlength Maximum size of the file buffer.
|
||||
* @param length Variable to store the file length. This may return
|
||||
* a number larger than the buffer size.
|
||||
* @return -1 if the file could not be loaded. Otherwise,
|
||||
* the number of cells actually written to the buffer
|
||||
* are returned.
|
||||
*/
|
||||
native LoadFileForMe(const file[], buffer[], maxlength, &length=0);
|
||||
|
||||
/**
|
||||
* Flushes a buffered output stream.
|
||||
*
|
||||
* @param file File handle, or 0 for all open streams.
|
||||
* @return 0 on success, -1 on failure.
|
||||
*/
|
||||
native fflush(file);
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
/* Float arithmetic
|
||||
*
|
||||
* (c) Copyright 1999, Artran, Inc.
|
||||
* Written by Greg Garner (gmg@artran.com)
|
||||
* Modified in March 2001 to include user defined
|
||||
* operators for the floating point functions.
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _float_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _float_included
|
||||
|
||||
/* Different methods of rounding */
|
||||
enum floatround_method {
|
||||
floatround_round = 0,
|
||||
floatround_floor,
|
||||
floatround_ceil,
|
||||
floatround_tozero
|
||||
};
|
||||
|
||||
enum anglemode {
|
||||
radian = 0,
|
||||
degrees,
|
||||
grades
|
||||
};
|
||||
|
||||
/* Convert an integer into a floating point value */
|
||||
native Float:float(value);
|
||||
|
||||
/* Convert a string into a floating point value */
|
||||
native Float:floatstr(const string[]);
|
||||
|
||||
/* Multiple two floats together */
|
||||
native Float:floatmul(Float:oper1, Float:oper2);
|
||||
|
||||
/* Divide the dividend float by the divisor float */
|
||||
native Float:floatdiv(Float:dividend, Float:divisor);
|
||||
|
||||
/* Add two floats together */
|
||||
native Float:floatadd(Float:dividend, Float:divisor);
|
||||
|
||||
/* Subtract oper2 float from oper1 float */
|
||||
native Float:floatsub(Float:oper1, Float:oper2);
|
||||
|
||||
/* Return the fractional part of a float */
|
||||
native Float:floatfract(Float:value);
|
||||
|
||||
/* Round a float into a integer value */
|
||||
native floatround(Float:value, floatround_method:method=floatround_round);
|
||||
|
||||
/* Compare two integers. If the two elements are equal, return 0.
|
||||
* If the first argument is greater than the second argument, return 1,
|
||||
* If the first argument is less than the second argument, return -1. */
|
||||
native floatcmp(Float:fOne, Float:fTwo);
|
||||
|
||||
/* Return the square root of the input value, same as floatpower(value, 0.5) */
|
||||
native Float:floatsqroot(Float:value);
|
||||
|
||||
/* Return the value raised to the power of the exponent */
|
||||
native Float:floatpower(Float:value, Float:exponent);
|
||||
|
||||
/* Return the logarithm */
|
||||
native Float:floatlog(Float:value, Float:base=10.0);
|
||||
|
||||
/* Return the sine, cosine or tangent.
|
||||
* The input angle may be in radians, degrees or grades. */
|
||||
native Float:floatsin(Float:value, anglemode:mode=radian);
|
||||
native Float:floatcos(Float:value, anglemode:mode=radian);
|
||||
native Float:floattan(Float:value, anglemode:mode=radian);
|
||||
|
||||
/* Return the hyperbolic sine, cosine or tangent.
|
||||
* The input angle may be in radians, degrees or grades. */
|
||||
native Float:floatsinh(Float:angle, anglemode:mode=radian);
|
||||
native Float:floatcosh(Float:angle, anglemode:mode=radian);
|
||||
native Float:floattanh(Float:angle, anglemode:mode=radian);
|
||||
|
||||
/* Return the absolute value */
|
||||
native Float:floatabs(Float:value);
|
||||
|
||||
/* Return the angle of a sine, cosine or tangent.
|
||||
* The output angle may be in radians, degrees, or grades. */
|
||||
native Float:floatatan(Float:angle, {anglemode,_}:radix);
|
||||
native Float:floatacos(Float:angle, {anglemode,_}:radix);
|
||||
native Float:floatasin(Float:angle, {anglemode,_}:radix);
|
||||
native Float:floatatan2(Float:x, Float:y, {anglemode,_}:radix);
|
||||
|
||||
#pragma rational Float
|
||||
|
||||
/* user defined operators */
|
||||
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
|
||||
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
|
||||
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
|
||||
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
|
||||
|
||||
stock Float:operator++(Float:oper)
|
||||
return oper+1.0;
|
||||
|
||||
stock Float:operator--(Float:oper)
|
||||
return oper-1.0;
|
||||
|
||||
stock Float:operator-(Float:oper)
|
||||
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
|
||||
|
||||
stock Float:operator*(Float:oper1, oper2)
|
||||
return floatmul(oper1, float(oper2)); /* "*" is commutative */
|
||||
|
||||
stock Float:operator/(Float:oper1, oper2)
|
||||
return floatdiv(oper1, float(oper2));
|
||||
|
||||
stock Float:operator/(oper1, Float:oper2)
|
||||
return floatdiv(float(oper1), oper2);
|
||||
|
||||
stock Float:operator+(Float:oper1, oper2)
|
||||
return floatadd(oper1, float(oper2)); /* "+" is commutative */
|
||||
|
||||
stock Float:operator-(Float:oper1, oper2)
|
||||
return floatsub(oper1, float(oper2));
|
||||
|
||||
stock Float:operator-(oper1, Float:oper2)
|
||||
return floatsub(float(oper1), oper2);
|
||||
|
||||
stock bool:operator==(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) == 0;
|
||||
|
||||
stock bool:operator==(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator!=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) != 0;
|
||||
|
||||
stock bool:operator!=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) != 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator>(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) > 0;
|
||||
|
||||
stock bool:operator>(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) > 0;
|
||||
|
||||
stock bool:operator>(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) > 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) >= 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) >= 0;
|
||||
|
||||
stock bool:operator>=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) >= 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) < 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) < 0;
|
||||
|
||||
stock bool:operator<(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) < 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) <= 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) <= 0;
|
||||
|
||||
stock bool:operator<=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) <= 0;
|
||||
|
||||
stock bool:operator!(Float:oper)
|
||||
return (_:oper & ((-1)/2)) == 0; /* -1 = all bits to 1; /2 = remove most significant bit (sign)
|
||||
works on both 32bit and 64bit systems; no constant required */
|
||||
/* forbidden operations */
|
||||
forward operator%(Float:oper1, Float:oper2);
|
||||
forward operator%(Float:oper1, oper2);
|
||||
forward operator%(oper1, Float:oper2);
|
||||
|
||||
|
||||
stock Float:floatmin(Float:ValueA, Float:ValueB)
|
||||
{
|
||||
if (ValueA<=ValueB)
|
||||
{
|
||||
return ValueA;
|
||||
}
|
||||
|
||||
return ValueB;
|
||||
}
|
||||
|
||||
stock Float:floatmax(Float:ValueA, Float:ValueB)
|
||||
{
|
||||
if (ValueA>=ValueB)
|
||||
{
|
||||
return ValueA;
|
||||
}
|
||||
|
||||
return ValueB;
|
||||
}
|
||||
stock Float:floatclamp(Float:Value, Float:MinValue, Float:MaxValue)
|
||||
{
|
||||
if (Value<=MinValue)
|
||||
{
|
||||
return MinValue;
|
||||
}
|
||||
if (Value>=MaxValue)
|
||||
{
|
||||
return MaxValue;
|
||||
}
|
||||
|
||||
return Value;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/* Fun functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _fun_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fun_included
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib fun
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib fun
|
||||
#endif
|
||||
#else
|
||||
#pragma library fun
|
||||
#endif
|
||||
|
||||
/* Returns 1 if receiver hears sender via voice communication. */
|
||||
native get_client_listen(receiver, sender);
|
||||
|
||||
/* Sets who can listen who. Function returns 0
|
||||
* if for some reasons this setting can't be done. */
|
||||
native set_client_listen(receiver, sender, listen);
|
||||
|
||||
/* Sets player godmode. If you want to disable godmode set only first parameter. */
|
||||
native set_user_godmode(index, godmode = 0);
|
||||
|
||||
/* Returns 1 if godmode is set. */
|
||||
native get_user_godmode(index);
|
||||
|
||||
/* Sets player armor. */
|
||||
native set_user_armor(index, armor);
|
||||
|
||||
/* Sets player health. */
|
||||
native set_user_health(index, health);
|
||||
|
||||
/* Move player to origin. */
|
||||
native set_user_origin(index, const origin[3]);
|
||||
|
||||
/* Sets player rendering mode. */
|
||||
native set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16);
|
||||
|
||||
/* Gives item to player, name of item can start
|
||||
* with weapon_, ammo_ and item_. This event
|
||||
* is announced with proper message to all players. */
|
||||
native give_item(index, const item[]);
|
||||
|
||||
/* Sets hit zones for player.
|
||||
* Parts of body are as bits:
|
||||
* 1 - generic
|
||||
* 2 - head
|
||||
* 4 - chest
|
||||
* 8 - stomach
|
||||
* 16 - left arm
|
||||
* 32 - right arm
|
||||
* 64 - left leg
|
||||
* 128 - right leg */
|
||||
native set_user_hitzones(index = 0, target = 0, body = 255);
|
||||
|
||||
/* Get user hitzones. */
|
||||
native get_user_hitzones(index, target);
|
||||
|
||||
/* Sets users max. speed. */
|
||||
native set_user_maxspeed(index, Float:speed = -1.0);
|
||||
|
||||
/* Returns users max. speed. */
|
||||
native Float:get_user_maxspeed(index);
|
||||
|
||||
/* Sets users gravity. */
|
||||
native set_user_gravity(index, Float:gravity = 1.0);
|
||||
|
||||
/* Returns users gravity. */
|
||||
native Float:get_user_gravity(index);
|
||||
|
||||
/* Spawns entity. */
|
||||
native spawn(index);
|
||||
|
||||
/* Sets player noclip. If you want to disable noclip set only first parameter. */
|
||||
native set_user_noclip(index, noclip = 0);
|
||||
|
||||
/* Returns 1 if noclip is set. */
|
||||
native get_user_noclip(index);
|
||||
|
||||
/* Returns 1 if player has silent footsteps, 0 if footsteps are set to normal */
|
||||
native get_user_footsteps(index);
|
||||
|
||||
/* Gives player silent footsteps.
|
||||
* if set = 0 it will return footsteps to normal */
|
||||
native set_user_footsteps(id, set = 1);
|
||||
|
||||
/* Strips all weapons from user. */
|
||||
native strip_user_weapons(index);
|
||||
|
||||
/* Sets player frags. */
|
||||
native set_user_frags(index, frags);
|
||||
@@ -0,0 +1,74 @@
|
||||
/* GeoIP module functions for AMX Mod X
|
||||
by David "BAILOPAN" Anderson
|
||||
(C)Copyrighted under the GNU General Public License, Version 2
|
||||
*/
|
||||
|
||||
#if defined geoip_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _geoip_included
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib geoip
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib geoip
|
||||
#endif
|
||||
#else
|
||||
#pragma library geoip
|
||||
#endif
|
||||
|
||||
/// IP addresses passed to these natives can contain ports, the ports will be ignored.
|
||||
|
||||
/**
|
||||
* Lookup the two character country code for a given IP address.
|
||||
* e.g: "US", "CA", etc.
|
||||
*
|
||||
* @param ip The IP address to lookup.
|
||||
* @param result The result buffer. If the lookup does not succeed, the buffer is not modified.
|
||||
* @return true on a successful lookup, false on a failed lookup.
|
||||
*/
|
||||
native bool:geoip_code2_ex(const ip[], result[3]);
|
||||
|
||||
/**
|
||||
* Lookup the three character country code for a given IP address.
|
||||
* e.g: "USA", "cAN", etc.
|
||||
*
|
||||
* @param ip The IP address to lookup.
|
||||
* @param result The result buffer. If the lookup does not succeed, the buffer is not modified.
|
||||
* @return true on a successful lookup, false on a failed lookup.
|
||||
*/
|
||||
native bool:geoip_code3_ex(const ip[], result[4]);
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Lookup the two character country code for a given IP address.
|
||||
*
|
||||
* @note This native will overflow the buffer by one cell on an unknown ip lookup!
|
||||
* @note Use geoip_code2_ex instead!
|
||||
*
|
||||
* @param ip The IP address to lookup.
|
||||
* @param result The result buffer.
|
||||
*/
|
||||
native geoip_code2(const ip[], ccode[3]);
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Lookup the three character country code for a given IP address.
|
||||
*
|
||||
* @note This native will overflow the buffer by one cell on an unknown ip lookup!
|
||||
* @note Use geoip_code3_ex instead!
|
||||
*
|
||||
* @param ip The IP address to lookup.
|
||||
* @param result The result buffer.
|
||||
*/
|
||||
native geoip_code3(const ip[], result[4]);
|
||||
|
||||
/**
|
||||
* Lookup the full country name for the given IP address. Sets the buffer to "error" on
|
||||
* an unsuccessful lookup.
|
||||
*
|
||||
* @param ip The IP address to lookup.
|
||||
* @param result The result of the geoip lookup.
|
||||
* @param len The maximum length of the result buffer.
|
||||
*/
|
||||
native geoip_country(const ip[], result[], len=45);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,382 @@
|
||||
/**
|
||||
* Ham Sandwich module include file.
|
||||
* (c) 2007, The AMX Mod X Development Team
|
||||
*
|
||||
* -
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ham Sandwich is a module that is used to hook and call virtual functions of
|
||||
* entities.
|
||||
* Virtual functions are mod-specific functions. This means that in order
|
||||
* for this to work on a mod, it needs to be configured with the hamdata.ini
|
||||
* file.
|
||||
* Be very careful with parameter passing to these functions.
|
||||
*/
|
||||
|
||||
#if defined _hamsandwich_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _hamsandwich_included
|
||||
|
||||
#include <ham_const>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib hamsandwich
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib hamsandwich
|
||||
#endif
|
||||
#else
|
||||
#pragma library hamsandwich
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityClass The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity's class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
* Note: This will cause hooks for the entire internal class that the entity is
|
||||
* not exclusively for the provided entity.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityId The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
|
||||
|
||||
|
||||
/**
|
||||
* Stops a ham forward from triggering.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to stop.
|
||||
*/
|
||||
native DisableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Starts a ham forward back up.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to re-enable.
|
||||
*/
|
||||
native EnableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity.
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHam(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity, this will trigger all hooks on that function.
|
||||
* Be very careful about recursion!
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHamB(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Gets the return status of the current hook.
|
||||
* This is useful to determine what return natives to use.
|
||||
*
|
||||
* @return The current status of the hook (such as HAM_SUPERCEDE).
|
||||
*/
|
||||
native GetHamReturnStatus();
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return float.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. Will be -1 on null.
|
||||
*/
|
||||
native GetHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The string size of the buffer.
|
||||
*/
|
||||
native GetHamReturnString(output[], size);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return floats.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. -1 on null.
|
||||
*/
|
||||
native GetOrigHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The size of the buffer.
|
||||
*/
|
||||
native GetOrigHamReturnString(output[], size);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an integer or boolean.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnInteger(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a float.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnFloat(Float:value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a Vector.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnVector(const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an entity. Set to -1 for null.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnEntity(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a string.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnString(const value[]);
|
||||
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are integers.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamInteger(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are floats.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamFloat(which, Float:value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are Vectors.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamVector(which, const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are entities.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamEntity(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are strings.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamString(which, const output[]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are trace result handles.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamTraceResult(which, tr_handle);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the function for the specified Ham is valid.
|
||||
* Things that would make it invalid would be bounds (an older module version
|
||||
* may not have all of the functions), and the function not being found in
|
||||
* the mod's hamdata.ini file.
|
||||
*
|
||||
* @param function The function to look up.
|
||||
* @return true if the function is valid, false otherwise.
|
||||
*/
|
||||
native bool:IsHamValid(Ham:function);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* Note this dereferences memory! Improper use of this will crash the server.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
* @return The index of the corresponding pdata field. -1 for none set.
|
||||
*/
|
||||
native get_pdata_cbase(id, offset, linuxdiff=5, macdiff=5);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* This will set the corresponding cbase field in private data with the index.
|
||||
* Pass -1 to null the entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param value The index to store, -1 for invalid
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
*/
|
||||
native set_pdata_cbase(id, offset, value, linuxdiff=5, macdiff=5);
|
||||
|
||||
/**
|
||||
* This is similar to the get_pdata_cbase, however it does not dereference memory.
|
||||
* This is many times slower than get_pdata_cbase, and this should only be used
|
||||
* for testing and finding of offsets, not actual release quality plugins.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry. -2 on an invalid entry.
|
||||
*
|
||||
* @param id Entry to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
* @return The index of the corresponding pdata field, -1 for null, -2 for invalid.
|
||||
*/
|
||||
native get_pdata_cbase_safe(id, offset, linuxdiff=5, macdiff=5);
|
||||
|
||||
|
||||
|
||||
|
||||
// This is the callback from the module, this handles any fatal errors.
|
||||
// This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists.
|
||||
// Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing.
|
||||
// Any other return value will fail the plugin.
|
||||
// You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin.
|
||||
// Do not modify this!
|
||||
public __fatal_ham_error(Ham:id, HamError:err, const reason[])
|
||||
{
|
||||
|
||||
new func=get_func_id("HamFilter", -1);
|
||||
new bool:fail=true;
|
||||
|
||||
if (func != -1 && callfunc_begin_i(func, -1)==1)
|
||||
{
|
||||
callfunc_push_int(_:id);
|
||||
callfunc_push_int(_:err);
|
||||
callfunc_push_str(reason, false);
|
||||
if (callfunc_end()==PLUGIN_HANDLED)
|
||||
{
|
||||
fail=false;
|
||||
}
|
||||
}
|
||||
if (fail)
|
||||
{
|
||||
set_fail_state(reason);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,492 @@
|
||||
/* Half-Life Software Development Kit constants
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined _hlsdk_const_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _hlsdk_const_included
|
||||
|
||||
// pev(entity, pev_button) or pev(entity, pev_oldbuttons) values
|
||||
#define IN_ATTACK (1<<0)
|
||||
#define IN_JUMP (1<<1)
|
||||
#define IN_DUCK (1<<2)
|
||||
#define IN_FORWARD (1<<3)
|
||||
#define IN_BACK (1<<4)
|
||||
#define IN_USE (1<<5)
|
||||
#define IN_CANCEL (1<<6)
|
||||
#define IN_LEFT (1<<7)
|
||||
#define IN_RIGHT (1<<8)
|
||||
#define IN_MOVELEFT (1<<9)
|
||||
#define IN_MOVERIGHT (1<<10)
|
||||
#define IN_ATTACK2 (1<<11)
|
||||
#define IN_RUN (1<<12)
|
||||
#define IN_RELOAD (1<<13)
|
||||
#define IN_ALT1 (1<<14)
|
||||
#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down
|
||||
|
||||
// pev(entity, pev_flags) values
|
||||
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
|
||||
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
|
||||
#define FL_CONVEYOR (1<<2)
|
||||
#define FL_CLIENT (1<<3)
|
||||
#define FL_INWATER (1<<4)
|
||||
#define FL_MONSTER (1<<5)
|
||||
#define FL_GODMODE (1<<6)
|
||||
#define FL_NOTARGET (1<<7)
|
||||
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
|
||||
#define FL_ONGROUND (1<<9) // At rest / on the ground
|
||||
#define FL_PARTIALGROUND (1<<10) // Not all corners are valid
|
||||
#define FL_WATERJUMP (1<<11) // Player jumping out of water
|
||||
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
|
||||
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
|
||||
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
|
||||
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
|
||||
#define FL_GRAPHED (1<<16) // Worldgraph has this ent listed as something that blocks a connection
|
||||
#define FL_IMMUNE_WATER (1<<17)
|
||||
#define FL_IMMUNE_SLIME (1<<18)
|
||||
#define FL_IMMUNE_LAVA (1<<19)
|
||||
#define FL_PROXY (1<<20) // This is a spectator proxy
|
||||
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
|
||||
#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
|
||||
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
|
||||
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
|
||||
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
|
||||
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
|
||||
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
|
||||
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
|
||||
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
|
||||
|
||||
// engfunc(EngFunc_WalkMove, entity, Float:yaw, Float:dist, iMode) iMode values
|
||||
#define WALKMOVE_NORMAL 0 // Normal walkmove
|
||||
#define WALKMOVE_WORLDONLY 1 // Doesn't hit ANY entities, no matter what the solid type
|
||||
#define WALKMOVE_CHECKONLY 2 // Move, but don't touch triggers
|
||||
|
||||
// pev(entity, pev_movetype) values
|
||||
#define MOVETYPE_NONE 0 // Never moves
|
||||
#define MOVETYPE_WALK 3 // Player only - moving on the ground
|
||||
#define MOVETYPE_STEP 4 // Gravity, special edge handling -- monsters use this
|
||||
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
|
||||
#define MOVETYPE_TOSS 6 // Gravity/Collisions
|
||||
#define MOVETYPE_PUSH 7 // No clip to world, push and crush
|
||||
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
|
||||
#define MOVETYPE_FLYMISSILE 9 // Extra size to monsters
|
||||
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
|
||||
#define MOVETYPE_BOUNCEMISSILE 11 // Bounce w/o gravity
|
||||
#define MOVETYPE_FOLLOW 12 // Track movement of aiment
|
||||
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
|
||||
|
||||
// pev(entity, pev_solid) values
|
||||
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
|
||||
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
|
||||
#define SOLID_NOT 0 // No interaction with other objects
|
||||
#define SOLID_TRIGGER 1 // Touch on edge, but not blocking
|
||||
#define SOLID_BBOX 2 // Touch on edge, block
|
||||
#define SOLID_SLIDEBOX 3 // Touch on edge, but not an onground
|
||||
#define SOLID_BSP 4 // BSP clip, touch on edge, block
|
||||
|
||||
// pev(entity, pev_deadflag) values
|
||||
#define DEAD_NO 0 // Alive
|
||||
#define DEAD_DYING 1 // Playing death animation or still falling off of a ledge waiting to hit ground
|
||||
#define DEAD_DEAD 2 // Dead, lying still
|
||||
#define DEAD_RESPAWNABLE 3
|
||||
#define DEAD_DISCARDBODY 4
|
||||
|
||||
// new Float:takedamage, pev(entity, pev_takedamage, takedamage) values
|
||||
#define DAMAGE_NO 0.0
|
||||
#define DAMAGE_YES 1.0
|
||||
#define DAMAGE_AIM 2.0
|
||||
|
||||
// pev(entity, pev_effects) values
|
||||
#define EF_BRIGHTFIELD 1 // Swirling cloud of particles
|
||||
#define EF_MUZZLEFLASH 2 // Single frame ELIGHT on entity attachment 0
|
||||
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
|
||||
#define EF_DIMLIGHT 8 // Player flashlight
|
||||
#define EF_INVLIGHT 16 // Get lighting from ceiling
|
||||
#define EF_NOINTERP 32 // Don't interpolate the next frame
|
||||
#define EF_LIGHT 64 // Rocket flare glow sprite
|
||||
#define EF_NODRAW 128 // Don't draw entity
|
||||
|
||||
// engfunc(EngFunc_PointContents, Float:origin) return values
|
||||
#define CONTENTS_EMPTY -1
|
||||
#define CONTENTS_SOLID -2
|
||||
#define CONTENTS_WATER -3
|
||||
#define CONTENTS_SLIME -4
|
||||
#define CONTENTS_LAVA -5
|
||||
#define CONTENTS_SKY -6
|
||||
#define CONTENTS_ORIGIN -7 // Removed at csg time
|
||||
#define CONTENTS_CLIP -8 // Changed to contents_solid
|
||||
#define CONTENTS_CURRENT_0 -9
|
||||
#define CONTENTS_CURRENT_90 -10
|
||||
#define CONTENTS_CURRENT_180 -11
|
||||
#define CONTENTS_CURRENT_270 -12
|
||||
#define CONTENTS_CURRENT_UP -13
|
||||
#define CONTENTS_CURRENT_DOWN -14
|
||||
#define CONTENTS_TRANSLUCENT -15
|
||||
#define CONTENTS_LADDER -16
|
||||
#define CONTENT_FLYFIELD -17
|
||||
#define CONTENT_GRAVITY_FLYFIELD -18
|
||||
#define CONTENT_FOG -19
|
||||
|
||||
// Instant damage values for use with gmsgDamage 3rd value write_long(BIT)
|
||||
#define DMG_GENERIC 0 // Generic damage was done
|
||||
#define DMG_CRUSH (1<<0) // Crushed by falling or moving object
|
||||
#define DMG_BULLET (1<<1) // Shot
|
||||
#define DMG_SLASH (1<<2) // Cut, clawed, stabbed
|
||||
#define DMG_BURN (1<<3) // Heat burned
|
||||
#define DMG_FREEZE (1<<4) // Frozen
|
||||
#define DMG_FALL (1<<5) // Fell too far
|
||||
#define DMG_BLAST (1<<6) // Explosive blast damage
|
||||
#define DMG_CLUB (1<<7) // Crowbar, punch, headbutt
|
||||
#define DMG_SHOCK (1<<8) // Electric shock
|
||||
#define DMG_SONIC (1<<9) // Sound pulse shockwave
|
||||
#define DMG_ENERGYBEAM (1<<10) // Laser or other high energy beam
|
||||
#define DMG_NEVERGIB (1<<12) // With this bit OR'd in, no damage type will be able to gib victims upon death
|
||||
#define DMG_ALWAYSGIB (1<<13) // With this bit OR'd in, any damage type can be made to gib victims upon death.
|
||||
#define DMG_DROWN (1<<14) // Drowning
|
||||
#define DMG_PARALYZE (1<<15) // Slows affected creature down
|
||||
#define DMG_NERVEGAS (1<<16) // Nerve toxins, very bad
|
||||
#define DMG_POISON (1<<17) // Blood poisioning
|
||||
#define DMG_RADIATION (1<<18) // Radiation exposure
|
||||
#define DMG_DROWNRECOVER (1<<19) // Drowning recovery
|
||||
#define DMG_ACID (1<<20) // Toxic chemicals or acid burns
|
||||
#define DMG_SLOWBURN (1<<21) // In an oven
|
||||
#define DMG_SLOWFREEZE (1<<22) // In a subzero freezer
|
||||
#define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar)
|
||||
#define DMG_TIMEBASED (~(0x3fff)) // Mask for time-based damage
|
||||
|
||||
// The fNoMonsters parameter of EngFunc_TraceLine, EngFunc_TraceMonsterHull, EngFunc_TraceHull, and EngFunc_TraceSphere
|
||||
#define DONT_IGNORE_MONSTERS 0
|
||||
#define IGNORE_MONSTERS 1
|
||||
#define IGNORE_MISSILE 2
|
||||
#define IGNORE_GLASS 0x100
|
||||
|
||||
// The hullnumber paramater of EngFunc_TraceHull, EngFunc_TraceModel and DLLFunc_GetHullBounds
|
||||
#define HULL_POINT 0
|
||||
#define HULL_HUMAN 1
|
||||
#define HULL_LARGE 2
|
||||
#define HULL_HEAD 3
|
||||
|
||||
// global_get(glb_trace_flags)
|
||||
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
|
||||
|
||||
// Used with get/set_es(es_handle, ES_eFlags, ...) (entity_state data structure)
|
||||
#define EFLAG_SLERP 1 // Do studio interpolation of this entity
|
||||
|
||||
// pev(entity, pev_spawnflags) values
|
||||
// Many of these flags apply to specific entities
|
||||
// func_train
|
||||
#define SF_TRAIN_WAIT_RETRIGGER 1
|
||||
#define SF_TRAIN_START_ON 4 // Train is initially moving
|
||||
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
|
||||
|
||||
// func_wall_toggle
|
||||
#define SF_WALL_START_OFF 0x0001
|
||||
|
||||
// func_converyor
|
||||
#define SF_CONVEYOR_VISUAL 0x0001
|
||||
#define SF_CONVEYOR_NOTSOLID 0x0002
|
||||
|
||||
// func_button
|
||||
#define SF_BUTTON_DONTMOVE 1
|
||||
#define SF_BUTTON_TOGGLE 32 // Button stays pushed until reactivated
|
||||
#define SF_BUTTON_SPARK_IF_OFF 64 // Button sparks in OFF state
|
||||
#define SF_BUTTON_TOUCH_ONLY 256 // Button only fires as a result of USE key.
|
||||
|
||||
// func_rot_button
|
||||
#define SF_ROTBUTTON_NOTSOLID 1
|
||||
|
||||
// env_global
|
||||
#define SF_GLOBAL_SET 1 // Set global state to initial state on spawn
|
||||
|
||||
// multisource
|
||||
#define SF_MULTI_INIT 1
|
||||
|
||||
// momentary_rot_button
|
||||
#define SF_MOMENTARY_DOOR 0x0001
|
||||
|
||||
// button_target
|
||||
#define SF_BTARGET_USE 0x0001
|
||||
#define SF_BTARGET_ON 0x0002
|
||||
|
||||
// func_door, func_water, func_door_rotating, momementary_door
|
||||
#define SF_DOOR_ROTATE_Y 0
|
||||
#define SF_DOOR_START_OPEN 1
|
||||
#define SF_DOOR_ROTATE_BACKWARDS 2
|
||||
#define SF_DOOR_PASSABLE 8
|
||||
#define SF_DOOR_ONEWAY 16
|
||||
#define SF_DOOR_NO_AUTO_RETURN 32
|
||||
#define SF_DOOR_ROTATE_Z 64
|
||||
#define SF_DOOR_ROTATE_X 128
|
||||
#define SF_DOOR_USE_ONLY 256 // Door must be opened by player's use button
|
||||
#define SF_DOOR_NOMONSTERS 512 // Monster can't open
|
||||
#define SF_DOOR_SILENT 0x80000000
|
||||
|
||||
// gibshooter
|
||||
#define SF_GIBSHOOTER_REPEATABLE 1 // Allows a gibshooter to be refired
|
||||
|
||||
// env_funnel
|
||||
#define SF_FUNNEL_REVERSE 1 // Funnel effect repels particles instead of attracting them
|
||||
|
||||
// env_bubbles
|
||||
#define SF_BUBBLES_STARTOFF 0x0001
|
||||
|
||||
// env_blood
|
||||
#define SF_BLOOD_RANDOM 0x0001
|
||||
#define SF_BLOOD_STREAM 0x0002
|
||||
#define SF_BLOOD_PLAYER 0x0004
|
||||
#define SF_BLOOD_DECAL 0x0008
|
||||
|
||||
// env_shake
|
||||
#define SF_SHAKE_EVERYONE 0x0001 // Don't check radius
|
||||
#define SF_SHAKE_DISRUPT 0x0002 // Disrupt controls
|
||||
#define SF_SHAKE_INAIR 0x0004 // Shake players in air
|
||||
|
||||
// env_fade
|
||||
#define SF_FADE_IN 0x0001 // Fade in, not out
|
||||
#define SF_FADE_MODULATE 0x0002 // Modulate, don't blend
|
||||
#define SF_FADE_ONLYONE 0x0004
|
||||
|
||||
// env_beam, env_lightning
|
||||
#define SF_BEAM_STARTON 0x0001
|
||||
#define SF_BEAM_TOGGLE 0x0002
|
||||
#define SF_BEAM_RANDOM 0x0004
|
||||
#define SF_BEAM_RING 0x0008
|
||||
#define SF_BEAM_SPARKSTART 0x0010
|
||||
#define SF_BEAM_SPARKEND 0x0020
|
||||
#define SF_BEAM_DECALS 0x0040
|
||||
#define SF_BEAM_SHADEIN 0x0080
|
||||
#define SF_BEAM_SHADEOUT 0x0100
|
||||
#define SF_BEAM_TEMPORARY 0x8000
|
||||
|
||||
// env_sprite
|
||||
#define SF_SPRITE_STARTON 0x0001
|
||||
#define SF_SPRITE_ONCE 0x0002
|
||||
#define SF_SPRITE_TEMPORARY 0x8000
|
||||
|
||||
// env_message
|
||||
#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out
|
||||
#define SF_MESSAGE_ALL 0x0002 // Send to all clients
|
||||
|
||||
// env_explosion
|
||||
#define SF_ENVEXPLOSION_NODAMAGE (1<<0) // When set, ENV_EXPLOSION will not actually inflict damage
|
||||
#define SF_ENVEXPLOSION_REPEATABLE (1<<1) // Can this entity be refired?
|
||||
#define SF_ENVEXPLOSION_NOFIREBALL (1<<2) // Don't draw the fireball
|
||||
#define SF_ENVEXPLOSION_NOSMOKE (1<<3) // Don't draw the smoke
|
||||
#define SF_ENVEXPLOSION_NODECAL (1<<4) // Don't make a scorch mark
|
||||
#define SF_ENVEXPLOSION_NOSPARKS (1<<5) // Don't make a scorch mark
|
||||
|
||||
// func_tank
|
||||
#define SF_TANK_ACTIVE 0x0001
|
||||
#define SF_TANK_PLAYER 0x0002
|
||||
#define SF_TANK_HUMANS 0x0004
|
||||
#define SF_TANK_ALIENS 0x0008
|
||||
#define SF_TANK_LINEOFSIGHT 0x0010
|
||||
#define SF_TANK_CANCONTROL 0x0020
|
||||
#define SF_TANK_SOUNDON 0x8000
|
||||
|
||||
// grenade
|
||||
#define SF_DETONATE 0x0001
|
||||
|
||||
// item_suit
|
||||
#define SF_SUIT_SHORTLOGON 0x0001
|
||||
|
||||
// game_score
|
||||
#define SF_SCORE_NEGATIVE 0x0001
|
||||
#define SF_SCORE_TEAM 0x0002
|
||||
|
||||
// game_text
|
||||
#define SF_ENVTEXT_ALLPLAYERS 0x0001
|
||||
|
||||
// game_team_master
|
||||
#define SF_TEAMMASTER_FIREONCE 0x0001
|
||||
#define SF_TEAMMASTER_ANYTEAM 0x0002
|
||||
|
||||
// game_team_set
|
||||
#define SF_TEAMSET_FIREONCE 0x0001
|
||||
#define SF_TEAMSET_CLEARTEAM 0x0002
|
||||
|
||||
// game_player_hurt
|
||||
#define SF_PKILL_FIREONCE 0x0001
|
||||
|
||||
// game_counter
|
||||
#define SF_GAMECOUNT_FIREONCE 0x0001
|
||||
#define SF_GAMECOUNT_RESET 0x0002
|
||||
|
||||
// game_player_equip
|
||||
#define SF_PLAYEREQUIP_USEONLY 0x0001
|
||||
|
||||
// game_player_team
|
||||
#define SF_PTEAM_FIREONCE 0x0001
|
||||
#define SF_PTEAM_KILL 0x0002
|
||||
#define SF_PTEAM_GIB 0x0004
|
||||
|
||||
// func_trackchange
|
||||
#define SF_PLAT_TOGGLE 0x0001
|
||||
#define SF_TRACK_ACTIVATETRAIN 0x00000001
|
||||
#define SF_TRACK_RELINK 0x00000002
|
||||
#define SF_TRACK_ROTMOVE 0x00000004
|
||||
#define SF_TRACK_STARTBOTTOM 0x00000008
|
||||
#define SF_TRACK_DONT_MOVE 0x00000010
|
||||
|
||||
// func_tracktrain
|
||||
#define SF_TRACKTRAIN_NOPITCH 0x0001
|
||||
#define SF_TRACKTRAIN_NOCONTROL 0x0002
|
||||
#define SF_TRACKTRAIN_FORWARDONLY 0x0004
|
||||
#define SF_TRACKTRAIN_PASSABLE 0x0008
|
||||
#define SF_PATH_DISABLED 0x00000001
|
||||
#define SF_PATH_FIREONCE 0x00000002
|
||||
#define SF_PATH_ALTREVERSE 0x00000004
|
||||
#define SF_PATH_DISABLE_TRAIN 0x00000008
|
||||
#define SF_PATH_ALTERNATE 0x00008000
|
||||
#define SF_CORNER_WAITFORTRIG 0x001
|
||||
#define SF_CORNER_TELEPORT 0x002
|
||||
#define SF_CORNER_FIREONCE 0x004
|
||||
|
||||
// trigger_push
|
||||
#define SF_TRIGGER_PUSH_START_OFF 2 // Spawnflag that makes trigger_push spawn turned OFF
|
||||
|
||||
// trigger_hurt
|
||||
#define SF_TRIGGER_HURT_TARGETONCE 1 // Only fire hurt target once
|
||||
#define SF_TRIGGER_HURT_START_OFF 2 // Spawnflag that makes trigger_push spawn turned OFF
|
||||
#define SF_TRIGGER_HURT_NO_CLIENTS 8 // Spawnflag that makes trigger_push spawn turned OFF
|
||||
#define SF_TRIGGER_HURT_CLIENTONLYFIRE 16 // Trigger hurt will only fire its target if it is hurting a client
|
||||
#define SF_TRIGGER_HURT_CLIENTONLYTOUCH 32 // Only clients may touch this trigger
|
||||
|
||||
// trigger_auto
|
||||
#define SF_AUTO_FIREONCE 0x0001
|
||||
|
||||
// trigger_relay
|
||||
#define SF_RELAY_FIREONCE 0x0001
|
||||
|
||||
// multi_manager
|
||||
#define SF_MULTIMAN_CLONE 0x80000000
|
||||
#define SF_MULTIMAN_THREAD 0x00000001
|
||||
|
||||
// env_render - Flags to indicate masking off various render parameters that are normally copied to the targets
|
||||
#define SF_RENDER_MASKFX (1<<0)
|
||||
#define SF_RENDER_MASKAMT (1<<1)
|
||||
#define SF_RENDER_MASKMODE (1<<2)
|
||||
#define SF_RENDER_MASKCOLOR (1<<3)
|
||||
|
||||
// trigger_changelevel
|
||||
#define SF_CHANGELEVEL_USEONLY 0x0002
|
||||
|
||||
// trigger_endsection
|
||||
#define SF_ENDSECTION_USEONLY 0x0001
|
||||
|
||||
// trigger_camera
|
||||
#define SF_CAMERA_PLAYER_POSITION 1
|
||||
#define SF_CAMERA_PLAYER_TARGET 2
|
||||
#define SF_CAMERA_PLAYER_TAKECONTROL 4
|
||||
|
||||
// func_rotating
|
||||
#define SF_BRUSH_ROTATE_Y_AXIS 0
|
||||
#define SF_BRUSH_ROTATE_INSTANT 1
|
||||
#define SF_BRUSH_ROTATE_BACKWARDS 2
|
||||
#define SF_BRUSH_ROTATE_Z_AXIS 4
|
||||
#define SF_BRUSH_ROTATE_X_AXIS 8
|
||||
#define SF_PENDULUM_AUTO_RETURN 16
|
||||
#define SF_PENDULUM_PASSABLE 32
|
||||
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
|
||||
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
|
||||
#define SF_BRUSH_ROTATE_LARGERADIUS 512
|
||||
|
||||
// triggers
|
||||
#define SF_TRIGGER_ALLOWMONSTERS 1 // Monsters allowed to fire this trigger
|
||||
#define SF_TRIGGER_NOCLIENTS 2 // Players not allowed to fire this trigger
|
||||
#define SF_TRIGGER_PUSHABLES 4 // Only pushables can fire this trigger
|
||||
|
||||
#define SF_TRIG_PUSH_ONCE 1
|
||||
// func_breakable
|
||||
#define SF_BREAK_TRIGGER_ONLY 1 // May only be broken by trigger
|
||||
#define SF_BREAK_TOUCH 2 // Can be 'crashed through' by running player (plate glass)
|
||||
#define SF_BREAK_PRESSURE 4 // Can be broken by a player standing on it
|
||||
#define SF_BREAK_CROWBAR 256 // Instant break if hit with crowbar
|
||||
|
||||
// func_pushable (it's also func_breakable, so don't collide with those flags)
|
||||
#define SF_PUSH_BREAKABLE 128
|
||||
|
||||
// light_spawn
|
||||
#define SF_LIGHT_START_OFF 1
|
||||
#define SPAWNFLAG_NOMESSAGE 1
|
||||
#define SPAWNFLAG_NOTOUCH 1
|
||||
#define SPAWNFLAG_DROIDONLY 4
|
||||
#define SPAWNFLAG_USEONLY 1 // Can't be touched, must be used (buttons)
|
||||
|
||||
// Monster Spawnflags
|
||||
#define SF_MONSTER_WAIT_TILL_SEEN 1 // Spawnflag that makes monsters wait until player can see them before attacking
|
||||
#define SF_MONSTER_GAG 2 // No idle noises from this monster
|
||||
#define SF_MONSTER_HITMONSTERCLIP 4
|
||||
#define SF_MONSTER_PRISONER 16 // Monster won't attack anyone, no one will attacke him
|
||||
#define SF_MONSTER_WAIT_FOR_SCRIPT 128 // Spawnflag that makes monsters wait to check for attacking until the script is done or they've been attacked
|
||||
#define SF_MONSTER_PREDISASTER 256 // This is a predisaster scientist or barney; influences how they speak
|
||||
#define SF_MONSTER_FADECORPSE 512 // Fade out corpse after death
|
||||
#define SF_MONSTER_FALL_TO_GROUND 0x80000000
|
||||
#define SF_MONSTER_TURRET_AUTOACTIVATE 32
|
||||
#define SF_MONSTER_TURRET_STARTINACTIVE 64
|
||||
#define SF_MONSTER_WAIT_UNTIL_PROVOKED 64 // Don't attack the player unless provoked
|
||||
|
||||
// info_decal
|
||||
#define SF_DECAL_NOTINDEATHMATCH 2048
|
||||
|
||||
// worldspawn
|
||||
#define SF_WORLD_DARK 0x0001 // Fade from black at startup
|
||||
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
|
||||
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
|
||||
|
||||
// Set this bit on guns and stuff that should never respawn
|
||||
#define SF_NORESPAWN (1<<30)
|
||||
|
||||
// Valve Mod Weapon Constants
|
||||
#define HLI_HEALTHKIT 1
|
||||
#define HLI_ANTIDOTE 2
|
||||
#define HLI_SECURITY 3
|
||||
#define HLI_BATTERY 4
|
||||
|
||||
#define HLW_NONE 0
|
||||
#define HLW_CROWBAR 1
|
||||
#define HLW_GLOCK 2
|
||||
#define HLW_PYTHON 3
|
||||
#define HLW_MP5 4
|
||||
#define HLW_CHAINGUN 5
|
||||
#define HLW_CROSSBOW 6
|
||||
#define HLW_SHOTGUN 7
|
||||
#define HLW_RPG 8
|
||||
#define HLW_GAUSS 9
|
||||
#define HLW_EGON 10
|
||||
#define HLW_HORNETGUN 11
|
||||
#define HLW_HANDGRENADE 12
|
||||
#define HLW_TRIPMINE 13
|
||||
#define HLW_SATCHEL 14
|
||||
#define HLW_SNARK 15
|
||||
#define HLW_SUIT 31
|
||||
#define HLW_ALLWEAPONS (~(1<<HLW_SUIT))
|
||||
|
||||
|
||||
#define FEV_NOTHOST (1<<0) // Skip local host for event send.
|
||||
#define FEV_RELIABLE (1<<1) // Send the event reliably. You must specify the origin and angles
|
||||
// for this to work correctly on the server for anything
|
||||
// that depends on the event origin/angles. I.e., the origin/angles are not
|
||||
// taken from the invoking edict for reliable events.
|
||||
#define FEV_GLOBAL (1<<2) // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC
|
||||
// sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ).
|
||||
#define FEV_UPDATE (1<<3) // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate
|
||||
#define FEV_HOSTONLY (1<<4) // Only send to entity specified as the invoker
|
||||
#define FEV_SERVER (1<<5) // Only send if the event was created on the server.
|
||||
#define FEV_CLIENT (1<<6) // Only issue event client side ( from shared code )
|
||||
|
||||
// These are caps bits to indicate what an object's capabilities (currently used for save/restore and level transitions)
|
||||
#define FCAP_CUSTOMSAVE 0x00000001
|
||||
#define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions
|
||||
#define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore
|
||||
#define FCAP_DONT_SAVE 0x80000000 // Don't save this
|
||||
#define FCAP_IMPULSE_USE 0x00000008 // can be used by the player
|
||||
#define FCAP_CONTINUOUS_USE 0x00000010 // can be used by the player
|
||||
#define FCAP_ONOFF_USE 0x00000020 // can be used by the player
|
||||
#define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains)
|
||||
#define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource)
|
||||
@@ -0,0 +1,56 @@
|
||||
/* Language functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _lang_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _lang_included
|
||||
|
||||
//return the number of languages loaded
|
||||
native get_langsnum();
|
||||
|
||||
//sets name to the two-letter name of a language returned by get_langsnum
|
||||
//index starts at 0
|
||||
native get_lang(id, name[3]);
|
||||
|
||||
//registers a dictionary file, making sure the words are in the dictionary
|
||||
// the file should be in "addons/amxx/data/lang/", but only the name needs to be
|
||||
// given. (e.g. register_dictionary("file.txt") will be addons/amxx/data/file.txt).
|
||||
native register_dictionary(const filename[]);
|
||||
|
||||
//returns 1 if the language is loaded, 0 otherwise.
|
||||
native lang_exists(const name[]);
|
||||
|
||||
enum TransKey
|
||||
{
|
||||
TransKey_Bad = -1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds or finds a translation key.
|
||||
*/
|
||||
native TransKey:CreateLangKey(const key[]);
|
||||
|
||||
/**
|
||||
* Finds a translation key id without adding on failure.
|
||||
* Returns -1 on not found.
|
||||
*/
|
||||
native TransKey:GetLangTransKey(const key[]);
|
||||
|
||||
/**
|
||||
* Adds a translation.
|
||||
*/
|
||||
native AddTranslation(const lang[3], TransKey:key, const phrase[]);
|
||||
|
||||
/**
|
||||
* Looks up the translation of the key for the given type
|
||||
* This does NOT format the output text.
|
||||
* eg: If the key includes %s, the outputted text will also contain %s.
|
||||
* NOTE: LANG_PLAYER is invalid in this, use a player index
|
||||
* or LANG_SERVER
|
||||
*/
|
||||
native LookupLangKey(Output[], OutputSize, const Key[], const &id);
|
||||
@@ -0,0 +1,803 @@
|
||||
/* Message constants
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined _message_const_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _message_const_included
|
||||
|
||||
/* Destination types for message_begin() */
|
||||
#define MSG_BROADCAST 0 // Unreliable to all
|
||||
#define MSG_ONE 1 // Reliable to one (msg_entity)
|
||||
#define MSG_ALL 2 // Reliable to all
|
||||
#define MSG_INIT 3 // Write to the init string
|
||||
#define MSG_PVS 4 // Ents in PVS of org
|
||||
#define MSG_PAS 5 // Ents in PAS of org
|
||||
#define MSG_PVS_R 6 // Reliable to PVS
|
||||
#define MSG_PAS_R 7 // Reliable to PAS
|
||||
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram (could be dropped)
|
||||
#define MSG_SPEC 9 // Sends to all spectator proxies
|
||||
|
||||
/* Hardcoded message types for message_begin()
|
||||
* Look in the actual HLSDK for details!
|
||||
*/
|
||||
#define SVC_NOP 1
|
||||
#define SVC_DISCONNECT 2
|
||||
#define SVC_EVENT 3
|
||||
#define SVC_VERSION 4
|
||||
#define SVC_SETVIEW 5
|
||||
#define SVC_SOUND 6
|
||||
#define SVC_TIME 7
|
||||
#define SVC_PRINT 8
|
||||
#define SVC_STUFFTEXT 9
|
||||
#define SVC_SETANGLE 10
|
||||
#define SVC_SERVERINFO 11
|
||||
#define SVC_LIGHTSTYLE 12
|
||||
#define SVC_UPDATEUSERINFO 13
|
||||
#define SVC_DELTADESCRIPTION 14
|
||||
#define SVC_CLIENTDATA 15
|
||||
#define SVC_STOPSOUND 16
|
||||
#define SVC_PINGS 17
|
||||
#define SVC_PARTICLE 18
|
||||
#define SVC_DAMAGE 19
|
||||
#define SVC_SPAWNSTATIC 20
|
||||
#define SVC_EVENT_RELIABLE 21
|
||||
#define SVC_SPAWNBASELINE 22
|
||||
#define SVC_TEMPENTITY 23
|
||||
#define SVC_SETPAUSE 24
|
||||
#define SVC_SIGNONNUM 25
|
||||
#define SVC_CENTERPRINT 26
|
||||
#define SVC_KILLEDMONSTER 27
|
||||
#define SVC_FOUNDSECRET 28
|
||||
#define SVC_SPAWNSTATICSOUND 29
|
||||
#define SVC_INTERMISSION 30
|
||||
#define SVC_FINALE 31
|
||||
#define SVC_CDTRACK 32
|
||||
#define SVC_RESTORE 33
|
||||
#define SVC_CUTSCENE 34
|
||||
#define SVC_WEAPONANIM 35
|
||||
#define SVC_DECALNAME 36
|
||||
#define SVC_ROOMTYPE 37
|
||||
#define SVC_ADDANGLE 38
|
||||
#define SVC_NEWUSERMSG 39
|
||||
#define SVC_PACKETENTITIES 40
|
||||
#define SVC_DELTAPACKETENTITIES 41
|
||||
#define SVC_CHOKE 42
|
||||
#define SVC_RESOURCELIST 43
|
||||
#define SVC_NEWMOVEVARS 44
|
||||
#define SVC_RESOURCEREQUEST 45
|
||||
#define SVC_CUSTOMIZATION 46
|
||||
#define SVC_CROSSHAIRANGLE 47
|
||||
#define SVC_SOUNDFADE 48
|
||||
#define SVC_FILETXFERFAILED 49
|
||||
#define SVC_HLTV 50
|
||||
#define SVC_DIRECTOR 51
|
||||
#define SVC_VOICEINIT 52
|
||||
#define SVC_VOICEDATA 53
|
||||
#define SVC_SENDEXTRAINFO 54
|
||||
#define SVC_TIMESCALE 55
|
||||
|
||||
/* Message flags for set_msg_block() */
|
||||
#define BLOCK_NOT 0
|
||||
#define BLOCK_ONCE 1
|
||||
#define BLOCK_SET 2
|
||||
|
||||
/* Used with get_msg_argtype() and set_msg_arg_ */
|
||||
enum
|
||||
{
|
||||
ARG_BYTE = 1, /* int */
|
||||
ARG_CHAR, /* int */
|
||||
ARG_SHORT, /* int */
|
||||
ARG_LONG, /* int */
|
||||
ARG_ANGLE, /* float */
|
||||
ARG_COORD, /* float */
|
||||
ARG_STRING, /* string */
|
||||
ARG_ENTITY, /* int */
|
||||
};
|
||||
|
||||
/* Temp entity message types for message_begin() */
|
||||
#define TE_BEAMPOINTS 0 // Beam effect between two points
|
||||
// write_byte(TE_BEAMPOINTS)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(starting frame)
|
||||
// write_byte(frame rate in 0.1's)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(noise amplitude in 0.01's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(scroll speed in 0.1's)
|
||||
|
||||
#define TE_BEAMENTPOINT 1 // Beam effect between point and entity
|
||||
// write_byte(TE_BEAMENTPOINT)
|
||||
// write_short(start entity)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(starting frame)
|
||||
// write_byte(frame rate in 0.1's)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(noise amplitude in 0.01's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(scroll speed in 0.1's)
|
||||
|
||||
#define TE_GUNSHOT 2 // Particle effect plus ricochet sound
|
||||
// write_byte(TE_GUNSHOT)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
|
||||
#define TE_EXPLOSION 3 // Additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
|
||||
// write_byte(TE_EXPLOSION)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(scale in 0.1's)
|
||||
// write_byte(framerate)
|
||||
// write_byte(flags)
|
||||
//
|
||||
// The Explosion effect has some flags to control performance/aesthetic features:
|
||||
#define TE_EXPLFLAG_NONE 0 // All flags clear makes default Half-Life explosion
|
||||
#define TE_EXPLFLAG_NOADDITIVE 1 // Sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
|
||||
#define TE_EXPLFLAG_NODLIGHTS 2 // Do not render dynamic lights
|
||||
#define TE_EXPLFLAG_NOSOUND 4 // Do not play client explosion sound
|
||||
#define TE_EXPLFLAG_NOPARTICLES 8 // Do not draw particles
|
||||
|
||||
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
|
||||
// write_byte(TE_TAREXPLOSION)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
|
||||
#define TE_SMOKE 5 // Alphablend sprite, move vertically 30 pps
|
||||
// write_byte(TE_SMOKE)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(scale in 0.1's)
|
||||
// write_byte(framerate)
|
||||
|
||||
#define TE_TRACER 6 // Tracer effect from point to point
|
||||
// write_byte(TE_TRACER)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
|
||||
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
|
||||
// write_byte(TE_LIGHTNING)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(width in 0.1's)
|
||||
// write_byte(amplitude in 0.01's)
|
||||
// write_short(sprite model index)
|
||||
|
||||
#define TE_BEAMENTS 8
|
||||
// write_byte(TE_BEAMENTS)
|
||||
// write_short(start entity)
|
||||
// write_short(end entity)
|
||||
// write_short(sprite index)
|
||||
// write_byte(starting frame)
|
||||
// write_byte(frame rate in 0.1's)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(noise amplitude in 0.01's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(scroll speed in 0.1's)
|
||||
|
||||
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
|
||||
// write_byte(TE_SPARKS)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
|
||||
#define TE_LAVASPLASH 10 // Quake1 lava splash
|
||||
// write_byte(TE_LAVASPLASH)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
|
||||
#define TE_TELEPORT 11 // Quake1 teleport splash
|
||||
// write_byte(TE_TELEPORT)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
|
||||
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
|
||||
// write_byte(TE_EXPLOSION2)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(starting color)
|
||||
// write_byte(num colors)
|
||||
|
||||
#define TE_BSPDECAL 13 // Decal from the .BSP file
|
||||
// write_byte(TE_BSPDECAL)
|
||||
// write_coord(position.x) decal position (center of texture in world)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(texture index of precached decal texture name)
|
||||
// write_short(entity index)
|
||||
// [optional - write_short(index of model of above entity) only included if previous short is non-zero (not the world)]
|
||||
|
||||
#define TE_IMPLOSION 14 // Tracers moving toward a point
|
||||
// write_byte(TE_IMPLOSION)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(radius)
|
||||
// write_byte(count)
|
||||
// write_byte(life in 0.1's)
|
||||
|
||||
#define TE_SPRITETRAIL 15 // Line of moving glow sprites with gravity, fadeout, and collisions
|
||||
// write_byte(TE_SPRITETRAIL)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(count)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(scale in 0.1's)
|
||||
// write_byte(velocity along vector in 10's)
|
||||
// write_byte(randomness of velocity in 10's)
|
||||
|
||||
#define TE_SPRITE 17 // Additive sprite, plays 1 cycle
|
||||
// write_byte(TE_SPRITE)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(scale in 0.1's)
|
||||
// write_byte(brightness)
|
||||
|
||||
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end
|
||||
// write_byte(TE_BEAMSPRITE)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
// write_short(beam sprite index)
|
||||
// write_short(end sprite index)
|
||||
|
||||
#define TE_BEAMTORUS 19 // Screen aligned beam ring, expands to max radius over lifetime
|
||||
// write_byte(TE_BEAMTORUS)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(axis.x)
|
||||
// write_coord(axis.y)
|
||||
// write_coord(axis.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(starting frame)
|
||||
// write_byte(frame rate in 0.1's)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(noise amplitude in 0.01's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(scroll speed in 0.1's)
|
||||
|
||||
#define TE_BEAMDISK 20 // Disk that expands to max radius over lifetime
|
||||
// write_byte(TE_BEAMDISK)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(axis.x)
|
||||
// write_coord(axis.y)
|
||||
// write_coord(axis.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(starting frame)
|
||||
// write_byte(frame rate in 0.1's)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(noise amplitude in 0.01's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(scroll speed in 0.1's)
|
||||
|
||||
#define TE_BEAMCYLINDER 21 // Cylinder that expands to max radius over lifetime
|
||||
// write_byte(TE_BEAMCYLINDER)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(axis.x)
|
||||
// write_coord(axis.y)
|
||||
// write_coord(axis.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(starting frame)
|
||||
// write_byte(frame rate in 0.1's)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(noise amplitude in 0.01's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(scroll speed in 0.1's)
|
||||
|
||||
#define TE_BEAMFOLLOW 22 // Create a line of decaying beam segments until entity stops moving
|
||||
// write_byte(TE_BEAMFOLLOW)
|
||||
// write_short(entity:attachment to follow)
|
||||
// write_short(sprite index)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
|
||||
#define TE_GLOWSPRITE 23
|
||||
// write_byte(TE_GLOWSPRITE)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(model index)
|
||||
// write_byte(scale / 10)
|
||||
// write_byte(size)
|
||||
// write_byte(brightness)
|
||||
|
||||
#define TE_BEAMRING 24 // Connect a beam ring to two entities
|
||||
// write_byte(TE_BEAMRING)
|
||||
// write_short(start entity)
|
||||
// write_short(end entity)
|
||||
// write_short(sprite index)
|
||||
// write_byte(starting frame)
|
||||
// write_byte(frame rate in 0.1's)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_byte(line width in 0.1's)
|
||||
// write_byte(noise amplitude in 0.01's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(scroll speed in 0.1's)
|
||||
|
||||
#define TE_STREAK_SPLASH 25 // Oriented shower of tracers
|
||||
// write_byte(TE_STREAK_SPLASH)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(vector.x)
|
||||
// write_coord(vector.y)
|
||||
// write_coord(vector.z)
|
||||
// write_byte(color)
|
||||
// write_short(count)
|
||||
// write_short(base speed)
|
||||
// write_short(ramdon velocity)
|
||||
|
||||
#define TE_DLIGHT 27 // Dynamic light, effect world, minor entity effect
|
||||
// write_byte(TE_DLIGHT)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(radius in 10's)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(brightness)
|
||||
// write_byte(life in 10's)
|
||||
// write_byte(decay rate in 10's)
|
||||
|
||||
#define TE_ELIGHT 28 // Point entity light, no world effect
|
||||
// write_byte(TE_ELIGHT)
|
||||
// write_short(entity:attachment to follow)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(radius)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(life in 0.1's)
|
||||
// write_coord(decay rate)
|
||||
|
||||
#define TE_TEXTMESSAGE 29
|
||||
// write_byte(TE_TEXTMESSAGE)
|
||||
// write_byte(channel)
|
||||
// write_short(x) -1 = center)
|
||||
// write_short(y) -1 = center)
|
||||
// write_byte(effect) 0 = fade in/fade out, 1 is flickery credits, 2 is write out (training room)
|
||||
// write_byte(red) - text color
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(alpha)
|
||||
// write_byte(red) - effect color
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
// write_byte(alpha)
|
||||
// write_short(fadein time)
|
||||
// write_short(fadeout time)
|
||||
// write_short(hold time)
|
||||
// [optional] write_short(fxtime) time the highlight lags behing the leading text in effect 2
|
||||
// write_string(text message) 512 chars max string size
|
||||
|
||||
#define TE_LINE 30
|
||||
// write_byte(TE_LINE)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
// write_short(life in 0.1 s)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
|
||||
#define TE_BOX 31
|
||||
// write_byte(TE_BOX)
|
||||
// write_coord(boxmins.x)
|
||||
// write_coord(boxmins.y)
|
||||
// write_coord(boxmins.z)
|
||||
// write_coord(boxmaxs.x)
|
||||
// write_coord(boxmaxs.y)
|
||||
// write_coord(boxmaxs.z)
|
||||
// write_short(life in 0.1 s)
|
||||
// write_byte(red)
|
||||
// write_byte(green)
|
||||
// write_byte(blue)
|
||||
|
||||
#define TE_KILLBEAM 99 // Kill all beams attached to entity
|
||||
// write_byte(TE_KILLBEAM)
|
||||
// write_short(entity)
|
||||
|
||||
#define TE_LARGEFUNNEL 100
|
||||
// write_byte(TE_LARGEFUNNEL)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(sprite index)
|
||||
// write_short(flags)
|
||||
|
||||
#define TE_BLOODSTREAM 101 // Particle spray
|
||||
// write_byte(TE_BLOODSTREAM)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(vector.x)
|
||||
// write_coord(vector.y)
|
||||
// write_coord(vector.z)
|
||||
// write_byte(color)
|
||||
// write_byte(speed)
|
||||
|
||||
#define TE_SHOWLINE 102 // Line of particles every 5 units, dies in 30 seconds
|
||||
// write_byte(TE_SHOWLINE)
|
||||
// write_coord(startposition.x)
|
||||
// write_coord(startposition.y)
|
||||
// write_coord(startposition.z)
|
||||
// write_coord(endposition.x)
|
||||
// write_coord(endposition.y)
|
||||
// write_coord(endposition.z)
|
||||
|
||||
#define TE_BLOOD 103 // Particle spray
|
||||
// write_byte(TE_BLOOD)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(vector.x)
|
||||
// write_coord(vector.y)
|
||||
// write_coord(vector.z)
|
||||
// write_byte(color)
|
||||
// write_byte(speed)
|
||||
|
||||
#define TE_DECAL 104 // Decal applied to a brush entity (not the world)
|
||||
// write_byte(TE_DECAL)
|
||||
// write_coord(position.x) decal position (center of texture in world)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(texture index of precached decal texture name)
|
||||
// write_short(entity index)
|
||||
|
||||
#define TE_FIZZ 105 // Create alpha sprites inside of entity, float upwards
|
||||
// write_byte(TE_FIZZ)
|
||||
// write_short(entity)
|
||||
// write_short(sprite index)
|
||||
// write_byte density)
|
||||
|
||||
#define TE_MODEL 106 // Create a moving model that bounces and makes a sound when it hits
|
||||
// write_byte(TE_MODEL)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(velocity.x)
|
||||
// write_coord(velocity.y)
|
||||
// write_coord(velocity.z)
|
||||
// write_angle(initial yaw)
|
||||
// write_short(model index)
|
||||
// write_byte(bounce sound type)
|
||||
// write_byte(life in 0.1's)
|
||||
|
||||
#define TE_EXPLODEMODEL 107 // Spherical shower of models, picks from set
|
||||
// write_byte(TE_EXPLODEMODEL)
|
||||
// write_coord(origin.x)
|
||||
// write_coord(origin.y)
|
||||
// write_coord(origin.z)
|
||||
// write_coord(velocity.x)
|
||||
// write_coord(velocity.y)
|
||||
// write_coord(velocity.z)
|
||||
// write_short(model index)
|
||||
// write_short(count)
|
||||
// write_byte(life in 0.1's)
|
||||
|
||||
#define TE_BREAKMODEL 108 // Box of models or sprites
|
||||
// write_byte(TE_BREAKMODEL)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(size.x)
|
||||
// write_coord(size.y)
|
||||
// write_coord(size.z)
|
||||
// write_coord(velocity.x)
|
||||
// write_coord(velocity.y)
|
||||
// write_coord(velocity.z)
|
||||
// write_byte(random velocity in 10's)
|
||||
// write_short(sprite or model index)
|
||||
// write_byte(count)
|
||||
// write_byte(life in 0.1 secs)
|
||||
// write_byte(flags)
|
||||
|
||||
#define TE_GUNSHOTDECAL 109 // Decal and ricochet sound
|
||||
// write_byte(TE_GUNSHOTDECAL)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(entity index???)
|
||||
// write_byte(decal???)
|
||||
|
||||
#define TE_SPRITE_SPRAY 110 // Spray of alpha sprites
|
||||
// write_byte(TE_SPRITE_SPRAY)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(velocity.x)
|
||||
// write_coord(velocity.y)
|
||||
// write_coord(velocity.z)
|
||||
// write_short(sprite index)
|
||||
// write_byte(count)
|
||||
// write_byte(speed)
|
||||
// write_byte(noise)
|
||||
|
||||
#define TE_ARMOR_RICOCHET 111 // Quick spark sprite, client ricochet sound.
|
||||
// write_byte(TE_ARMOR_RICOCHET)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(scale in 0.1's)
|
||||
|
||||
#define TE_PLAYERDECAL 112
|
||||
// write_byte(TE_PLAYERDECAL)
|
||||
// write_byte(playerindex)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(entity???)
|
||||
// write_byte(decal number)
|
||||
// [optional] write_short(model index)
|
||||
|
||||
#define TE_BUBBLES 113 // Create alpha sprites inside of box, float upwards
|
||||
// write_byte(TE_BUBBLES)
|
||||
// write_coord(position.x) (min start position)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(position.x) (max start position)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(float height)
|
||||
// write_short(model index)
|
||||
// write_byte(count)
|
||||
// write_coord(speed)
|
||||
|
||||
#define TE_BUBBLETRAIL 114 // Create alpha sprites along a line, float upwards
|
||||
// write_byte(TE_BUBBLETRAIL)
|
||||
// write_coord(position.x) (min start position)
|
||||
// write_coord(position.y) (min start position)
|
||||
// write_coord(position.z) (min start position)
|
||||
// write_coord(position.x) (max start position)
|
||||
// write_coord(position.y) (max start position)
|
||||
// write_coord(position.z) (max start position)
|
||||
// write_coord(float height)
|
||||
// write_short(model index)
|
||||
// write_byte(count)
|
||||
// write_coord(speed)
|
||||
|
||||
#define TE_BLOODSPRITE 115 // Spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)
|
||||
// write_byte(TE_BLOODSPRITE)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_short(sprite1 index)
|
||||
// write_short(sprite2 index)
|
||||
// write_byte(color)
|
||||
// write_byte(scale)
|
||||
|
||||
#define TE_WORLDDECAL 116 // Decal applied to the world brush
|
||||
// write_byte(TE_WORLDDECAL)
|
||||
// write_coord(position.x) decal position (center of texture in world)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(texture index of precached decal texture name)
|
||||
|
||||
#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush
|
||||
// write_byte(TE_WORLDDECALHIGH)
|
||||
// write_coord(position.x) decal position (center of texture in world)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(texture index of precached decal texture name - 256)
|
||||
|
||||
#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256
|
||||
// write_byte(TE_DECALHIGH)
|
||||
// write_coord(position.x) decal position (center of texture in world)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_byte(texture index of precached decal texture name - 256)
|
||||
// write_short(entity index)
|
||||
|
||||
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
|
||||
// write_byte(TE_PROJECTILE)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(velocity.x)
|
||||
// write_coord(velocity.y)
|
||||
// write_coord(velocity.z)
|
||||
// write_short(modelindex)
|
||||
// write_byte(life)
|
||||
// write_byte(owner) projectile won't collide with owner (if owner == 0, projectile will hit any client).
|
||||
|
||||
#define TE_SPRAY 120 // Throws a shower of sprites or models
|
||||
// write_byte(TE_SPRAY)
|
||||
// write_coord(position.x)
|
||||
// write_coord(position.y)
|
||||
// write_coord(position.z)
|
||||
// write_coord(direction.x)
|
||||
// write_coord(direction.y)
|
||||
// write_coord(direction.z)
|
||||
// write_short(modelindex)
|
||||
// write_byte(count)
|
||||
// write_byte(speed)
|
||||
// write_byte(noise)
|
||||
// write_byte(rendermode)
|
||||
|
||||
#define TE_PLAYERSPRITES 121 // Sprites emit from a player's bounding box (ONLY use for players!)
|
||||
// write_byte(TE_PLAYERSPRITES)
|
||||
// write_short(playernum)
|
||||
// write_short(sprite modelindex)
|
||||
// write_byte(count)
|
||||
// write_byte(variance) (0 = no variance in size) (10 = 10% variance in size)
|
||||
|
||||
#define TE_PARTICLEBURST 122 // Very similar to lavasplash
|
||||
// write_byte(TE_PARTICLEBURST)
|
||||
// write_coord(origin)
|
||||
// write_short(radius)
|
||||
// write_byte(particle color)
|
||||
// write_byte(duration * 10) (will be randomized a bit)
|
||||
|
||||
#define TE_FIREFIELD 123 // Makes a field of fire
|
||||
// write_byte(TE_FIREFIELD)
|
||||
// write_coord(origin)
|
||||
// write_short(radius) (fire is made in a square around origin. -radius, -radius to radius, radius)
|
||||
// write_short(modelindex)
|
||||
// write_byte(count)
|
||||
// write_byte(flags)
|
||||
// write_byte(duration (in seconds) * 10) (will be randomized a bit)
|
||||
//
|
||||
// to keep network traffic low, this message has associated flags that fit into a byte:
|
||||
#define TEFIRE_FLAG_ALLFLOAT 1 // All sprites will drift upwards as they animate
|
||||
#define TEFIRE_FLAG_SOMEFLOAT 2 // Some of the sprites will drift upwards. (50% chance)
|
||||
#define TEFIRE_FLAG_LOOP 4 // If set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
|
||||
#define TEFIRE_FLAG_ALPHA 8 // If set, sprite is rendered alpha blended at 50% else, opaque
|
||||
#define TEFIRE_FLAG_PLANAR 16 // If set, all fire sprites have same initial Z instead of randomly filling a cube.
|
||||
|
||||
#define TE_PLAYERATTACHMENT 124 // Attaches a TENT to a player (this is a high-priority tent)
|
||||
// write_byte(TE_PLAYERATTACHMENT)
|
||||
// write_byte(entity index of player)
|
||||
// write_coord(vertical offset) (attachment origin.z = player origin.z + vertical offset)
|
||||
// write_short(model index)
|
||||
// write_short(life * 10 )
|
||||
|
||||
#define TE_KILLPLAYERATTACHMENTS 125 // Will expire all TENTS attached to a player.
|
||||
// write_byte(TE_KILLPLAYERATTACHMENTS)
|
||||
// write_byte(entity index of player)
|
||||
|
||||
#define TE_MULTIGUNSHOT 126 // Much more compact shotgun message
|
||||
// This message is used to make a client approximate a 'spray' of gunfire.
|
||||
// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is
|
||||
// a good candidate for MULTIGUNSHOT use. (shotguns)
|
||||
//
|
||||
// NOTE: This effect makes the client do traces for each bullet, these client traces ignore
|
||||
// entities that have studio models.Traces are 4096 long.
|
||||
//
|
||||
// write_byte(TE_MULTIGUNSHOT)
|
||||
// write_coord(origin.x)
|
||||
// write_coord(origin.y)
|
||||
// write_coord(origin.z)
|
||||
// write_coord(direction.x)
|
||||
// write_coord(direction.y)
|
||||
// write_coord(direction.z)
|
||||
// write_coord(x noise * 100)
|
||||
// write_coord(y noise * 100)
|
||||
// write_byte(count)
|
||||
// write_byte(bullethole decal texture index)
|
||||
|
||||
#define TE_USERTRACER 127 // Larger message than the standard tracer, but allows some customization.
|
||||
// write_byte(TE_USERTRACER)
|
||||
// write_coord(origin.x)
|
||||
// write_coord(origin.y)
|
||||
// write_coord(origin.z)
|
||||
// write_coord(velocity.x)
|
||||
// write_coord(velocity.y)
|
||||
// write_coord(velocity.z)
|
||||
// write_byte(life * 10)
|
||||
// write_byte(color) this is an index into an array of color vectors in the engine. (0 - )
|
||||
// write_byte(length * 10)
|
||||
|
||||
// From hltv.h from the HLSDK, these are used in conjunction with SVC_DIRECTOR
|
||||
// sub commands of svc_director:
|
||||
#define DRC_CMD_NONE 0 // NULL director command
|
||||
#define DRC_CMD_START 1 // start director mode
|
||||
#define DRC_CMD_EVENT 2 // informs about director command
|
||||
#define DRC_CMD_MODE 3 // switches camera modes
|
||||
#define DRC_CMD_CAMERA 4 // sets camera registers
|
||||
#define DRC_CMD_TIMESCALE 5 // sets time scale
|
||||
#define DRC_CMD_MESSAGE 6 // send HUD centerprint
|
||||
#define DRC_CMD_SOUND 7 // plays a particular sound
|
||||
#define DRC_CMD_STATUS 8 // status info about broadcast
|
||||
#define DRC_CMD_BANNER 9 // banner file name for HLTV gui
|
||||
#define DRC_CMD_FADE 10 // send screen fade command
|
||||
#define DRC_CMD_SHAKE 11 // send screen shake command
|
||||
#define DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command
|
||||
|
||||
#define DRC_CMD_LAST 12
|
||||
|
||||
// HLTV_EVENT event flags
|
||||
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
|
||||
#define DRC_FLAG_SIDE (1<<4) //
|
||||
#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
|
||||
#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
|
||||
#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)
|
||||
#define DRC_FLAG_INTRO (1<<8) // is a introduction scene
|
||||
#define DRC_FLAG_FINAL (1<<9) // is a final scene
|
||||
#define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
|
||||
|
||||
|
||||
#define MAX_DIRECTOR_CMD_PARAMETERS 4
|
||||
#define MAX_DIRECTOR_CMD_STRING 128
|
||||
@@ -0,0 +1,58 @@
|
||||
/* Message Stocks
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined _message_stocks_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _message_stocks_included
|
||||
|
||||
/* Creates a death message. */
|
||||
stock dod_make_deathmsg(killer, victim, weaponNUM)
|
||||
{
|
||||
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
||||
write_byte(killer);
|
||||
write_byte(victim);
|
||||
write_byte(weaponNUM);
|
||||
message_end();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Kills a user without a message. */
|
||||
stock user_silentkill(index)
|
||||
{
|
||||
static msgid = 0;
|
||||
new msgblock;
|
||||
if (!msgid)
|
||||
{
|
||||
msgid = get_user_msgid("DeathMsg");
|
||||
}
|
||||
msgblock = get_msg_block(msgid);
|
||||
set_msg_block(msgid, BLOCK_ONCE);
|
||||
user_kill(index, 1);
|
||||
set_msg_block(msgid, msgblock);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Creates a death message. */
|
||||
stock make_deathmsg(killer, victim, headshot, const weapon[])
|
||||
{
|
||||
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
||||
write_byte(killer);
|
||||
write_byte(victim);
|
||||
|
||||
new mod_name[32];
|
||||
get_modname(mod_name, 31);
|
||||
if (equal(mod_name, "cstrike") || equal(mod_name, "czero") || equal(mod_name, "csv15") || equal(mod_name, "cs13"))
|
||||
write_byte(headshot);
|
||||
write_string(weapon);
|
||||
message_end();
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/* Messaging functions (now part of Core)
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _coremsg_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _coremsg_included
|
||||
|
||||
#include <message_const>
|
||||
|
||||
/* These functinos are used to generate client messages.
|
||||
* You may generate menu, smoke, shockwaves, thunderlights,
|
||||
* intermission and many many others messages.
|
||||
* See HL SDK for more examples. */
|
||||
native message_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0);
|
||||
native message_end();
|
||||
native write_byte(x);
|
||||
native write_char(x);
|
||||
native write_short(x);
|
||||
native write_long(x);
|
||||
native write_entity(x);
|
||||
native write_angle(x);
|
||||
native write_coord(x);
|
||||
native write_string(const x[]);
|
||||
|
||||
/* These are the same as above, except that the messages sent
|
||||
* are also sent to all other plugins and Metamod plugins.
|
||||
* This means that if you send one of these messages, other plugins will
|
||||
* be notified, which was previously impossible.
|
||||
* BE CAREFUL! Using these incorrectly, or not for their intended purpose,
|
||||
* could cause infinite recursion or something just as bad.
|
||||
* NOTE! These natives are experimental.
|
||||
*/
|
||||
native emessage_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0);
|
||||
native emessage_end();
|
||||
native ewrite_byte(x);
|
||||
native ewrite_char(x);
|
||||
native ewrite_short(x);
|
||||
native ewrite_long(x);
|
||||
native ewrite_entity(x);
|
||||
native ewrite_angle(x);
|
||||
native ewrite_coord(x);
|
||||
native ewrite_string(const x[]);
|
||||
|
||||
/* Sets/Gets what engine messages are blocked. */
|
||||
native set_msg_block(iMessage, iMessageFlags);
|
||||
native get_msg_block(iMessage);
|
||||
|
||||
/* Lets you directly hook a message in the engine!
|
||||
* You can overwrite the message before anything happens and either let the message continue
|
||||
* or fully block it. Here is how it works:
|
||||
* If you hook a message, the message is stored but not sent. You have the opportunity to
|
||||
* not only execute code, but to get/set the contents of the message, before you choose to
|
||||
* either block it or let it go on its way. The hooked function will be passed a msg_id, msg_dest, and entity index.
|
||||
* The return value can be passed to unregister_message() to stop the message from being hooked */
|
||||
native register_message(iMsgId, const szFunction[]);
|
||||
|
||||
/* Unregisters a message hook previously created with register_message
|
||||
* You must pass the proper message id, and return value from the message to unregister the message successfully. */
|
||||
native unregister_message(iMsgId, registeredmsg);
|
||||
|
||||
|
||||
/* The get/set _msg commands will fail if used outside a hooked message scope.
|
||||
* They should never be used unless inside a registered message function.
|
||||
* There are eight different ways of sending a message, five are ints, two are floats, and one is string.
|
||||
* These are denoted by iArgType. argn is the number
|
||||
* of the argument. Exceeding the bounds of 1 to get_msg_args() is a bad idea.
|
||||
* As of AMX Mod X 1.5, the middle parameter of set_* no longer does anything.
|
||||
* You cannot change the message argument type (as this would crash the mod anyway)
|
||||
*/
|
||||
|
||||
/* Gets number of arguments that were passed to this message */
|
||||
native get_msg_args();
|
||||
|
||||
/* Gets the argument type of argument argn */
|
||||
native get_msg_argtype(argn);
|
||||
|
||||
/* Gets the value of argn. */
|
||||
native get_msg_arg_int(argn);
|
||||
native Float:get_msg_arg_float(argn);
|
||||
native get_msg_arg_string(argn, szReturn[], iLength);
|
||||
|
||||
/* sets the value of argn. */
|
||||
native set_msg_arg_int(argn, argtype, iValue);
|
||||
native set_msg_arg_float(argn, argtype, Float:fValue);
|
||||
native set_msg_arg_string(argn, const szString[]);
|
||||
|
||||
/* Gets the origin of a message */
|
||||
native get_msg_origin(const Float:_Origin[3]);
|
||||
@@ -0,0 +1,262 @@
|
||||
/* AMX Mod X constants
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _newmenus_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _newmenus_included
|
||||
|
||||
#define MEXIT_ALL 1 /* Menu will have an exit option (default)*/
|
||||
#define MEXIT_NEVER -1 /* Menu will not have an exit option */
|
||||
|
||||
#define MPROP_PERPAGE 1 /* Number of items per page (param1 = number, 0=no paginating, 7=default) */
|
||||
#define MPROP_BACKNAME 2 /* Name of the back button (param1 = string) */
|
||||
#define MPROP_NEXTNAME 3 /* Name of the next button (param1 = string) */
|
||||
#define MPROP_EXITNAME 4 /* Name of the exit button (param1 = string) */
|
||||
#define MPROP_TITLE 5 /* Menu title text (param1 = string) */
|
||||
#define MPROP_EXIT 6 /* Exit functionality (param1 = number, see MEXIT constants) */
|
||||
#define MPROP_NOCOLORS 8 /* Sets whether colors are not auto (param1 = number, 0=default) */
|
||||
#define MPROP_NUMBER_COLOR 10 /* Color indicator to use for numbers (param1 = string, "\r"=default) */
|
||||
|
||||
#define MEXIT_NORMAL 0 /* DEPRECATED, do not use (has no effect) */
|
||||
#define MENUPAD_NONE 0 /* DEPRECATED, do not use (has no effect) */
|
||||
#define MENUPAD_PAGE 1 /* DEPRECATED, do not use (has no effect) */
|
||||
#define MPROP_ORDER 7 /* DEPRECATED, do not use (has no effect) */
|
||||
#define MPROP_PADMENU 9 /* DEPRECATED, do not use (has no effect) */
|
||||
|
||||
/**
|
||||
* @brief Creates a new menu object.
|
||||
*
|
||||
* The handler function should be prototyped as:
|
||||
*
|
||||
* public <function>(id, menu, item)
|
||||
* id - Client the menu is being acted upon.
|
||||
* menu - Menu resource identifier.
|
||||
* item - Item the client selected. If less than 0, the menu was
|
||||
* cancelled and the item is a status code. menu_display
|
||||
* should never be called immediately if the item is a status
|
||||
* code, for re-entrancy reasons.
|
||||
*
|
||||
* The handler function should always return PLUGIN_HANDLED to block
|
||||
* any old menu handlers from potentially feeding on the menu, unless
|
||||
* that is the desired functionality.
|
||||
*
|
||||
* @param title Title the menu should use.
|
||||
* @param handler Name of the handler function. The function will be invoked
|
||||
* once and only once to every menu_display() call.
|
||||
* @param ml Unused (should be 0).
|
||||
* @return Menu resource identifier which must be destroyed via
|
||||
* menu_destroy(). All menus are destroyed when the plugin
|
||||
* unloads.
|
||||
* @error Function name not found.
|
||||
*/
|
||||
native menu_create(const title[], const handler[], ml=0);
|
||||
|
||||
/**
|
||||
* Creates a menu item callback handler.
|
||||
*
|
||||
* The handler function should be prototyped as:
|
||||
*
|
||||
* public <function>(id, menu, item)
|
||||
* id - Client index being displayed to.
|
||||
* menu - Menu resource identifier.
|
||||
* item - Item being drawn.
|
||||
* <return> - ITEM_IGNORE to use the default functionality. ITEM_ENABLED to
|
||||
* explicitly enable or ITEM_DISABLED to explicitly disable.
|
||||
*
|
||||
* @param function Function name.
|
||||
* @return Menu callback ID.
|
||||
*/
|
||||
native menu_makecallback(const function[]);
|
||||
|
||||
/**
|
||||
* Adds an menu to a menu.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param name Item text to display.
|
||||
* @param info Item info string for internal information.
|
||||
* @param paccess Access required by the player viewing the menu.
|
||||
* @param callback If set to a valid ID from menu_makecallback(), the
|
||||
* callback will be invoked before drawing the item.
|
||||
* @noreturn
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_additem(menu, const name[], const info[]="", paccess=0, callback=-1);
|
||||
|
||||
/**
|
||||
* Returns the number of pages in a menu.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @return Number of pages in the menu.
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_pages(menu);
|
||||
|
||||
/**
|
||||
* Returns the number of items in a menu.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @return Number of items in the menu.
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_items(menu);
|
||||
|
||||
/**
|
||||
* Displays a menu to one client. This should never be called from a handler
|
||||
* when the item is less than 0 (i.e. calling this from a cancelled menu will
|
||||
* result in an error).
|
||||
*
|
||||
* @param id Client index.
|
||||
* @param menu Menu resource identifier.
|
||||
* @param page Page to start from (starting from 0).
|
||||
* @noreturn
|
||||
* @error Invalid menu resource or client index.
|
||||
*/
|
||||
native menu_display(id, menu, page=0);
|
||||
|
||||
/**
|
||||
* Given a page on a menu and a keypress on that page, returns the item id selected.
|
||||
* If the item is less than 0, a special option was chosen (such as MENU_EXIT).
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param page Page on the menu.
|
||||
* @param key Key pressed (from 1 to 10).
|
||||
* @return Item identifier, or <0 for a special selection code.
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_find_id(menu, page, key);
|
||||
|
||||
/**
|
||||
* Retrieves info about a menu item.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param item Item identifier.
|
||||
* @param access Variable to store access value.
|
||||
* @param info Buffer to store item info.
|
||||
* @param infolen Item info buffer length.
|
||||
* @param name Buffer to store item display text.
|
||||
* @param namelen Item name buffer length.
|
||||
* @param callback Callback ID.
|
||||
* @return 1 on success, 0 on failure.
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_item_getinfo(menu, item, &access, info[], infolen, name[]="", namelen=0, &callback);
|
||||
|
||||
/**
|
||||
* Sets an item's display text.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param item Item identifier.
|
||||
* @param name New item display text.
|
||||
* @return 1 on success, 0 on failure.
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_item_setname(menu, item, const name[]);
|
||||
|
||||
/**
|
||||
* Sets an item's info string.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param item Item identifier.
|
||||
* @param info New item info string.
|
||||
* @return 1 on success, 0 on failure.
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_item_setcmd(menu, item, const info[]);
|
||||
|
||||
/**
|
||||
* Sets an item's callback.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param item Item identifier.
|
||||
* @param callback New callback from menu_makecallback(), or -1 to clear.
|
||||
* @return 1 on success, 0 on failure.
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_item_setcall(menu, item, callback=-1);
|
||||
|
||||
/**
|
||||
* Destroys a menu. Player menus will be cancelled (although may still linger
|
||||
* on the HUD), and future attempts to access the menu resource will result in
|
||||
* an error.
|
||||
*
|
||||
* This must be called if you create menus dynamically, otherwise you will
|
||||
* leak memory. For normal dynamic menus, you will destroy the menu in the
|
||||
* handler function (remembering to handle the case of a menu being cancelled,
|
||||
* it must still be destroyed).
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @noreturn
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_destroy(menu);
|
||||
|
||||
/**
|
||||
* Returns information about a menu (if any) the client is currently viewing.
|
||||
*
|
||||
* If newmenu is valid, then the menu will refer to the menuid associated with
|
||||
* the title. If newmenu is not valid, and the menu is valid, then the player
|
||||
* is viewing a menu displayed with show_menu().
|
||||
*
|
||||
* Both may be invalid if the player is not viewing a menu.
|
||||
*
|
||||
* @param id Client index.
|
||||
* @param menu Variable to store old menu id. If none, then <1 will be
|
||||
* stored.
|
||||
* @param newmenu Variable to store new menu id. If none, then -1 will be
|
||||
* stored.
|
||||
* @param menupage Variable to store current page of the new menu, if any.
|
||||
* @return 1 if the player is viewing a menu, 0 otherwise.
|
||||
* @error Invalid client.
|
||||
*/
|
||||
native player_menu_info(id, &menu, &newmenu, &menupage=0);
|
||||
|
||||
/**
|
||||
* Adds a blank line to a menu.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param slot 1 (default) if the line should shift the numbering down.
|
||||
* 0 if the line should be a visual shift only.
|
||||
* @noreturn
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_addblank(menu, slot=1);
|
||||
|
||||
/**
|
||||
* Adds a text line to a menu. Only available in amxmodx 1.8.1 and above.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param text Text to add.
|
||||
* @param slot 1 (default) if the line should shift the numbering down.
|
||||
* 0 if the line should be a visual shift only.
|
||||
* @noreturn
|
||||
* @error Invalid menu resource.
|
||||
*/
|
||||
native menu_addtext(menu, const text[], slot=1);
|
||||
|
||||
/**
|
||||
* Sets a menu property.
|
||||
*
|
||||
* @param menu Menu resource identifier.
|
||||
* @param prop MPROP_ constant.
|
||||
* @param ... Property parameters.
|
||||
* @return 1 on success, 0 on failure.
|
||||
* @error Invalid menu resource or property.
|
||||
*/
|
||||
native menu_setprop(menu, prop, ...);
|
||||
|
||||
/**
|
||||
* Cancels a player's menu, effectively forcing the player to select MENU_EXIT.
|
||||
* The menu will still exist on their screen but any results are invalidated,
|
||||
* and the callback is invoked.
|
||||
*
|
||||
* @param player Client index.
|
||||
* @noreturn
|
||||
* @error Invalid client index.
|
||||
*/
|
||||
native menu_cancel(player);
|
||||
@@ -0,0 +1,753 @@
|
||||
/* NS module functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined NS_INC
|
||||
#endinput
|
||||
#endif
|
||||
#define NS_INC
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib ns
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib ns
|
||||
#endif
|
||||
#else
|
||||
#pragma library ns
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <ns_const>
|
||||
|
||||
|
||||
/**
|
||||
* Called whenever the client's class is changed.
|
||||
*
|
||||
* @param id The index of the player who changed.
|
||||
* @param newclass The class the client changed to. Check the class enum in ns_const.inc.
|
||||
* @param oldclass The class the client changed from. Check the class enum in ns_const.inc.
|
||||
* @noreturn
|
||||
*/
|
||||
forward client_changeclass(id, newclass, oldclass);
|
||||
|
||||
/**
|
||||
* Called whenever the client builds a structure.
|
||||
*
|
||||
* @param idPlayer The player index who triggered the building.
|
||||
* @param idStructure The structure index that was created.
|
||||
* @param type The type of structure that was built (1 for marine, 2 for alien).
|
||||
* @param impulse The impulse command that was issued to build this structure.
|
||||
* @noreturn
|
||||
*/
|
||||
forward client_built(idPlayer, idStructure, type, impulse);
|
||||
|
||||
/**
|
||||
* Tell whether or not the map is combat.
|
||||
*
|
||||
* @return 1 if combat, 0 otherwise.
|
||||
*/
|
||||
native ns_is_combat();
|
||||
|
||||
/**
|
||||
* Returns the gameplay type for the currently active map.
|
||||
* Refer to ns_const.inc's NSGameplay enum for details.
|
||||
*
|
||||
* @note The earliest this is guaranteed to be accurate is during plugin_init(). It needs
|
||||
* the info_gameplay entity to be properly set within the map, or it will return "Unknown",
|
||||
* or "Cantfind".
|
||||
*
|
||||
* @return Return the gameplay mode, as accurate as the module can tell.
|
||||
*/
|
||||
native NSGameplay:ns_get_gameplay();
|
||||
|
||||
/**
|
||||
* Exact syntax as get_user_team, but should be more accurate.
|
||||
*
|
||||
* @param id Player id.
|
||||
* @param buff Buffer to store team name in.
|
||||
* @param len Buffer length.
|
||||
* @return The pev_team setting for the player.
|
||||
*/
|
||||
native ns_get_user_team(id, buff[], len);
|
||||
|
||||
/**
|
||||
* Send an NS-style popup message.
|
||||
*
|
||||
* @param target The client to receive the message. Set to 0 to send to everybody.
|
||||
* @param szMsg The message to send, 180 characters max.
|
||||
* @param ah Whether to only display the message on clients who have the cvar "cl_autohelp" set to 1.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_popup(target, const szMsg[180], ah=0);
|
||||
|
||||
/**
|
||||
* Sets a player model. Omit the second parameter to return to default
|
||||
*
|
||||
* @note The model does not revert on death, teamswitch, gestation, etc.
|
||||
*
|
||||
* @param id The player id to change.
|
||||
* @param szModel The model to change to.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_player_model(id, const szModel[]="");
|
||||
|
||||
/**
|
||||
* Sets a player skin. Omit the second parameter to return to default
|
||||
*
|
||||
* @note The skin does not revert on death, teamswitch, gestation, etc.
|
||||
*
|
||||
* @param id The player id to change.
|
||||
* @param skin The skin number to change to.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_player_skin(id, skin=-1);
|
||||
|
||||
/**
|
||||
* Sets a player body. Omit the second parameter to return to default
|
||||
*
|
||||
* @note The body does not revert on death, teamswitch, gestation, etc.
|
||||
*
|
||||
* @param id The player id to change.
|
||||
* @param body The body number to change to.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_player_body(id, body=-1);
|
||||
|
||||
/**
|
||||
* Set this to modify the player's speed by a certain amount.
|
||||
*
|
||||
* @note The speed does not revert on death, teamswitch, gestation, etc.
|
||||
*
|
||||
* @param id The player id to change.
|
||||
* @param speedchange The speed to modify the player speed by. Set to 0 to revert to default speed.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_speedchange(id, speedchange=0);
|
||||
|
||||
/**
|
||||
* Returns a client's current speed modifier.
|
||||
*
|
||||
* @param id The client id to check.
|
||||
* @return The module's current speed modifier for the client.
|
||||
*/
|
||||
native ns_get_speedchange(id);
|
||||
|
||||
/**
|
||||
* Returns a client's maxspeed before the speed change modifier is factored in.
|
||||
*
|
||||
* @param id The client id to check.
|
||||
* @return The maxspeed for the client.
|
||||
*/
|
||||
native ns_get_maxspeed(id);
|
||||
|
||||
/* Returns whether or not this mask is set from the entity's iuser4 field. Use the "mask" enum for reference. */
|
||||
native ns_get_mask(id,mask);
|
||||
|
||||
/* Sets or removes the mask from the entity's iuser4 field. Set "value" to 1 to turn the mask on, 0 to turn it off. */
|
||||
native ns_set_mask(id,mask,value);
|
||||
|
||||
/* Returns built/unbuilt structures.
|
||||
If:
|
||||
builtOnly is 1 (default):
|
||||
Only fully built structures are counted.
|
||||
builtOnly is 0:
|
||||
Any structure meeting the classname is counted.
|
||||
|
||||
Number is 0 (default):
|
||||
The total number of matching structures is returned.
|
||||
Number is any other value:
|
||||
The index of the #th matching structure is returned.
|
||||
*/
|
||||
native ns_get_build(const classname[],builtOnly=1,Number=0);
|
||||
|
||||
/* Returns if the player has the weapon or not in their pev->weapons field.
|
||||
set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. Or omit it to just return the value. */
|
||||
native ns_has_weapon(id,weapon,setweapon=-1);
|
||||
|
||||
/* Gets spawn point for specified team (type).
|
||||
If:
|
||||
Team is equal to 0:
|
||||
Ready room spawns are returned.
|
||||
Team is greater than 0:
|
||||
Spawns for the team are returned.
|
||||
|
||||
Number is equal to 0:
|
||||
Total number of spawns is returned.
|
||||
Number is greater than 0:
|
||||
The location of the specified spawn is returned.
|
||||
*/
|
||||
native ns_get_spawn(team,number=0,Float:ret[3]);
|
||||
|
||||
/* Returns the class of the player. Look in the classes enum in ns_const.inc for the value's meaning. */
|
||||
native ns_get_class(id);
|
||||
|
||||
/**
|
||||
* Gets the player's jetpack fuel reserve.
|
||||
*
|
||||
* @param id The player to get fuel from.
|
||||
* @return The amount of fuel in the player's reserve. (0.0 through 100.0)
|
||||
*/
|
||||
native Float:ns_get_jpfuel(id);
|
||||
|
||||
/**
|
||||
* Sets the player's jetpack fuel reserve.
|
||||
*
|
||||
* @param id The player to set fuel.
|
||||
* @param fuel The amount of fuel to set, as a percentage (0.0 through 100.0)
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_jpfuel(id, Float:fuel);
|
||||
|
||||
/**
|
||||
* Adds to the player's jetpack fuel reserve.
|
||||
*
|
||||
* @param id The player to add fuel to.
|
||||
* @param amount The amount of fuel to add, as a percentage (0.0 through 100.0)
|
||||
* @return The new amount of fuel in the player's reserve. (0.0 through 100.0)
|
||||
*/
|
||||
native Float:ns_add_jpfuel(id, Float:amount);
|
||||
|
||||
/**
|
||||
* Gets the player's energy percentage.
|
||||
*
|
||||
* @param id The player to get the energy from.
|
||||
* @return The amount of energy the player has (0.0 through 100.0)
|
||||
*/
|
||||
native Float:ns_get_energy(id);
|
||||
|
||||
/**
|
||||
* Sets the player's energy percentage.
|
||||
*
|
||||
* @param id The player to set the energy on.
|
||||
* @param energy The amount of energy to set (0.0 through 100.0)
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_energy(id, Float:energy);
|
||||
|
||||
/**
|
||||
* Adds to the player's energy percentage.
|
||||
*
|
||||
* @param id The player to add the energy to.
|
||||
* @param amount The amount of energy to add to the player.
|
||||
* @return The new amount of energy the player has (0.0 through 100.0)
|
||||
*/
|
||||
native Float:ns_add_energy(id, Float:amount);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a player's resources.
|
||||
*
|
||||
* @note This is only for alien players.
|
||||
* @param id The id of the player to check.
|
||||
* @return Amount of resources this player has.
|
||||
*/
|
||||
native Float:ns_get_res(id);
|
||||
|
||||
/**
|
||||
* Sets a player's resources.
|
||||
*
|
||||
* @note This is only for alien players.
|
||||
* @param id The id of the player to set.
|
||||
* @param res Amount of resources to set on this player.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_res(id, Float:res);
|
||||
|
||||
/**
|
||||
* Adds an amount of resources to the player.
|
||||
*
|
||||
* @note This is only for alien players.
|
||||
* @param id The id of the player to add resources to.
|
||||
* @param amount The amount to add to the player.
|
||||
* @return The new amount of resources the player has.
|
||||
*/
|
||||
native Float:ns_add_res(id, Float:amount);
|
||||
|
||||
/**
|
||||
* Returns the team's resources.
|
||||
*
|
||||
* @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines,
|
||||
2 is aliens. In mvm, 1 is marine1, 2 is marine2)
|
||||
* @return The amount of resources in this team's resource pool.
|
||||
*/
|
||||
native Float:ns_get_teamres(Team);
|
||||
|
||||
/**
|
||||
* Sets the team's resources in the resource pool.
|
||||
*
|
||||
* @note If this is used on an alien team, the resources will be
|
||||
* distributed between all of the players who need resources.
|
||||
* @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines,
|
||||
* 2 is aliens. In mvm, 1 is marine1, 2 is marine2)
|
||||
* @param value The amount to set the resources to set to.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_teamres(Team, Float:value);
|
||||
|
||||
/**
|
||||
* Adds to the team's resources in the resource pool.
|
||||
*
|
||||
* @note If this is used on an alien team, the resources will be
|
||||
* distributed between all of the players who need resources.
|
||||
* @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines,
|
||||
* 2 is aliens. In mvm, 1 is marine1, 2 is marine2)
|
||||
* @param value The amount to set the resources to add to the pool
|
||||
* @return The new amount of resources in the resource pool.
|
||||
*/
|
||||
native Float:ns_add_teamres(Team,Float:value);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the player's experience.
|
||||
*
|
||||
* @note Combat only.
|
||||
* @param id The player to get experience value from.
|
||||
* @return The amount of experience this player has.
|
||||
*/
|
||||
native Float:ns_get_exp(id);
|
||||
|
||||
/**
|
||||
* Sets the player's experience.
|
||||
*
|
||||
* @note Combat only.
|
||||
* @param id The player to set experience value on.
|
||||
* @param exp The amount of experience this player will have.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_exp(id,Float:exp);
|
||||
|
||||
/**
|
||||
* Adds to the player's experience.
|
||||
*
|
||||
* @note Combat only.
|
||||
* @param id The player to add experience value to.
|
||||
* @param value The amount of experience this player will receive.
|
||||
* @return The new amount of experience this player has.
|
||||
*/
|
||||
native Float:ns_add_exp(id, Float:value);
|
||||
|
||||
/**
|
||||
* Gets the player's points spent count in combat.
|
||||
*
|
||||
* @param id The player to check.
|
||||
* @return The amount of points this player has spent.
|
||||
*/
|
||||
native ns_get_points(id);
|
||||
|
||||
/**
|
||||
* Sets the player's points spent count in combat.
|
||||
*
|
||||
* @param id The player to set this on.
|
||||
* @param points The amount to set this to.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_points(id, points);
|
||||
|
||||
/**
|
||||
* Adds to the player's points spent count in combat.
|
||||
*
|
||||
* @param id The player to add this to.
|
||||
* @param value The value to add to the points spent.
|
||||
* @return The new value of the points spent variable.
|
||||
*/
|
||||
native ns_add_points(id,points);
|
||||
|
||||
/**
|
||||
* Gets the damage for this weapon.
|
||||
*
|
||||
* @note Use weapon index, not player index!
|
||||
* @param idWeapon The entity index of the weapon to check.
|
||||
* @return The damage this weapon does.
|
||||
*/
|
||||
native Float:ns_get_weap_dmg(idWeapon);
|
||||
|
||||
/**
|
||||
* Sets the damage for this weapon.
|
||||
*
|
||||
* @note Use weapon index, not player index!
|
||||
* @param idWeapon The entity index of the weapon to set.
|
||||
* @param damage The damage to make this weapon cause.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_weap_dmg(idWeapon, Float:damage);
|
||||
|
||||
/**
|
||||
* Gets the maximum range for this weapon.
|
||||
*
|
||||
* @note Use weapon index, not player index!
|
||||
* @param idWeapon The entity index of the weapon to check.
|
||||
* @return The maximum range this weapon has.
|
||||
*/
|
||||
native Float:ns_get_weap_range(idWeapon);
|
||||
|
||||
/**
|
||||
* Sets the maximum range for this weapon.
|
||||
*
|
||||
* @note Use weapon index, not player index!
|
||||
* @param idWeapon The entity index of the weapon to set.
|
||||
* @param range The maximum range this weapon will have.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_weap_range(idWeapon, Float:range);
|
||||
|
||||
/**
|
||||
* Gets the weapon's clip ammo.
|
||||
*
|
||||
* @note Use weapon index, not player index!
|
||||
* @param idWeapon The weapon to get the clip ammo from.
|
||||
* @return The amount of ammunition in the weapon's clip.
|
||||
*/
|
||||
native ns_get_weap_clip(idWeapon);
|
||||
|
||||
/**
|
||||
* Sets the weapon's ammo in the clip.
|
||||
*
|
||||
* @note Use weapon index, not player index!
|
||||
* @param idWeapon The weapon to set the clip ammo on.
|
||||
* @param clipsize The amount of ammunition to set in the weapon's clip.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_weap_clip(idWeapon, clipsize);
|
||||
|
||||
/**
|
||||
* Gets the player's weapon reserve (backpack ammo) for the specified
|
||||
* type of weapon.
|
||||
*
|
||||
* @note Use player index, not weapon index!
|
||||
* @param id The player id to check ammo count on.
|
||||
* @param weapon The weapon type to check ammo count for.
|
||||
* @return The ammunition count in the player's reserve.
|
||||
*/
|
||||
native ns_get_weap_reserve(id,weapon);
|
||||
|
||||
/**
|
||||
* Sets the player's weapon reserve (backpack ammo) for the specified
|
||||
* type of weapon.
|
||||
*
|
||||
* @note Use player index, not weapon index!
|
||||
* @param id The player id to set ammo count on.
|
||||
* @param weapon The weapon type to set ammo count for.
|
||||
* @param ammo The ammunition count to set.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_weap_reserve(id,weapon,ammo);
|
||||
|
||||
/**
|
||||
* Gets the player's score.
|
||||
*
|
||||
* @note The score from level is automatically factored into the scoreboard in combat.
|
||||
* @param idPlayer The player to get the score for.
|
||||
* @return The player's score.
|
||||
*/
|
||||
native ns_get_score(idPlayer);
|
||||
|
||||
/**
|
||||
* Sets the player's score.
|
||||
*
|
||||
* @note The score from level is automatically factored into the scoreboard in combat.
|
||||
* @param idPlayer The player to get the score for.
|
||||
* @param score What to set the player's score as.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_set_score(idPlayer, score);
|
||||
|
||||
/* Adds to a player's score
|
||||
* Returns the new score on success
|
||||
*/
|
||||
native ns_add_score(idPlayer,score);
|
||||
|
||||
/* Gets a player's death count. */
|
||||
native ns_get_deaths(idPlayer);
|
||||
|
||||
/* Sets a player's death count. */
|
||||
native ns_set_deaths(idPlayer,numdeaths);
|
||||
|
||||
/* Adds to a player's death count
|
||||
* Returns the new death count on success
|
||||
*/
|
||||
native ns_add_deaths(idPlayer,numdeaths);
|
||||
|
||||
/* Gets the index of the owner of a structure. -1 for no owner. */
|
||||
native ns_get_struct_owner(idStructsure);
|
||||
|
||||
/* Sets the index of the owner of a structure. -1 for no owner. */
|
||||
native ns_set_struct_owner(idStructure,indexOwner);
|
||||
|
||||
/* Gets the trait type tied to the hive. Look at the hivetrait enum for the values. */
|
||||
native ns_get_hive_trait(idHive);
|
||||
|
||||
/* Sets the trait type tied to the hive. Look at the hivetrait enum for the values. */
|
||||
native ns_set_hive_trait(idHive,trait);
|
||||
|
||||
/* Sets the players field of view, set "_fov" to 0.0 (or omit it) to return to normal. FOV change will persist until disconnect unless reset by a plugin */
|
||||
native ns_set_fov(idPlayer,Float:_fov=0.0);
|
||||
|
||||
/**
|
||||
* Give the player an item.
|
||||
*
|
||||
* @param id The player to give the item to.
|
||||
* @param class The map-classname of the entity to give to the player.
|
||||
* @noreturn
|
||||
*/
|
||||
native ns_give_item(id, const class[]);
|
||||
|
||||
/**
|
||||
* Returns 1 if a player has the hive ability number.
|
||||
* If ability is 0, it will return the number of active hives.
|
||||
*
|
||||
* @param idPlayer The player index to look up.
|
||||
* @param ability The ability number to check, set to 0 to get number of active hives.
|
||||
* @return If ability is != 0, returns 1 or 0 depending on if the client has the ability.
|
||||
* If ability is 0, returns the number of active hives.
|
||||
*/
|
||||
native ns_get_hive_ability(idPlayer, ability=0);
|
||||
|
||||
/**
|
||||
* Triggered whenever a client's pev->team changes.
|
||||
*
|
||||
* @param id The id of the client.
|
||||
* @param newteam The team number of the new team.
|
||||
* @param oldteam The team number of the old team.
|
||||
* @noreturn
|
||||
*/
|
||||
forward client_changeteam(id, newteam, oldteam);
|
||||
|
||||
/**
|
||||
* Triggered whenever a client's pev->deadflag changes from >0 to 0.
|
||||
*
|
||||
* @param id The id of the client.
|
||||
* @noreturn
|
||||
*/
|
||||
forward client_spawn(id);
|
||||
|
||||
/**
|
||||
* Calls NS's private damage routine on the victim entity.
|
||||
*
|
||||
* @deprecated
|
||||
* @note This is provided for backwards compatibility with peachy's module.
|
||||
* It is suggested to use hamsandwich for this action instead.
|
||||
*
|
||||
* @param IDVictim The victim that is taking the damage.
|
||||
* @param IDInflictor The entity that is causing the damage (weapon, etc).
|
||||
* @param IDAttacker The attacker who is triggering the damage (person shooting).
|
||||
* @param Damage The amount of damage being done.
|
||||
* @param DamageType The damage type being done (bitmask).
|
||||
*/
|
||||
native ns_takedamage(IDVictim, IDInflictor, IDAttacker, Float:Damage, DamageType);
|
||||
|
||||
/**
|
||||
* Attempts to unstick a player.
|
||||
*
|
||||
* @param id Player to unstick.
|
||||
* @param StartDistance Distance to start from the player to check for a new location.
|
||||
* @param MaxAttempts How many attempts to try to find a new spot before giving up.
|
||||
* @return 1 on success, 0 on cannot find a place to move player to,
|
||||
* -1 on invalid state (stunned/webbed), -2 on invalid class (comm/egg)
|
||||
* -3 if the player is dead or a spectator, -4 on invalid player,
|
||||
* -5 if the player is not connected.
|
||||
*/
|
||||
native ns_unstick_player(id, StartDistance=32, MaxAttempts=128);
|
||||
|
||||
/**
|
||||
* Whether or not there is a game in progress.
|
||||
*
|
||||
* @return true if a game is in progress, false otherwise.
|
||||
*/
|
||||
native bool:ns_round_in_progress();
|
||||
|
||||
/**
|
||||
* Called at the approximate time that a round is started.
|
||||
*
|
||||
* @noreturn
|
||||
*/
|
||||
forward round_start();
|
||||
|
||||
/**
|
||||
* Called immediately when a round ends
|
||||
*
|
||||
* @param roundtime The length of the round in seconds.
|
||||
* @noreturn
|
||||
*/
|
||||
forward round_end(Float:roundtime);
|
||||
|
||||
forward map_reset(isload);
|
||||
|
||||
native ns_get_weapon(idPlayer,weaponid,&weapontype=0);
|
||||
|
||||
/* Returns the location name of the provided x/y position
|
||||
* (z origin is ignored; can't have location over location)
|
||||
* -
|
||||
* Note that as of NS 3.2 beta 2, on the following maps
|
||||
* the returned string should be passed through ns_lookup_title
|
||||
* to be human readable:
|
||||
* ns_bast, ns_hera, ns_nothing, ns_tanith,
|
||||
* ns_nancy, ns_caged, ns_eclipse, ns_veil
|
||||
*
|
||||
* Passing the 5th parameter as non zero will auto look up
|
||||
* the title if it exists.
|
||||
*/
|
||||
native ns_get_locationname(Float:x, Float:y, name[], len, titlelookup=0);
|
||||
|
||||
/* Looks up a key from titles.txt
|
||||
* Returns -1 if the key is not found
|
||||
* Otherwise it returns the length of the output
|
||||
*/
|
||||
native ns_lookup_title(const KeyName[], Output[], length);
|
||||
|
||||
/* Forces the structure to fully build
|
||||
* Removes the ghost state from marine structures.
|
||||
* Do not use this on hives! It wont work.
|
||||
*/
|
||||
native ns_build_structure(idStructure);
|
||||
|
||||
/* Forces the structure to begin recycling
|
||||
* Passing an index other than a marine structure will
|
||||
* have undefined results!
|
||||
* -
|
||||
* Note: This calls a private NS function!
|
||||
* Be careful when using this!
|
||||
*/
|
||||
native ns_recycle(idStructure);
|
||||
|
||||
/* Forces the weldable to trigger
|
||||
* Passing an index other than a weldable
|
||||
* will have undefined results!
|
||||
* -
|
||||
* NS renames func_weldable to avhweldable
|
||||
* at map load.
|
||||
* -
|
||||
* Note: This calls a private NS function!
|
||||
* Be careful when using this!
|
||||
*/
|
||||
native ns_finish_weldable(idWeldable);
|
||||
|
||||
/* Gets the total time needed to weld this
|
||||
* func_weldable shut.
|
||||
* Note: NS renames "func_weldable"s to "avhweldable"s
|
||||
* at run time!
|
||||
*/
|
||||
native Float:ns_get_weld_time(idWeldable);
|
||||
|
||||
/* Sets the total time needed to weld this
|
||||
* func_weldable shut.
|
||||
*/
|
||||
native ns_set_weld_time(idWeldable,Float:value);
|
||||
|
||||
/* Adds to the weldable's time required to open.
|
||||
* Returns the new required time on success.
|
||||
* Note this native clamps the low value to 0.
|
||||
*/
|
||||
native Float:ns_add_weld_time(idWeldable,Float:value);
|
||||
|
||||
/* Gets the total time this func_weldable
|
||||
* has been welded.
|
||||
*/
|
||||
native Float:ns_get_weld_done(idWeldable);
|
||||
|
||||
/* Sets the total time this func_weldable
|
||||
* has been welded.
|
||||
*/
|
||||
native ns_set_weld_done(idWeldable,Float:value);
|
||||
|
||||
/* Adds to the total time this func_weldable
|
||||
* has been welded. Returns the new value.
|
||||
* Note this native clamps the low value to 0.0
|
||||
*/
|
||||
native Float:ns_add_weld_done(idWeldable,Float:value);
|
||||
|
||||
/* Gets/sets/adds to the energy pool of this observatory. */
|
||||
native Float:ns_get_obs_energy(idObs);
|
||||
native ns_set_obs_energy(idObs,Float:value);
|
||||
native Float:ns_add_obs_energy(idObs,Float:value);
|
||||
|
||||
/**
|
||||
* Removes an upgrade from the player's bought and active upgrade lists.
|
||||
* This will not refund the points spent on the upgrade, nor will it
|
||||
* immediately strip the upgrade if the player is alive. Rather, it will
|
||||
* make it so the player no longer receives the upgrade on spawn.
|
||||
*
|
||||
* @note This only works in combat.
|
||||
* @params idPlayer The player index to change upgrades for.
|
||||
* @params ugprade The impulse number for the upgrade to strip.
|
||||
* @return 2 for upgrade removed from player's bought and active list.
|
||||
* 1 for upgrade removed from player's bought list only.
|
||||
* 3 for upgrade removed from player's active list only (shouldn't happen, just incase.)
|
||||
* 0 for the player didn't have the upgrade in either list.
|
||||
*/
|
||||
native ns_remove_upgrade(idPlayer, upgrade);
|
||||
|
||||
/**
|
||||
* Particle system natives
|
||||
* -
|
||||
* The particle system emulates a map-based custom particle system.
|
||||
* Familiarity with the keyvalues from the map-based particle systems
|
||||
* is recommended! You will be lost otherwise!
|
||||
* -
|
||||
* prsearle's NSPEdit is also recommended for designing the systems:
|
||||
* http://homepage.ntlworld.com/pr.searle/NSPSEdit/NSPSEdit.html
|
||||
*/
|
||||
|
||||
/* Creates a handle to the a particle system to configure
|
||||
* -
|
||||
* Note! this is not a particle system you can pass to
|
||||
* ns_fire_ps()!
|
||||
*/
|
||||
native RawPS:ns_create_ps();
|
||||
|
||||
/* Sets the name of the particle system.
|
||||
* -
|
||||
* This is used for things like ns_get_ps_id()
|
||||
* and through calling another particle system
|
||||
* through the "ps_to_gen" field
|
||||
*/
|
||||
native ns_set_ps_name(RawPS:system, const name[]);
|
||||
|
||||
/* Sets the sprite to use for the particle system
|
||||
* -
|
||||
* You do NOT have to precache the sprite, BUT
|
||||
* the sprite must obviously be on the client to
|
||||
* display.
|
||||
*/
|
||||
native ns_set_ps_sprite(RawPS:system, const sprite[]);
|
||||
|
||||
/* Finalizes the particle system. Do not configure it after this.
|
||||
* A usable particle system handle is returned.
|
||||
*/
|
||||
native Particle:ns_spawn_ps(RawPS:system);
|
||||
|
||||
/* Draws a particle system at the given origin (and angles)
|
||||
* Flags are the FEV_* defines from hlsdk_const.inc
|
||||
* Only use handles returned by ns_spawn_ps or ns_get_ps_id here!
|
||||
*/
|
||||
native ns_fire_ps(Particle:system,const Float:origin[3],const Float:angles[3]={0.0,0.0,0.0}, flags=0);
|
||||
|
||||
/* Looks up a particle system by name
|
||||
* Returns a usable particle system handle.
|
||||
*/
|
||||
native Particle:ns_get_ps_id(const Name[]);
|
||||
|
||||
/* The following are the parameters for configuring the
|
||||
* particle system. Look through the fgd and NSPSEdit
|
||||
* for details!
|
||||
*/
|
||||
native ns_set_ps_genrate(RawPS:system, genrate);
|
||||
native ns_set_ps_genshape(RawPS:system, NSPS_GenShape:genshape);
|
||||
native ns_set_ps_genshape_params(RawPS:system, const params[]);
|
||||
native ns_set_ps_spriteframes(RawPS:system, spriteframes);
|
||||
native ns_set_ps_numparticles(RawPS:system, numparticles);
|
||||
native ns_set_ps_size(RawPS:system, Float:size);
|
||||
native ns_set_ps_vel_params(RawPS:system, const params[]);
|
||||
native ns_set_ps_vel_shape(RawPS:system, NSPS_VelShape:shape);
|
||||
native ns_set_ps_sys_life(RawPS:system, Float:lifetime);
|
||||
native ns_set_ps_particle_life(RawPS:system, Float:lifetime);
|
||||
native ns_set_ps_rendermode(RawPS:system, NSPS_RenderMode:rendermode);
|
||||
native ns_set_ps_to_gen(RawPS:system, const name[]);
|
||||
native ns_set_ps_anim_speed(RawPS:system, speed);
|
||||
native ns_set_ps_spawn_flags(RawPS:system, NSPS_Flags:flags);
|
||||
native ns_set_ps_base_color(RawPS:system, const colors[]);
|
||||
native ns_set_ps_scale(RawPS:system, Float:scale);
|
||||
native ns_set_ps_max_alpha(RawPS:system, Float:maxalpha);
|
||||
@@ -0,0 +1,263 @@
|
||||
/* NS2AMX Utility backwards compatibility
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _ns2amx_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _ns2amx_included
|
||||
|
||||
#include <engine> // various engine calls
|
||||
#include <fakemeta> // pev/engfunc/dllfunc/various calls which rely on engfunc/dllfunc
|
||||
#include <ns> // ns specifics
|
||||
|
||||
stock is_entity(id)
|
||||
return is_valid_ent(id);
|
||||
|
||||
/* The end of the native is buffered incase the plugin is including an NS_VERSION (no longer supported), ignore it */
|
||||
stock get_build(classname[], value, number=0,any:...)
|
||||
return ns_get_build(classname, value, number);
|
||||
|
||||
stock get_private_i(index, offset, linuxdiff=5)
|
||||
return get_pdata_int(index, offset, linuxdiff);
|
||||
|
||||
stock set_private_i(index, offset, value, linuxdiff=5)
|
||||
{
|
||||
return set_pdata_int(index, offset, value, linuxdiff);
|
||||
}
|
||||
|
||||
stock Float:get_private_f(index, offset, linuxdiff=5)
|
||||
{
|
||||
return get_pdata_float(index, offset, linuxdiff);
|
||||
}
|
||||
|
||||
stock set_private_f(index, offset, Float:value, linuxdiff=5)
|
||||
{
|
||||
return set_pdata_float(index, offset, value, linuxdiff);
|
||||
}
|
||||
|
||||
stock make_string(value[])
|
||||
return engfunc(EngFunc_AllocString,value);
|
||||
|
||||
stock string(value, ret[])
|
||||
{
|
||||
new szString[128];
|
||||
engfunc(EngFunc_SzFromIndex,value,szString,127);
|
||||
copy(ret,127,szString);
|
||||
}
|
||||
|
||||
stock gpgobals_time()
|
||||
return floatround(halflife_time());
|
||||
|
||||
stock Float:get_range(ida, idb)
|
||||
return entity_range(ida, idb);
|
||||
|
||||
stock supercede()
|
||||
return 0;
|
||||
|
||||
stock register_clientkill()
|
||||
return 0;
|
||||
|
||||
stock register_changelvl()
|
||||
return 0;
|
||||
|
||||
stock register_msgblock(msgName[])
|
||||
return set_msg_block(get_user_msgid(msgName), BLOCK_SET);
|
||||
|
||||
stock register_msgedit(msgName[], cmd[])
|
||||
return register_message(get_user_msgid(msgName), cmd);
|
||||
|
||||
stock register_playback(event, cmd[])
|
||||
return 0;
|
||||
|
||||
stock get_spawn(type, number=0, Float:ret[3])
|
||||
return ns_get_spawn(type, number, ret);
|
||||
|
||||
stock has_weapon(index, weapon, setweapon=-1)
|
||||
return ns_has_weapon(index, weapon, setweapon);
|
||||
|
||||
stock gpglobals_v(type, Float:ret[3])
|
||||
{
|
||||
new v_type=0;
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
v_type = GL_v_forward;
|
||||
case 2:
|
||||
v_type = GL_v_right;
|
||||
case 3:
|
||||
v_type = GL_v_up;
|
||||
}
|
||||
if (!v_type)
|
||||
return 0;
|
||||
return get_global_vector(v_type, ret);
|
||||
}
|
||||
|
||||
stock pev_i(_index,_field)
|
||||
return pev(_index,_field);
|
||||
|
||||
stock set_pev_i(_index, _field, _val)
|
||||
return set_pev(_index,_field,_val);
|
||||
|
||||
stock Float:pev_f(_index,_field)
|
||||
{
|
||||
new Float:f;
|
||||
pev(_index,_field,f);
|
||||
return f;
|
||||
}
|
||||
stock set_pev_f(_index,_field,Float:_val)
|
||||
return set_pev(_index,_field,_val);
|
||||
|
||||
|
||||
stock msg_args()
|
||||
return get_msg_args();
|
||||
|
||||
stock Float:msg_loc(vec)
|
||||
{
|
||||
new Float:Ret[3];
|
||||
get_msg_origin(Ret);
|
||||
if (vec < 0 || vec > 3)
|
||||
return float(0);
|
||||
else
|
||||
return Ret[vec];
|
||||
|
||||
return 0.0; // make compiler happy!
|
||||
}
|
||||
|
||||
stock msg_dest()
|
||||
return 0;
|
||||
|
||||
stock msg_type()
|
||||
return 0;
|
||||
|
||||
stock msg_name()
|
||||
return 0;
|
||||
|
||||
stock msg_set_s(number, value[])
|
||||
return set_msg_arg_string(number, value);
|
||||
|
||||
stock msg_set_f(number, Float:value)
|
||||
return set_msg_arg_float(number, get_msg_argtype(number), value);
|
||||
|
||||
stock msg_set_i(number, value)
|
||||
return set_msg_arg_int(number, get_msg_argtype(number), value);
|
||||
|
||||
stock msg_data_type(value)
|
||||
return get_msg_argtype(value);
|
||||
|
||||
stock msg_strdata(value)
|
||||
return 0;
|
||||
|
||||
stock msg_data(value, ...)
|
||||
{
|
||||
return (0*value);
|
||||
}
|
||||
|
||||
stock get_filename(szFile[], len=-1)
|
||||
{
|
||||
new name[16], version[16], author[16], status[16];
|
||||
new res = get_plugin(0, szFile, len, name, 16, version, 16, author, 16, status, 16);
|
||||
return res;
|
||||
}
|
||||
|
||||
stock get_speedchange(id)
|
||||
return ns_get_speedchange(id);
|
||||
|
||||
stock set_speedchange(id, speed)
|
||||
return ns_set_speedchange(id,speed);
|
||||
|
||||
stock get_maxspeed(id)
|
||||
return ns_get_maxspeed(id);
|
||||
|
||||
stock set_player_model(id, model[]="")
|
||||
return ns_set_player_model(id, model);
|
||||
|
||||
stock set_player_skin(id, skin=-1)
|
||||
return ns_set_player_skin(id, skin);
|
||||
|
||||
stock set_player_body(id, body=-1)
|
||||
return ns_set_player_body(id, body);
|
||||
|
||||
stock ns2amx_version()
|
||||
return 0;
|
||||
|
||||
stock set_kvhandled()
|
||||
return 0;
|
||||
|
||||
stock ns2amx_getammo(id,Weapon)
|
||||
return ns_get_weap_reserve(id, Weapon);
|
||||
|
||||
stock ns2amx_setammo(id,Weapon,Value)
|
||||
return ns_set_weap_reserve(id, Weapon, Value);
|
||||
|
||||
stock ns2amx_giveitem(id,svClassname[])
|
||||
return ns_give_item(id, svClassname);
|
||||
|
||||
stock ns2amx_moveto(idMoved,idDest)
|
||||
{
|
||||
new Float:origin[3];
|
||||
entity_get_vector(idDest, EV_VEC_origin,origin);
|
||||
entity_set_origin(idMoved, origin);
|
||||
return 1;
|
||||
}
|
||||
/* Returns whether or not the player has the MASK_DIGESTING flag set. */
|
||||
stock ns2amx_isdigesting(id)
|
||||
return ns_get_mask(id,MASK_DIGESTING);
|
||||
|
||||
/* Returns total # of active hives. */
|
||||
stock ns2amx_gethives()
|
||||
return ns_get_build("team_hive",1);
|
||||
|
||||
/* Returns 1 if the two entities are within the given range. */
|
||||
stock ns2amx_inrange(ida,idb,range)
|
||||
{
|
||||
if (entity_range(ida,idb) <= range)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock ns2amx_nspopup(id,svMessage[190]) {
|
||||
new szMessage[180];
|
||||
copy(szMessage,179,svMessage);
|
||||
return ns_popup(id, szMessage);
|
||||
}
|
||||
|
||||
stock ns2amx_setres(id,value)
|
||||
return ns_set_res(id, float(value));
|
||||
|
||||
stock ns2amx_getenergy(id)
|
||||
return floatround(ns_get_energy(id));
|
||||
|
||||
stock ns2amx_setenergy(id,energy)
|
||||
return ns_set_energy(id, float(energy));
|
||||
|
||||
stock ns2amx_getjpfuel(id)
|
||||
return floatround(ns_get_jpfuel(id));
|
||||
|
||||
stock ns2amx_setjpfuel(id,fuel)
|
||||
return ns_set_jpfuel(id, float(fuel));
|
||||
|
||||
stock get_mask(id,mask)
|
||||
return ns_get_mask(id, mask);
|
||||
|
||||
stock set_mask(id,mask,value)
|
||||
return ns_set_mask(id,mask,value);
|
||||
|
||||
stock get_special(id,mask)
|
||||
{
|
||||
if (pev(id,pev_iuser4) & mask)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock get_res(id)
|
||||
return floatround(ns_get_res(id));
|
||||
|
||||
stock get_class(id)
|
||||
return ns_get_class(id);
|
||||
|
||||
stock is_combat()
|
||||
return ns_is_combat();
|
||||
@@ -0,0 +1,192 @@
|
||||
/* NS module constants
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* Most definitions graciously provided by Flayra
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
|
||||
#if defined NS_CONST_INC
|
||||
#endinput
|
||||
#endif
|
||||
#define NS_CONST_INC
|
||||
|
||||
|
||||
enum NSGameplay
|
||||
{
|
||||
NSGame_CantTell, /**< It is too soon to tell (can't find avhgameplay
|
||||
entity or it doesn't have private data) */
|
||||
|
||||
NSGame_MarineVAlien, /**< Marine vs Aliens (standard) gameplay */
|
||||
NSGame_MarineVMarine, /**< Marine vs Marine */
|
||||
NSGame_AlienVAlien, /**< Alien vs Alien */
|
||||
|
||||
NSGame_Unknown, /**< Can find the gameplay entity, but can't
|
||||
determine gameplay type. */
|
||||
};
|
||||
|
||||
// entity pev->iuser4 fields
|
||||
enum {
|
||||
MASK_NONE = 0,
|
||||
MASK_SIGHTED = 1,
|
||||
MASK_DETECTED = 2,
|
||||
MASK_BUILDABLE = 4,
|
||||
MASK_BASEBUILD0 = 8, // Base build slot #0
|
||||
MASK_WEAPONS1 = 8, // Marine weapons 1
|
||||
MASK_CARAPACE = 8, // Alien carapace
|
||||
MASK_WEAPONS2 = 16, // Marines weapons 2
|
||||
MASK_REGENERATION = 16, // Alien regeneration
|
||||
MASK_BASEBUILD1 = 16, // Base build slot #1
|
||||
MASK_WEAPONS3 = 32, // Marine weapons 3
|
||||
MASK_REDEMPTION = 32, // Alien redemption
|
||||
MASK_BASEBUILD2 = 32, // Base build slot #2
|
||||
MASK_ARMOR1 = 64, // Marine armor 1
|
||||
MASK_CELERITY = 64, // Alien celerity
|
||||
MASK_BASEBUILD3 = 64, // Base build slot #3
|
||||
MASK_ARMOR2 = 128, // Marine armor 2
|
||||
MASK_ADRENALINE = 128, // Alien adrenaline
|
||||
MASK_BASEBUILD4 = 128, // Base build slot #4
|
||||
MASK_ARMOR3 = 256, // Marine armor 3
|
||||
MASK_SILENCE = 256, // Alien silence
|
||||
MASK_BASEBUILD5 = 256, // Base build slot #5
|
||||
MASK_JETPACK = 512, // Marine jetpacks
|
||||
MASK_CLOAKING = 512, // Alien cloaking
|
||||
MASK_BASEBUILD6 = 512, // Base build slot #6
|
||||
MASK_FOCUS = 1024, // Alien focus
|
||||
MASK_MOTION = 1024, // Marine motion tracking
|
||||
MASK_BASEBUILD7 = 1024, // Base build slot #7
|
||||
MASK_SCENTOFFEAR = 2048, // Alien scent of fear
|
||||
MASK_DEFENSE2 = 4096, // Defense level 2
|
||||
MASK_DEFENSE3 = 8192, // Defense level 3
|
||||
MASK_ELECTRICITY = 8192, // Electricy
|
||||
MASK_MOVEMENT2 = 16384, // Movement level 2,
|
||||
MASK_MOVEMENT3 = 32768, // Movement level 3
|
||||
MASK_HEAVYARMOR = 32768, // Marine heavy armor
|
||||
MASK_SENSORY2 = 65536, // Sensory level 2
|
||||
MASK_SENSORY3 = 131072, // Sensory level 3
|
||||
MASK_ALIEN_MOVEMENT = 262144, // Onos is charging
|
||||
MASK_WALLSTICKING = 524288, // Flag for wall-sticking
|
||||
MASK_PRIMALSCREAM = 1048576, // Alien is in range of active primal scream
|
||||
MASK_UMBRA = 2097152, // In umbra
|
||||
MASK_DIGESTING = 4194304, // When set on a visible player, player is digesting. When set on invisible player, player is being digested
|
||||
MASK_RECYCLING = 8388608, // Building is recycling
|
||||
MASK_TOPDOWN = 16777216, // Commander view
|
||||
MASK_PLAYER_STUNNED = 33554432, // Player has been stunned by stomp
|
||||
MASK_ENSNARED = 67108864, // Webbed
|
||||
MASK_ALIEN_EMBRYO = 134217728, // Gestating
|
||||
MASK_SELECTABLE = 268435456, // ???
|
||||
MASK_PARASITED = 536870912, // Parasite flag
|
||||
MASK_SENSORY_NEARBY = 1073741824 // Sensory chamber in range
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
CLASS_UNKNOWN = 0,
|
||||
CLASS_SKULK,
|
||||
CLASS_GORGE,
|
||||
CLASS_LERK,
|
||||
CLASS_FADE,
|
||||
CLASS_ONOS,
|
||||
CLASS_MARINE,
|
||||
CLASS_JETPACK,
|
||||
CLASS_HEAVY,
|
||||
CLASS_COMMANDER,
|
||||
CLASS_GESTATE,
|
||||
CLASS_DEAD,
|
||||
CLASS_NOTEAM
|
||||
};
|
||||
|
||||
enum {
|
||||
WEAPON_NONE = 0,
|
||||
WEAPON_CLAWS,
|
||||
WEAPON_SPIT,
|
||||
WEAPON_SPORES,
|
||||
WEAPON_SPIKE,
|
||||
WEAPON_BITE,
|
||||
WEAPON_BITE2,
|
||||
WEAPON_SWIPE,
|
||||
WEAPON_WEBSPINNER,
|
||||
WEAPON_METABOLIZE,
|
||||
WEAPON_PARASITE,
|
||||
WEAPON_BLINK,
|
||||
WEAPON_DIVINEWIND,
|
||||
WEAPON_KNIFE,
|
||||
WEAPON_PISTOL,
|
||||
WEAPON_LMG,
|
||||
WEAPON_SHOTGUN,
|
||||
WEAPON_HMG,
|
||||
WEAPON_WELDER,
|
||||
WEAPON_MINE,
|
||||
WEAPON_GRENADE_GUN,
|
||||
WEAPON_LEAP,
|
||||
WEAPON_CHARGE,
|
||||
WEAPON_UMBRA,
|
||||
WEAPON_PRIMALSCREAM,
|
||||
WEAPON_BILEBOMB,
|
||||
WEAPON_ACIDROCKET,
|
||||
WEAPON_HEALINGSPRAY,
|
||||
WEAPON_GRENADE,
|
||||
WEAPON_STOMP,
|
||||
WEAPON_DEVOUR,
|
||||
WEAPON_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
HIVETRAIT_NONE = 0,
|
||||
HIVETRAIT_DC = 92,
|
||||
HIVETRAIT_SC = 93,
|
||||
HIVETRAIT_MC = 94
|
||||
};
|
||||
|
||||
enum NSPS_VelShape
|
||||
{
|
||||
NSPS_VS_POINT = 1,
|
||||
NSPS_VS_BOX,
|
||||
NSPS_VS_SPHERE,
|
||||
NSPS_VS_BLOB
|
||||
};
|
||||
|
||||
/* Genshape used in ns_set_ps_genshape
|
||||
* NOTE: The following are in the ns.ps file but
|
||||
* are not listed in the .fgd file. Use
|
||||
* at your own risk!
|
||||
* Line, Triangle, Plane, Cylinder,
|
||||
* Cone, Disc, Rectangle and None
|
||||
*/
|
||||
enum NSPS_GenShape
|
||||
{
|
||||
NSPS_GS_POINT = 0,
|
||||
NSPS_GS_LINE,
|
||||
NSPS_GS_TRIANGLE,
|
||||
NSPS_GS_PLANE,
|
||||
NSPS_GS_BOX,
|
||||
NSPS_GS_CYLINDER,
|
||||
NSPS_GS_CONE,
|
||||
NSPS_GS_BLOB,
|
||||
NSPS_GS_DISC,
|
||||
NSPS_GS_RECTANGLE,
|
||||
NSPS_GS_NONE
|
||||
};
|
||||
enum NSPS_RenderMode
|
||||
{
|
||||
NSPS_R_NORMAL = 0,
|
||||
NSPS_R_TRANSCOLOR,
|
||||
NSPS_R_TRANSTEXTURE,
|
||||
NSPS_R_GLOW,
|
||||
NSPS_R_TRANSALPHA,
|
||||
NSPS_R_ADDITIVE
|
||||
};
|
||||
enum NSPS_Flags
|
||||
{
|
||||
NSPS_FL_START_ON = 1,
|
||||
NSPS_FL_PARTICLE_DENSITY = 2,
|
||||
NSPS_FL_FADE_IN = 4,
|
||||
NSPS_FL_FADE_OUT = 8,
|
||||
NSPS_FL_USE_GRAVITY = 16,
|
||||
NSPS_FL_USE_TRI = 32,
|
||||
NSPS_FL_CONSTRAIN_PITCH = 128,
|
||||
NSPS_FL_COLLIDE = 256,
|
||||
NSPS_FL_HI_DETAIL = 512,
|
||||
NSPS_FL_FACE_UP = 1024
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
/* nVault functions
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _nvault_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _nvault_included
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib nvault
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib nvault
|
||||
#endif
|
||||
#else
|
||||
#pragma library nvault
|
||||
#endif
|
||||
|
||||
/* All timestamps are in UNIX epoch form. */
|
||||
|
||||
/* Opens a vault by name (such as "myvault")
|
||||
* Returns a vault id, INVALID_HANDLE otherwise (-1)
|
||||
*/
|
||||
native nvault_open(const name[]);
|
||||
|
||||
/* Gets a vault value by returning an int
|
||||
* setting a byref float or setting a string + maxlength
|
||||
*/
|
||||
native nvault_get(vault, const key[], {Float,_}:...);
|
||||
|
||||
/* Looks up a vault value for full information
|
||||
* Returns 0 if the entry is not found
|
||||
*/
|
||||
native nvault_lookup(vault, const key[], value[], maxlen, ×tamp);
|
||||
|
||||
/* Sets a vault value (with current timestamp) */
|
||||
native nvault_set(vault, const key[], const value[]);
|
||||
|
||||
/* Sets a permanent vault value (no timestamp) */
|
||||
native nvault_pset(vault, const key[], const value[]);
|
||||
|
||||
/* Prunes the vault for entries that are within the given timestamps.
|
||||
* This will not erase values set with pset
|
||||
*/
|
||||
native nvault_prune(vault, start, end);
|
||||
|
||||
/* Closes a vault */
|
||||
native nvault_close(vault);
|
||||
|
||||
/* Removes a key from the vault */
|
||||
native nvault_remove(vault, const key[]);
|
||||
|
||||
/* "Touches" a key to update its timestamp value.
|
||||
* If stamp is -1 (default), it will use the current time.
|
||||
* Like the unix command "touch," it will create an empty key
|
||||
* if the value does not exist.
|
||||
*/
|
||||
native nvault_touch(vault, const key[], timestamp=-1);
|
||||
@@ -0,0 +1,134 @@
|
||||
/* Regular Expression API
|
||||
* (C)2004 by David "BAILOPAN" Anderson
|
||||
* Licensed under the GNU General Public License.
|
||||
* No warranties of any kind.
|
||||
*/
|
||||
|
||||
#if defined _regex_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _regex_included
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib regex
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib regex
|
||||
#endif
|
||||
#else
|
||||
#pragma library regex
|
||||
#endif
|
||||
|
||||
enum Regex
|
||||
{
|
||||
REGEX_MATCH_FAIL = -2,
|
||||
REGEX_PATTERN_FAIL,
|
||||
REGEX_NO_MATCH,
|
||||
REGEX_OK
|
||||
};
|
||||
|
||||
/**
|
||||
* Precompile a regular expression. Use this if you intend on using the
|
||||
* same expression multiple times. Pass the regex handle returned here to
|
||||
* regex_match_c to check for matches.
|
||||
*
|
||||
* @param pattern The regular expression pattern.
|
||||
* @param errcode Error code encountered, if applicable.
|
||||
* @param error Error message encountered, if applicable.
|
||||
* @param maxLen Maximum string length of the error buffer.
|
||||
* @param flags General flags for the regular expression.
|
||||
* i = Ignore case
|
||||
* m = Multilines (affects ^ and $ so that they match
|
||||
* the start/end of a line rather than matching the
|
||||
* start/end of the string).
|
||||
* s = Single line (affects . so that it matches any character,
|
||||
* even new line characters).
|
||||
* x = Pattern extension (ignore whitespace and # comments).
|
||||
*
|
||||
* @return -1 on error in the pattern, > valid regex handle (> 0) on success.
|
||||
*
|
||||
* @note This handle is automatically freed on map change. However,
|
||||
* if you are completely done with it before then, you should
|
||||
* call regex_free on this handle.
|
||||
*/
|
||||
native Regex:regex_compile(const pattern[], &ret, error[], maxLen, const flags[]="");
|
||||
|
||||
/**
|
||||
* Matches a string against a pre-compiled regular expression pattern.
|
||||
*
|
||||
*
|
||||
* @param pattern The regular expression pattern.
|
||||
* @param string The string to check.
|
||||
* @param ret Error code, if applicable, or number of results on success.
|
||||
*
|
||||
* @return -2 = Matching error (error code is stored in ret)
|
||||
* 0 = No match.
|
||||
* >1 = Number of results.
|
||||
*
|
||||
* @note You should free the returned handle (with regex_free())
|
||||
* when you are done with this pattern.
|
||||
*
|
||||
* @note Use the regex handle passed to this function to extract
|
||||
* matches with regex_substr().
|
||||
*/
|
||||
native regex_match_c(const string[], Regex:pattern, &ret);
|
||||
|
||||
/**
|
||||
* Matches a string against a regular expression pattern.
|
||||
*
|
||||
* @note If you intend on using the same regular expression pattern
|
||||
* multiple times, consider using regex_compile and regex_match_c
|
||||
* instead of making this function reparse the expression each time.
|
||||
*
|
||||
* @param string The string to check.
|
||||
* @param pattern The regular expression pattern.
|
||||
* @param ret Error code, or result state of the match.
|
||||
* @param error Error message, if applicable.
|
||||
* @param maxLen Maximum length of the error buffer.
|
||||
* @param flags General flags for the regular expression.
|
||||
* i = Ignore case
|
||||
* m = Multilines (affects ^ and $ so that they match
|
||||
* the start/end of a line rather than matching the
|
||||
* start/end of the string).
|
||||
* s = Single line (affects . so that it matches any character,
|
||||
* even new line characters).
|
||||
* x = Pattern extension (ignore whitespace and # comments).
|
||||
*
|
||||
* @return -2 = Matching error (error code is stored in ret)
|
||||
* -1 = Error in pattern (error message and offset # in error and ret)
|
||||
* 0 = No match.
|
||||
* >1 = Handle for getting more information (via regex_substr)
|
||||
*
|
||||
* @note Flags only exist in amxmodx 1.8 and later.
|
||||
* @note You should free the returned handle (with regex_free())
|
||||
* when you are done extracting all of the substrings.
|
||||
*/
|
||||
native Regex:regex_match(const string[], const pattern[], &ret, error[], maxLen, const flags[] = "");
|
||||
|
||||
/**
|
||||
* Returns a matched substring from a regex handle.
|
||||
* Substring ids start at 0 and end at ret-1, where ret is from the corresponding
|
||||
* regex_match or regex_match_c function call.
|
||||
*
|
||||
* @param id The regex handle to extract data from.
|
||||
* @param str_id The index of the expression to get - starts at 0, and ends at ret - 1.
|
||||
* @param buffer The buffer to set to the matching substring.
|
||||
* @param maxLen The maximum string length of the buffer.
|
||||
*
|
||||
*/
|
||||
native regex_substr(Regex:id, str_id, buffer[], maxLen);
|
||||
|
||||
/**
|
||||
* Frees the memory associated with a regex result, and sets the handle to 0.
|
||||
* This must be called on all results from regex_match() when you are done extracting
|
||||
* the results with regex_substr().
|
||||
* The results of regex_compile() (and subsequently, regex_match_c()) only need to be freed
|
||||
* when you are done using the pattern.
|
||||
*
|
||||
*
|
||||
* @param id The regex handle to free.
|
||||
*
|
||||
* @noreturn
|
||||
*
|
||||
* @note Do not use the handle again after freeing it!
|
||||
*/
|
||||
native regex_free(&Regex:id);
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
*
|
||||
* AMX Mod X Module
|
||||
* Basic Socket Functions
|
||||
*
|
||||
* Codebase from Ivan, -g-s-ivan@web.de (AMX 0.9.3)
|
||||
* Modification by Olaf Reusch, kenterfie@hlsw.de (AMXX 0.16, AMX 0.96)
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined _socket_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _socket_included
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib sockets
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib sockets
|
||||
#endif
|
||||
#else
|
||||
#pragma library socket
|
||||
#endif
|
||||
|
||||
// Use SOCKET_TCP for TCP Socket connections
|
||||
|
||||
#define SOCKET_TCP 1
|
||||
|
||||
// Use SOCKET_UDP for UDP Socket connections
|
||||
|
||||
#define SOCKET_UDP 2
|
||||
|
||||
/* Opens a new connection to hostname:port via protocol (either SOCKET_TCP or SOCKET_UDP),
|
||||
* returns a socket (positive) or negative or zero on error.
|
||||
* States of error:
|
||||
* 0 - no error
|
||||
* 1 - error while creating socket
|
||||
* 2 - couldn't resolve hostname
|
||||
* 3 - couldn't connect to given hostname:port
|
||||
*/
|
||||
|
||||
native socket_open(const _hostname[], _port, _protocol = SOCKET_TCP, &_error);
|
||||
|
||||
/* Closes a Socket */
|
||||
|
||||
native socket_close(_socket);
|
||||
|
||||
/* Recieves Data to string with the given length */
|
||||
|
||||
native socket_recv(_socket, _data[], _length);
|
||||
|
||||
/* Sends data to the Socket */
|
||||
|
||||
native socket_send(_socket, const _data[], _length);
|
||||
|
||||
/* Same as socket_send but Data can contain null bytes */
|
||||
|
||||
native socket_send2(_socket, const _data[], _length);
|
||||
|
||||
/* This function will return true if the state (buffer content) have changed within the last recieve or
|
||||
* the timeout, where timeout is a value in µSeconds, (1 sec =1000000 µsec).
|
||||
* Use to check if new data is in your socket. */
|
||||
|
||||
native socket_change(_socket, _timeout=100000);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user