EventScripts Forums
Mattie's EventScripts and Source Forums
Script Categories
16000 (15) abilities (15) addon (72) addons (17) admin (354) admins (23) advert (29) adverts (27) afk (18) alerts (12) ammo (25) anti (21) armor (11) auth (16) automatic (15) awp (29) ban (24) bank (11) ba_jail (35) bhop (46) block (27) bomb (48) bonus (25) boost (22) bot (36) bot-management (20) bots (24) bullet (13) bunnyhop (19) Buy (27) buymenu (13) c4 (12) cash (77) Change (14) chat (77) cheat (15) clan (17) classes (24) color (30) colors (20) command (23) commands (21) config (28) configurable (11) connect (58) counter (12) Counter-Strike-Source (20) CS:S (20) css (3380) custom (13) Damage (49) database (14) dead (19) Deagle (11) death (20) deathmatch (79) deathrun (17) deutsch (15) dice (12) disconnect (26) Dissolve (12) dm (24) dod:s (11) dods (501) download (13) easy (26) effect (14) effects (126) English (16) entity (24) est (12) es_tools (14) Eventscript (12) exploit (11) flashbang (27) français (104) french (36) fun (312) funny (18) Gabeee (11) game (12) gamemode (11) gameplay (175) German (11) give (22) gravity (16) grenade (28) grenades (32) gun (16) GunGame (31) GunGame5 (11) guns (20) Hack (16) headshot (37) health (72) hegrenade (15) help (11) hit (13) hl2dm (442) HP (26) hudhint (13) hun (17) hungarian (26) info (52) information (19) invisible (11) IP (13) jail (81) jailbreak (14) join (47) jump (19) kick (25) kill (51) kills (24) knife (66) leveling (38) LnD (14) lol (11) magyar (47) management (14) manager (11) mani (16) map (32) map-management (26) maps (17) match (21) Memphis-84 (13) menu (144) message (34) messaging (52) minecraft (12) mod (121) model (18) models (33) modye (16) money (50) motd (13) music (32) mute (20) nades (20) name (15) new (13) noblock (54) orangebox (23) player (49) player-management (31) player-tracking (28) popup (72) prop (13) propmenu (14) props (34) protect (12) protection (32) punish (11) punishment (51) python (80) quake (32) QuakeSounds (12) race (13) races (20) radio (30) random (47) rank (42) rates (15) rcon (12) realism (22) Regeln (23) respawn (69) restrict (41) round (26) rpg (32) rules (63) say (17) score (16) scout (29) Script (25) script-helper (25) scriptpack (33) sdk (171) server (61) server-tools (42) shop (12) showdamage (20) silly (31) simple (33) skin (17) skins (34) slay (13) soccer (14) sound (67) sounds (107) source (14) spanish (18) spawn (82) speed (26) statistics (14) stats (57) status (15) Steam (11) STEAMID (30) Superhero (15) surf (41) Team (30) team-balance (14) teleport (17) text (19) TF2 (142) time (23) timer (15) tools (15) tracers (19) triggers (11) uedi (17) uses_auth (18) vip (23) vote (39) voting (22) war (25) Warcraft (12) warcraft-source (20) wc3 (14) wcs (47) wcs:Python (32) weapon (88) weapons (120) web (16) welcome (14) wuerfeln (11) zm (26) zombie (100) zombiemod (55) zombies (12)
Script Authors
*XYZ*SaYnt (12) .:MiB:. (20) .:modye:. (14) .eMko* (6) 101satoon101 (12) 3R10N (24) 4u571n91 (5) 7355608 (9) Absolute (9) Ace Rimmer (40) adminc (5) adyshor37 (5) Adz (8) AgathaKnuppelkuh (8) aidden (8) ajax (5) ak_47 (6) Al3c Tr3v3lyan (6) allstareng (5) ashbash1987 (9) ATAMAH (7) Ayuto (5) aznone (5) B00M (5) BackRaw (41) BFH_RedBull (8) bigfabi (8) Bioko (10) blackshoxx (9) Blade (10) bladesback (13) bobdole (11) bodzsar1 (8) bonbon (36) Brainsucker (32) cagemonkey (8) capo azzlack (7) captain master (6) carbon-14 (10) CaskioUTF (5) cbirou (15) CbRRR (16) ChaCaLz2psy4 (5) CharlesT (5) Chris1888 (5) Chrisber (5) chrismrulz (10) Chun (6) cladiron (10) clipz934 (8) Colster (21) Cookieman8 (7) CrAzD (6) craziest (11) dani12356 (12) DanielB (19) Darkness123 (8) Dave (9) dbozan99 (7) dead man walker (12) deathx9 (5) Deathyy (16) dhack (17) Di[M]aN (12) DJ Fire-Black prod (8) DoCky (31) Don (15) dordtcore (9) DragonFreddo (8) Drassil (5) dretax14 (11) Einlanzers (47) EmbouT (10) emilplov (7) Errant (10) Eun (6) Fantole (10) FMIS (5) Franc1sco (17) freddukes (18) Frequency (6) Fridge (5) Fugi91 (6) Fulmine (5) G4ME (5) GAMEREN2 (8) german9114 (13) GODJonez (40) GoodfellaDeal (5) Hansi (6) Hisoka (6) HitThePipe (7) HOLLDIDAY (24) Icetouch (6) ichthys (25) Im the new guy (14) iNexus (13) infamous1 (9) isivisi (13) ispaine (7) Jackmaster (9) Jeff91 (45) JoeyT2006 (30) Juba_PornBorn (12) jxl180 (11) KDBFame (6) L'In20Cible (11) L.P.H (8) Largo Usagi (10) LnD (14) Lobe (11) loKkdoKk (8) lolo-le-haricot (7) LosNir (5) Lumpi@Work (9) M4rc3L-XCN (7) macshot (7) magyar-oneill (9) Matth (7) Mattie (21) mave1993 (5) MBchrono (15) McFly (20) Medda (5) Memphis-84 (15) Messiah93 (20) Mickyy (5) micmacx (6) minimal42O (5) Mitchell (5) Mixer57 (5) modye (6) Monster_Bitch1 (9) Mordavolt (7) motomoto (20) MrScriptaz (6) mryoung (6) MyTechZone.de (9) Nicolous (23) ojii (31) oliVier (10) Omega68 (6) Omega_K2 (11) Owned|Myself (8) P3N (7) pand3mic (6) parsimba (5) Pascal257 (9) PatPeter (7) PDrop (10) Phaedrus (18) PhantOm Fury (7) phoenix131 (9) pinkyyy -.- (5) pitbull0993 (7) PixelGamer (7) qwern (5) randomknifer (9) Raptor150 (31) Ratzee (6) ReaCtioN2oo9 (6) RedCliff (5) Rennnyyy (17) revolutionfighters (8) RideGuy (12) Rio (9) Roeliekt (6) roof (16) runamagic (13) Ryezin (5) sandking220 (6) Sarcasm_Poisoning (10) saRs| Johnny-5 (13) Schubaal (10) sea212 (5) sega74rus (15) sgt.angel (6) Shad0w (11) ShoTaXx# (7) sicilia (7) sicman_adrian (22) skillz92 (7) sn4k3 (18) Snake12 (7) snake38 (10) sonicsight (7) SpeedFreak (9) spoonman184 (12) stabby (22) stas (27) Stirni (6) stonedegg (8) Strontium Dog (30) SumGuy14 (25) SuperDave (49) surfteam (5) TaCo (5) TanaToS (17) Tealk (6) teowow (16) TheCheeTaH (27) TheDonFather (5) theresthatguy (6) Tiny Tod (7) tooshkan4uk (8) Totyahun (9) uedi (38) ultimatebuster (6) Undead (25) usernamesaretaken (15) wanted241 (9) Warren (13) westham (6) WhiteAvenger (7) Wonder (14) Wundermaxe (5) X-Mania (5) XE_ManUp (14) xfalcon61 (5) zSweetXz (5) ZZMatty (6) [Cs]Lord_Inferno2 (11) [DAP]Kickbutt (5) [NATO]Hunter (28) ||Wolf|| (10)
Search

Post new topic Reply to topic
Author Message
User avatar
Site Administrator
Site Administrator
Profile

Posts: 7640
Location:
At Work
 
New postPosted: 2005-06-10, 4:07 pm 
   Post subject: Old EventScripts Plugin Documentation and News

Mattie's EventScripts
Download: http://mattie.info/cs.
Platforms: Windows, Linux

Description: EventScripts is a Counter-Strike: Source add-on that will automatically execute a server config file whenever a game event occurs. For example, you can create a "round_end.cfg" file in your cstrike/cfg directory and it will execute when the round is over. For a full list of possible events, check your server's *.res files. EventScripts also supports in-line event variable expansion, extended event variables, server variables, user variables, message logging, player message broadcasting, simple file manipulation, and conditional expressions.

Installation:
    Windows
      1. Download mattie_eventscripts.zip from http://mattie.info/cs/
      2. Extract the files from the zip file into your cstrike/addons folder. Be sure "mattie_eventscripts.dll", "mattie_eventscripts.vdf", and "mattie_eventscripts.res" are in this folder.
      3. Start-up your server and, by default, EventScripts will work as described above and below.
    Linux
      1. Download mattie_eventscripts.tgz from http://mattie.info/cs/
      2. Extract the files from the tgz file into your cstrike/addons folder. By default, the tar will expand correctly if you extract from within your dedicated server directory (parent of cstrike). Be sure "mattie_eventscripts_i486.so", "mattie_eventscripts.vdf", and "mattie_eventscripts.res" are in your cstrike/addons folder.
      3. Start-up your server and, by default, EventScripts will work as described above and below.
Variables:
    * mattie_eventscripts 1
    Enables (1) or disables (0) EventScript triggers
    * eventscripts_noisy 0
    Enables (1) or disables (0) EventScript triggers for very common events like "player_footstep", "bullet_impact", "weapon_reload", etc.
    * eventscripts_debug 0
    Enables (1) or disables (0) EventScript spamming the server console with debug output. Will slow the server down, so only activate if you're trying to troubleshoot something.
    * eventscripts_subdirectory ""
    Allows users to change the directory where you store your event scripts. It must be a subdirectory of your cstrike/cfg directory. I recommend setting this to "events" (i.e. it'll point at cfg/events). You'll want to set this early in your autoexec.cfg.
    * eventscripts_datadirectory "cfg"
    Allows users to change the directory where keygroup data files are stored. It must be a subdirectory of your cstrike directory and it is highly recommended that you do not change it. This variable exists for those people who must change it due to situations beyond their control.
    * eventscripts_cmdline <server command-line>
    Read-only variable that just captures the server's command-line at start-up. Useful for diagnostics purposes.
    * eventscripts_timeformat "%Y-%m-%d %H:%M:%S (%z)"
    This is the format of the date/time provided by es_gettimestring. Follows/uses the format specifiers of strftime(): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strftime.2c_.wcsftime.asp
    * eventscripts_currentmap <currentmap>
    Read-only variable that just stores the name of the current map.
    * eventscripts_cflags 875
    Warning: Do not change this value unless instructed to do so. It is used for internal handling of money management for CSS only. This variable is provided such that the es_getmoney command won't require a re-release when Valve changes things.
Commands:
    * eventscripts_version
    Outputs the version of EventScripts that you have loaded. New in v0.8.0: This also works from the client console without rcon access.
    * eventscripts_register [subdirectory]
    Allows you to register a subdirectory underneath your eventscripts_subdirectory that contains a pack of scripts to be handled as a group. If you do not provide a one-word directory name, calling this function will list all active script packs. (Triggers es_eventscripts_register event after registration.)
    * eventscripts_unregister [subdirectory]
    Allows you to unregister a subdirectory underneath your eventscripts_subdirectory that contains a pack of scripts to be handled as a group. If you do not provide a one-word directory name, calling this function will list all active script packs. This effectively 'disables' a script pack until you run eventscripts_register again. (Triggers es_eventscripts_unregister event before unregistration.)
    * es <command string>
    Executes the command string after it expands all variables in it. (e.g. supports "es exec config.cfg" or "es kickid event_var(userid)".)
    * es_msg [color] <text/variable message>
    Sends a message to all players. If color is specified, it must be "#lightgreen" or "#green". EventScripts will expand any variables it finds. (Equivalent to running "es es_xmsg MyMessage".)
    * es_xmsg [color] <text-only message>
    Sends a message to all players. If color is specified, it must be "#lightgreen" or "#green". No variables are expanded as it is assumed everything is already perfect.
    * es_tell <userid> [color] <text/variable message>
    Sends a message to a single player by userid. If color is specified, it must be "#lightgreen" or "#green". EventScripts will expand any variables it finds. (Equivalent to running "es es_xtell userid MyMessage".)
    * es_xtell <userid> [color] <text-only message>
    Sends a message to a single player by userid. If color is specified, it must be "#lightgreen" or "#green". No variables are expanded as it is assumed everything is already perfect.
    * es_log <text/variable message>
    Logs a message to the server log. EventScripts will expand any variables it finds. (Equivalent to running "es es_xmsg MyMessage".)
    * es_xlog <text-only message>
    Logs a message to the server log. No variables are expanded as it is assumed everything is already perfect.
    * es_centermsg <text/variable message>
    Displays a white message in the center of the screen for all players. EventScripts will expand any variables it finds. (Equivalent to running "es es_xcentermsg MyMessage".)
    * es_xcentermsg <text-only message>
    Displays a white message in the center of the screen for all players. No variables are expanded as it is assumed everything is already perfect.
    * es_setinfo <variable> <value>
    Creates a custom server variable and sets its value to the value listed. EventScripts will expand any variables it finds. (Equivalent to running "es es_xsetinfo var val".) After creation, you can use the variable just like a server variable (e.g. via server_var()). Behaves just like Valve's "setinfo" command.
    * es_xsetinfo <variable> <value>
    Creates a custom server variable and sets its value to the value listed. No variables are expanded as it is assumed everything is already perfect. After creation, you can use the variable just like a server variable (e.g. via server_var()). Behaves just like Valve's "setinfo" (and "es_xsetinfo" is even accessible as "setinfo" on Linux since Valve wouldn't support setinfo on Linux)
    * es_format <variable> <format-string> [token1] [token2] [token3] [...] [token9]
    Formats a string according to the format-string and stores it into the variable command. EventScripts will expand any variables it finds. (Equivalent to running "es es_xformat".)
    * es_xformat <variable> <format-string> [token1] [token2] [token3] [...] [token9]
    Formats a string according to the format-string and stores it into the variable command. No variables are expanded as it is assumed everything is already perfect.
    * es_token <variable> <string> <token#> [seperator-character]
    Sets a variable to the part of the string corresponding with "token#". It splits up the string according to the seperator character which defaults to space. EventScripts will expand any variables it finds. (Equivalent to running "es es_xtoken".)
    * es_xtoken <variable> <string> <token#> [seperator-character]
    Sets a variable to the part of the string corresponding with "token#". It splits up the string according to the seperator character which defaults to space. No variables are expanded as it is assumed everything is already perfect.
    * es_math <variable> <operator> <value>
    Performs the math operator (+, -, /, *,add, subtract, multiply, or divide) on variable and value and stores the result in variable. EventScripts will expand any variables it finds. (Equivalent to running "es es_xformat".)
    * es_xmath <variable> <operator> <value>
    Performs the math operator (=, +, -, /, *, set, add, subtract, multiply, or divide) on variable and value and stores the result in variable. No variables are expanded as it is assumed everything is already perfect.
    * if (token1 equalto token2) then commandstring
    In addition to "equalto", it also supports "notequalto", "lessthan", and "greaterthan". token1 and token2 above must each be a single word, quoted string, or number. EventScripts will expand any variables it finds. (Equivalent to calling "es es_xif".)
    * es_xif (token1 equalto token2) then commandstring
    In addition to "equalto", it also supports "notequalto", "lessthan", and "greaterthan". token1 and token2 above must each be a single word, quoted string, or number. No variables are expanded as it is assumed everything is already perfect.
    * es_delayed <seconds> <command-string>
    Will execute the command-string seconds later. All scheduled es_delayed commands are reset at the beginning of each map. Special thanks to Cr3V3TT3 for this one. EventScripts will expand any variables it finds.
    * es_xdelayed <seconds> <command-string>
    Will execute the command-string seconds later. All scheduled es_delayed commands are reset at the beginning of each map. No variables are expanded as it is assumed everything is already perfect.
    * es_gettime <variable>
    Stores the current seconds since January 1, 1970 in variable. Always growing value. EventScripts will expand any variables it finds.
    * es_xgettime <variable>
    Stores the current seconds since January 1, 1970 in variable. Always growing value. No variables are expanded as it is assumed everything is already perfect.
    * es_copy <variable1> <variable2>
    Copies the value of variable2 into variable1. This is handy to help you indirectly access variables. (E.g.: "es_copy myvar sv_gravity" might write 800 into the myvar console variable). EventScripts will expand any variables it finds.
    * es_xcopy <variable1> <variable2>
    Copies the value of variable2 into variable1. This is handy to help you indirectly access variables. (E.g.: "es_xcopy myvar sv_gravity" might write 800 into the myvar console variable). No variables are expanded as it is assumed everything is already perfect.
    * es_getuserid <variable> <identifying info>
    This follows an algorithm similar to Mani's commands. Allows you to lookup a user's userid by providing a userid, steamid, full username, or partial username. Only returns the first match. EventScripts will expand any variables it finds.
    * es_xgetuserid <variable> <identifying info>
    This follows an algorithm similar to Mani's commands. Allows you to lookup a user's userid by providing a userid, steamid, full username, or partial username. Only returns the first match. No variables are expanded as it is assumed everything is already perfect.
    * es_getmoney <variable> <userid>
    Looks up the money of the player specified by userid and stores it in the variable. EventScripts will expand any variables it finds. Note: This command is dependent on eventscripts_cflags variable and might break on a Valve update.
    * es_xgetmoney <variable> <userid> <varname>
    Looks up the money of the player specified by userid and stores it in the variable. No variables are expanded as it is assumed everything is already perfect. Note: This command is dependent on eventscripts_cflags variable and might break on a Valve update.
    * es_rand <variable> <min> <max>
    Courtesy of Cr3V3TT3. Generates a random integer within the min and max range and stores it into the variable. EventScripts will expand any variables it finds.
    * es_xrand <variable> <min> <max>
    Generates a random integer within the min and max range and stores it into the variable. No variables are expanded as it is assumed everything is already perfect.
    * es_string <variable> replace <text> <with text>
    * es_xstring <variable> replace <text> <with text>
    Within the variable provided, replaces all instances of text with with text. A search and replace function. (Note that es_string currently only supports the 'replace' operator.) [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_getplayercount <variable> [team#]
    * es_xgetplayercount <variable> [team#]
    Stores the count of players on the server into a variable. Optionally, a team can be specified and the count of that team will be returned. This function returns -1 if an error occurs (e.g. you specify a non-existent team index). (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getclientvar <variable> <userid> <varname>
    * es_xgetclientvar <variable> <userid> <varname>
    Reads a console variable from a given player and stores its value in the variable. Please note that some client console variables are not accessible to the server. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupcreate <groupname>
    * es_xkeygroupcreate <groupname>
    Creates an internal keygroup that can be used for storing other keys and values. These groups can be written to file in Valve's KeyValues format (see es_keygroupsave). It's recommended that you call es_keygroupdelete when you are done with a group so that the memory can be freed on the server. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupdelete <groupname>
    * es_xkeygroupdelete <groupname>
    Deletes a keygroup from memory so that it's not leaked. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygrouplist <groupname>
    * es_xkeygrouplist <groupname>
    Prints to console a list of all keygroups currently in memory on the server. (Useful for script writers, but probably doesn't work over rcon.) (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupsave <groupname> [path]
    * es_xkeygroupsave <groupname> [path]
    Saves a keygroup from memory to a text file based on the group's name (e.g. es_groupname_db.txt). Optionally, a path can be provided. If a path is not specified, it is placed in your eventscripts_subdirectory. If a path is specified, it will look under eventscripts_datadirectory. It is recommended that you do not change eventscripts_datadirectory because it might break script packs.. The file uses Valve's KeyValues text file structure. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygroupload <groupname> [path]
    * es_xkeygroupload <groupname> [path]
    Loads a keygroup from a text file to memory. Optionally, a path can be provided. If a path is not specified, it is loaded from your eventscripts_subdirectory. If a path is specified, it will look relative to the eventscripts_datadirectory. It is recommended that you do not change eventscripts_datadirectory because it might break script packs.. The file uses Valve's KeyValues text file structure. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keycreate [groupname] <key>
    * es_xkeycreate [groupname] <key>
    Creates a key that can be free-floating or associated with a keygroup (so its values can be saved to a file). Keys created this way must be deleted with es_keydelete when you no longer need them (to prevent leaking memory on the server). (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keydelete [groupname] <key>
    * es_xkeydelete [groupname] <key>
    Deletes a key created with es_keycreate. If a group is specified, it deletes the key from that group, otherwise it deletes the key from the global free-floating keys. Keys created with es_keycreate must be deleted with es_keydelete when you no longer need them (to prevent leaking memory on the server). (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keylist [groupname]
    * es_xkeylist [groupname]
    Lists all keys in memory that are not associated with a group. If a group name is specified, it will list all keys and all values from that keygroup. (Useful for script writers, but probably doesn't work over rcon.) (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keysetvalue [groupname] <key> <valuename> <value>
    * es_xkeysetvalue [groupname] <key> <valuename> <value>
    Sets/creates a value named by valuename in the given key (and, optionally, keygroup). The value can be retrieved with es_keygetvalue. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_keygetvalue <variable> [groupname] <key> <valuename>
    * es_xkeygetvalue <variable> [groupname] <key> <valuename>
    Looks up the value from valuename from key and stores it in the server variable you probide in variable. These values can be set with es_keysetvalue. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_foreachkey <variable> in <groupname> <command>
    * es_xforeachkey <variable> in <groupname> <command>
    EXPERIMENTAL: This command will loop through each key in the specified keygroup. Each iteration through the loop, it will set the specified variable to the name of the current key from the keygroup. It will then execute the command-string. It will repeat this for all keys in the keygroup. Note: Please be careful using complex commands with es_foreachkey; the server might dramatically slow down and/or stop accepting commands until the command queue is addressed. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getlivingplayercount <variable> [team number]
    * es_xgetlivingplayercount <variable> [team number]
    Similar to es_getplayercount, but only counts players that are not dead. Note: Valve takes a second or two to register a player as fully dead, so this value is not so reliable in player_death.cfg, etc. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_gettimestring <variable>
    * es_xgettimestring <variable>
    Returns (in the variable you provide), the current server time in string form. It formats the text according to the eventscripts_timeformat variable. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayerlocation <variable x> <variable y> <variable z> <userid>
    * es_xgetplayerlocation <variable x> <variable y> <variable z> <userid>
    Stores a player's current x, y, and z coordinates in the variables you provide. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayermovement <variable forward> <variable side> <variable up> <userid>
    * es_xgetplayermovement <variable forward> <variable side> <variable up> <userid>
    Stores a player's current forward, side, and upwards movement in the variables provided. These floating point values typically reflect the player's desired direction (i.e. the keys they're holding down) and likely isn't affected by that player's environment (falling, walking into a wall, bullets, etc).(es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_isbot <variable> <userid>
    * es_xisbot <variable> <userid>
    Sets the provided variable to 1 if the userid belongs to a bot, 0 if it belongs to a legit player, or -1 if it's an invalid userid. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_cexec <userid> <command-string>
    * es_xcexec <userid> <command-string>
    Forces the user specified by userid to execute the console command-string provided. Similar to the cexec commands of popular plugins but only supports a single userid (not entire teams). (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayername <variable-name> <userid>
    * es_xgetplayername <variable-name> <userid>
    Stores the user's name in the variable specified. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayersteamid <variable-name> <userid>
    * es_xgetplayersteamid <variable-name> <userid>
    Stores the user's steamid in the variable specified. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayerteam <variable-name> <userid>
    * es_xgetplayerteam <variable-name> <userid>
    Stores the user's team index number in the variable specified. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_loadevents <path-to-res-file>
    * es_xloadevents <path-to-res-file>
    Loads the specified .res file and registers EventScripts as a listener for those events. Useful for other plugin authors who wish to fire custom events that EventScripts can trigger on. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * esnq <string>
    Use with caution. Behaves just like "es" except that it will only place quotation marks around server_var() and event_var() values if there is a semicolon inside them.
Detailed Description:
Quote:
EventScripts allows you to create config files that get run whenever a server event fires. In addition, EventScripts supports event variable expansion, message broadcasts and conditional statements. You can download the latest plugin and example scripts from my website here:
http://mattie.info/cs

Event Scripts
There are a lot of uses for this plugin! I believe I've only scratched the surface in my examples. I created the plugin so I could reset mp_freezetime automatically when maps like fy_poolday_reunion tinker with it. You can use it for many things-- text announcements on round start, or even playing sounds for certain events (when combined with a plugin like Mani's). Any server command you have available is fair game for the cfg files.

It works like this: you create a config file in your cfg directory named after a particular server event. For example, cstrike/cfg/player_death.cfg. Inside the configuration files, you place any code you'd like to run, just as if it was a normal configuration file. If you want, you can take advantage of EventScripts advanced features (see below), but some things can be accomplished without it. For example, I created a round_end.cfg that did the following:
ES:
    mp_freezetime 6
I did this because I was tired of fy_poolday_reunion_lite switching the freezetime on the server. When combined with other people's plugins, you can do some handy things, too. For example, if you wanted to ensure Mani's plugin did a balance at the end of every round (I believe it can do this, anyway), you could create a round_end.cfg file like this:
ES:
    ma_balance
. This would basically run an "ma_balance" upon every round end. If you really wanted to get creative, you could do things like make the sv_gravity decrease once the bomb has been planted and resets it to normal when the round ends.

For more advanced customizations, though, keep reading.

Event Variable Expansion
If a script is run as an event (e.g. player_death.cfg), EventScripts will now provide the event information for you to access. To use this variable expansion, simply prefix any typical cfg line with "es " and place event_var(variable) in the places you want it, where variable is the the name used for the field you want (see modevents.res, serverevents.res, or gameevents.res-- e.g. some common fields are "userid", "headshot", "weapon", etc.).
    es <command string>
    Executes the command string after it expands all variables in it. (e.g. supports "es exec config.cfg" or "es kickid event_var(userid)".)
For example, look at the sample bullet_impact.cfg I provided for download:
ES:
    // EventScripts v0.2.0 Example
    // Only works if you have eventscripts_noisy set to 1
    es say Player event_var(userid) hit x:event_var(x), y:event_var(y), and z:event_var(z).
What's the x, y, and z you ask? It's the place the bullet hit. Let's look at the description of "bullet_impact" from cstrike's modevents.res file:
Code:

   "bullet_impact"
   {
      "userid"   "short"
      "x"      "float"
      "y"      "float"
      "z"      "float"
   }

Since we used "es", EventScripts will look for all the "event_var()" portions and replace those with the appropriate values provided by the game. All those values are listed in the resource files I mentioned at the top of the page. This particular script would cause the console to say things like the following whenever a player shoots a wall:
Code:
Console: Player 3 hit x:333.1212, y:445.3321, z:233.223.

(Note: Keep your eyes on the 'variable expansion' possibilities for the EventScripts plugin. Future releases will give you access to nested variables, server variables, and your own variables. These last are not available in EventScripts 0.2.0, but I hope to provide them soon.)

Server Variable Expansion
As of EventScripts v0.5.0, EventScripts can perform in-line expansion for server variables as well. To accomplish this, you'd use the server_var(variable) text wherever you want the server variable expanded. For example, you could place the following in player_jump.cfg:
ES:
    // EventScripts v0.5.0
    es_tell event_var(userid) You're jumping around and the gravity is server_var(sv_gravity)!
and the server would send you this message whenever you jumped:
Quote:
You're jumping around and the gravity is 800 !
You can use server variables in conditions and in scripts just as you would event variables. In addition, since these don't require an event to run, you could even expand the variables by typing directly into the console if you ever wished to do so.

User Variable Expansion
As of EventScripts v0.5.0, EventScripts can perform in-line expansion for user variables. Source/Valve treats these pretty much like server variables, and so does EventScripts. To accomplish this, you'd use the server_var(variable) text wherever you want the user variable expanded. User variables have to be created via Valve's 'setinfo' command, but they support handy things like incrementing (via the 'incrementvar' command) and decremating ('decrementvar'). For example, if you had previously run "setinfo deaths 0" in your autoexec.cfg, you could place the following in player_death.cfg to count server deaths since last restart:
ES:
    // EventScripts v0.5.0
    incrementvar deaths 0 99999 1
    es_msg There have been server_var(deaths) player deaths since the server was last booted.

The server in this case would output something along these lines whenever someone died, where 23 is the number of deaths that day:
Quote:
There have been 23 player deaths since the server was last booted.

You can use user variables in conditions and in scripts just as you would event and server variables. In addition, since these don't require an event to run, you could even expand the variables by typing directly into the console if you ever wished to do so.

In EventScripts v0.7.5, support was added to copy one variable to another without necessarily requiring the use of "server_var" commands. For example:
ES:
    // EventScripts v0.7.5
    es_setinfo myvar 0
    es_xcopy myvar sv_gravity
would store the server's gravity value into your new variable "myvar".

The above was already achievable before v0.7.5 using server_var(). What this command is really handy for is for indirect access to variables. In lieu of nested variables, you could do the following:
ES:
    // EventScripts v0.7.5
    es_xsetinfo myvar 0
    es_xsetinfo varname sv_gravity
    es_copy myvar server_var(varname)

This allows you to build-up console variable names with things like es_format and then copy their information into another variable.

Nested Variable Expansion
In EventScripts v0.7.7, support was added such that a nested variable syntax could be used. This allows you to look-up server and event variables indirectly. For example, you could write the following code in a cfg file:
ES:
    // EventScripts v0.7.7
    setinfo varname sv_gravity
    es_msg The gravity is currently server_var(server_var(varname))

The es_msg line would first look-up the variable "varname" and see that it's "sv_gravity". It would then look-up what is stored in the variable named "sv_gravity" and place that in the text of the command. So the output would be:
Quote:
The gravity is currently 800

The above is an unlikely example. Script writers, though, commonly need to build custom variable names. For example, here's a player_death.cfg that assume variables have been created called "playerteamkills_x" for each player:
ES:
    // EventScripts v0.7.7
    setinfo varname 0
    es_format varname "%1_%2" "playerteamkills" event_var(userid)
    es_tell event_var(userid) You have killed server_var(server_var(varname)) team members. Shame on you!

This code uses es_format to build a custom variable name and uses the "server_var(server_var(" syntax to look-up the value indirectly.

Broadcasting Messages
Since you don't want the Console speaking for you all the time via 'say', I've created the some generic/useful message commands. If you have Mattie's EventScripts installed, you can run these from a console. They also work in scripts/config files:
    es_msg [color] <text/variable message>
    Sends a message to all players. If a color is specified, it must be "#green" or "#lightgreen". EventScripts will expand any variables it finds. (Equivalent to running "es es_xmsg MyMessage".)
    es_xmsg [color] <text-only message>
    Sends a message to all players. If a color is specified, it must be "#green" or "#lightgreen".No variables are expanded as it is assumed everything is already perfect.
    es_tell <userid> [color] <text/variable message>
    Sends a message to a single player by userid. If a color is specified, it must be "#green" or "#lightgreen". EventScripts will expand any variables it finds. (Equivalent to running "es es_xtell userid MyMessage".)
    es_xtell <userid> [color] <text-only message>
    Sends a message to a single player by userid. If a color is specified, it must be "#green" or "#lightgreen".No variables are expanded as it is assumed everything is already perfect.
With these, a lot of possibilities open, but here's a simple one I put in player_jump.cfg:
ES:
    // EventScripts v0.2.0 Example
    // The server gets mad at players who jump, for some reason.
    es_tell event_var(userid) Why are you jumping? Stop rocking the server!


One example might be of interest to administrators sick of hackers visiting and spamming the server with name changes. The following player_changename.cfg might help prevent you from having to search logs/commands for the userid or steamid:
ES:
    // EventScripts v0.2.0 Example
    // Handy for those cases where a hacker is rapidly changing their name.
    es_msg USERID event_var(userid) has changed their name from event_var(oldname) to event_var(newname).


If you have any questions, first look at the many examples I posted on my website in the example_eventscripts.zip file.

Version 0.7.6.1 of EventScripts added basic support for optional coloring of es_msg and es_tell messages. At this time, the only supported color codes are "#green" and "#lightgreen". For example, the above player_jump.cfg example might look like this instead:
ES:
    // EventScripts v0.7.6.1 Example
    // The server gets mad at players who jump, for some reason.
    es_tell event_var(userid) #lightgreen "Why are you jumping? Stop rocking the server!"

Note: Due to the special nature of color-coded messages, the broadcast text cannot be as long as a message that does not specify a color (i.e. that uses the default coloring for messages with no "#green" or "#lightgreen"). If you choose to color-code your message double-check to be sure it does not get truncated when sent to the clients.

Also provided in EventScripts v0.7.6.1 is the ability to print messages to the center of all players' screens. Those commands are as follows:
    * es_centermsg <text/variable message>
    Displays a white message in the center of the screen for all players. EventScripts will expand any variables it finds. (Equivalent to running "es es_xcentermsg MyMessage".)
    * es_xcentermsg <text-only message>
    Displays a white message in the center of the screen for all players. No variables are expanded as it is assumed everything is already perfect
This broadcast command has a short duration and cannot be displayed in a color other than white. If you need to extend the message length, try using es_delayed to send a duplicate message again to all clients.

Logging Messages
In v0.5.0, support for logging to the server logs was added. This works much as the commands below do, but is accessed through these console commands:

    es_log <text/variable message>
    Logs a message to the server log. EventScripts will expand any variables it finds. (Equivalent to running "es es_xmsg MyMessage".)
    es_xlog <text-only message>
    Logs a message to the server log. No variables are expanded as it is assumed everything is already perfect.

Conditional Expressions
Last but not least, I added support for if/then statements-- conditional expressions. Here's the syntax:
    if (token1 equalto token2) then commandstring
    In addition to "equalto", it also supports "notequalto", "lessthan", and "greaterthan". token1 and token2 above must each be a single word, quoted string, or number. EventScripts will expand any variables it finds. (Equivalent to calling "es es_xif".)
    es_xif (token1 equalto token2) then commandstring
    In addition to "equalto", it also supports "notequalto", "lessthan", and "greaterthan". token1 and token2 above must each be a single word, quoted string, or number. No variables are expanded as it is assumed everything is already perfect.
So, if we bundle all of this together, we get a really neat player_death.cfg file:
ES:
    // EventScripts v0.2.0 Example
    // Some example player_death commands.
    if (event_var(headshot) equalto 1) then es_tell event_var(attacker) Now THAT was a good shot!
    if (event_var(weapon) equalto "knife") then es_tell event_var(attacker) You humiliated him!

This script will cause a player to get a personalized notification when a player is headshot, as well as when they kill someone with a knife. You can replace the "es_tell" part with anything else you want-- for example, when combined with Mani Admin's plugin, you could play a particular sound. E.g. "[...] then ma_play headshot".

As of EventScripts v0.7.7, the operators lessthan and greaterthan were added. These work just as you'd expect on numbers. Their behavior is undefined when strings are compared, though. Here's an example of its use:
ES:
    // EventScripts v0.7.7
    // never let the gravity get higher than 800
    if (server_var(sv_gravity) greaterthan 800) then sv_gravity 800


Extended Event Variables
In addition to the traditional event variables documented in the *.res files for game events, EventScripts will also set some extended variables for your convenience in your scripts. These are typically prefixed with "es_" to distinguish them from traditional events.

    es_username - Anytime an event is received that provies "userid", EventScripts will also set es_username to the player's name. It's accessible like normal event variables as such: event_var(es_username).

    es_steamid - Anytime an event is received that provides "userid", EventScripts will also set es_steamid to the player's Steam ID. It's accessible like normal event variables as such: event_var(es_steamid).

    es_userteam - Anytime an event is received that provides "userid", EventScripts will also set es_userteam to the player's team number. It's accessible like normal event variables as such: event_var(es_userteam).

    es_userweapon - Anytime an event is received that provides "userid", EventScripts will also set this to the internal name for the weapon (e.g. "weapon_usp").

    es_userarmor - Anytime an event is received that provides "userid", EventScripts will also set this to the user's armor value.

    es_userhealth - Anytime an event is received that provides "userid", EventScripts will also set this to the user's health value.

    es_userdeaths - Anytime an event is received that provides "userid", EventScripts will also set this to the user's death count.

    es_userkills - Anytime an event is received that provides "userid", EventScripts will also set this to the user's kill count.

    es_userdead - Anytime an event is received that provides "userid", EventScripts will also set this to 0 if the user is alive and 1 if the user is dead.

    es_attackername - Anytime an event is received that provides "attacker", EventScripts will also set es_attackername to the attacking player's name. It's accessible like normal event variables as such: event_var(es_attackername).

    es_attackersteamid - Anytime an event is received that provides "attacker", EventScripts will also set es_attackersteamid to the player's Steam ID. It's accessible like normal event variables as such: event_var(es_attackersteamid).

    es_attackerteam - Anytime an event is received that provides "attacker", EventScripts will also set es_attackerteam to the attacking player's team number. It's accessible like normal event variables as such: event_var(es_attackerteam).

    es_attackerweapon - Anytime an event is received that provides "attacker", EventScripts will also set this to the attacking player's internal weapon name (e.g. weapon_usp).

    es_attackerarmor - Anytime an event is received that provides "attacker", EventScripts will also set this to the attacking player's armor value.

    es_attackerhealth - Anytime an event is received that provides "attacker", EventScripts will also set this to the attacking player's health.

    es_attackerdeaths - Anytime an event is received that provides "attacker", EventScripts will also set this to the attacking player's death count.

    es_attackerkills - Anytime an event is received that provides "attacker", EventScripts will also set this to the attacking player's kill count.

    es_attackerdead - Anytime an event is received that provides "attacker", EventScripts will also set this to 0 if the user is alive and 1 if the user is dead.
You can use these extended event variables much like real variables. Typically, they require a particular event variable to already be present (such as userid) before they'd make sense to use. Here's an example player_hurt.cfg that takes advantage of this:
ES:
    // EventScripts v0.3.0 Example
    // player_hurt doesn't trigger when a player is dead. This script is awfully game-changing!
    es_tell event_var(attacker) event_var(es_attackername), you shot user event_var(es_username) with event_var(weapon). They're now at event_var(health)!

This example sends a direct message to the attacker, along the lines of:
Quote:
Mattie, you shot user shro with deagle. They're now at 13!

Ideas for additional extended event variables are welcome.

String Manipulation
Version 0.6.0 introduced a method for formatting strings.
    es_format <variable> <format-string> [token1] [token2] [token3] [...] [token9]
    Formats a string according to the format-string and stores it into the variable command. EventScripts will expand any variables it finds. (Equivalent to running "es es_xformat".)
    es_xformat <variable> <format-string> [token1] [token2] [token3] [...] [token9]
    Formats a string according to the format-string and stores it into the variable command. No variables are expanded as it is assumed everything is already perfect.
This is somewhat complicated if you haven't seen this sort of thing before. Once you get used to it, though, this is a very handy way to build up strings the way you may want. Basically, you specify a variable you want to store the data into as the first parameter. The format-string is simply some text with %1 in the place you want to place "token1", a %2 for token2, %3 for token3, and so on up to %9. Here's an example for player_death.cfg:
ES:
    // EventScripts v0.6.0
    es_setinfo mystring 0   // init
    es_format mystring "%1 just killed %2 with a %3!" event_var(es_attackername) event_var(es_username) event_var(weapon)
    es_msg server_var(mystring)

This code would send a message to everyone that looked like this:
Quote:
Cr3V3TT3 just killed Mattie! with a deagle!


In addition, v0.7.0 of EventScripts introduced the ability to get a particular part of a string and store it into a variable:
    es_token <variable> <string> <token#> [seperator-character]
    Sets a variable to the part of the string corresponding with "token#". It splits up the string according to the seperator character which defaults to space. EventScripts will expand any variables it finds. (Equivalent to running "es es_xtoken".)
    es_xtoken <variable> <string> <token#> [seperator-character]
    Sets a variable to the part of the string corresponding with "token#". It splits up the string according to the seperator character which defaults to space. No variables are expanded as it is assumed everything is already perfect.
This is pretty simple once you look at it. Basically, you provide a variable (a server variable, or maybe one created via setinfo), a string, and which 'token' or part of the string you want. Here's an example of how it works:
ES:
    setinfo myvar 0
    es_token myvar "This is a long string, and I'm interested in the 4th word." 4
    es_msg The string I found was: server_var(mycar)

This code would send the following text to all of the users on the server:
Quote:
The string I found was: long

You can also tell it what kind of character you'd like to split the string up on. For example:
ES:
    setinfo myvar 0
    es_token myvar "This-is-a long-string, and-I'm-interested-in-the 4th: word!" 4 "-"
    es_msg The string I found was: server_var(mycar)

This would split the string up using the dash (-) character. So the new output would actually be:
Quote:
The string I found was: string, and

Special thanks to Cr3V3TT3 for providing most of the implementation of es_token.


Math Functions
Version 0.6.0 introduced some math functions. We already have the Valve provided incrementvar function. This works for the most part, but some people like to multiply and divide, too. So (courtesy of Cr3V3TT3) we tossed in some math functions to help out. Here's what it looks like:
    es_math <variable> <operator> <value>
    Performs the math operator (+, -, /, *,add, subtract, multiply, or divide) on variable and value and stores the result in variable. EventScripts will expand any variables it finds. (Equivalent to running "es es_xformat".)
    es_xmath <variable> <operator> <value>
    Performs the math operator (=, +, -, /, *, set, add, subtract, multiply, or divide) on variable and value and stores the result in variable. No variables are expanded as it is assumed everything is already perfect.
This is fairly easy-- this just lets you perform math functions when you need to.

Here's an example for any config file:
ES:
    // EventScripts v0.6.0
    es_xsetinfo myvar 10
    es_xmath myvar multiply 3
    es echo server_var(myvar)

This code would echo to the console something along these lines:
Quote:
30
because "myvar" has been set to 30 as you requested. (Instead of "multiply" you could use the "*" symbol and achieve the same result.)

es_math tries to keep float and integer values intact, but currently reverts to using floats when dividing.

In v0.7.5, EventScripts added support for random number generation. For example, you can use es_rand to generate a random number between 1 and 6 in myvar:
ES:
    // EventScripts v0.7.5
    // initialize
    es_setinfo myvar 0
    es_rand myvar 1 6
    es_msg The die rolled a server_var(myvar)

might broadcast something like this:
Quote:
The die rolled a 4


Lookup Functions
In EventScripts v0.7.5, support was added to lookup certain values provided by the server. Other commands like this will probably be added over time.

For starters, es_gettime was created. This is a simple function that will let you store the current system time (in the form of seconds since midnight January 1, 1970) into a variable of your choice. This is primarily useful if you wish to construct a unique value for that time period.

In addition, es_getuserid was added to allow lookup of a particular userid. It works a lot like commands provided in Mani's Admin Plugin. I.e., it will try to lookup the information you provide in different ways to see if it can find a good userid. For example, suppose you typed:
ES:
    // EventScripts v0.7.5
    es_setinfo myvar 0
    es_getuserid myvar Mat

If "Mattie!" happened to be on the server, myvar would return his userid. es_getuserid return the first userid where a match is found. It performs the lookup in this order: userid, steamid, full username, and then partial username. If no appropriate user is found, it will return a 0 userid into the variable. You should check for this if it is important for how you wish to use the userid.

In EventScripts v0.7.7, support was added for es_getmoney which will look-up a Counter-Strike: Source player's current money supply. Warning this command has a dependency on internal Valve structures which can change on a Steam update. The server variable eventscripts_cflags will need to be alterred at times to prevent this function from causing undefined behavior in your scripts. (Just be aware that using it might cause problems after a Steam update until the new cflags value is available.)

Here's an example of its use in player_spawn.cfg:
ES:
    // EventScripts v0.7.7
    es_setinfo cash1 0
    es_getmoney cash1 event_var(userid)
    es_tell event_var(userid) You have server_var(cash1) dollars in your pocket.


Delayed Command Execution
One of the most interesting features in EventScripts v0.7.5 is the ability to schedule a command to occur at some point in the future. There are almost always better ways to handle things, but there are a lot of interesting uses. For example, I thought I'd give players on my server a warning before freezetime ended. In round_start.cfg:
ES:
    // EventScripts v0.7.5
    es_delayed 4 es_msg Get ready.
    es_delayed 5 es_msg Get set.
    es_delayed 6 es_msg Go!

Since my mp_freezetime is 6 seconds, this would schedule "Get ready.", "Get set.", and "Go!" within a second of each other ending when freezetime does.

Script Packs
EventScripts v0.7.5 introduced the concept of 'script packs' that can be enabled and disabled at will. Basically a script pack developer can specify the following things when he provides a group of related event scripts:
    1. A command that activates the script pack for you to place in autoexec.cfg (or to type in when you want). This is typically of the form of eventscripts_register scriptpackname. For example, "eventscripts_register firebug".
    2. A command that de-activates the script pack. This is typically of the form of eventscripts_unregister scriptpackname. For example, "eventscripts_unregister firebug".
    3. The subdirectory under eventscripts_subdirectory where you must place these. This must be the name of the script pack you use when you call eventscripts_register.
For example, I could create a group of scripts that provide "FireBug" functionality. I'd provide a zipfile of the scripts and any users who wanted to use it would extract those into their (e.g.) cfg/events/firebug directory. In order to turn on the scripts, they'd just issue "eventscripts_register firebug" from the console. To disable them for the next map, they'd issue "eventscripts_unregister firebug".

In addition to typical event cfg files (e.g. round_start.cfg), script pack developers might include extra functionality in traditional .cfg files. Whenever a script pack is registered, a server variable is created that provides the directory to the script pack to use with the 'exec' command. It's of the form "scriptpackname_dir".

Script pack developers can also provide their own 'server.cfg' file that exists in the script pack subdirectory. This will be executed whenever a new map is loaded since there aren't a lot of good events for this sort of thing.


Source code: Early EventScripts source code is available on the website listed above. It's a VS.NET 7.0 project. I haven't yet posted the source file for the latest release as it required a minor update to a Valve SDK file which I cannot publish.

Notes:
    * For reference, I placed a list of the game events I know about here: http://mattie.info/cs/events.txt
    * For ideas, take a look at the example_eventscripts.zip file on my website or at the script example thread in this forum.


Last edited by Mattie on 2007-04-02, 9:32 am, edited 8 times in total.




User avatar
Site Administrator
Site Administrator
Profile

Posts: 7640
Location:
At Work
 
New postPosted: 2005-06-16, 8:15 pm 
   Post subject: EventScripts v0.8.0 beta has released!

http://mattie.info/cs/

Changes in v0.8.0:

Lots of fixes/tweaks:
    * Tweaked es_delayed such that it no longer adds 2-3 milliseconds to every GameFrame. It should now only check for delayed commands if any are queued-up.
    * Changed all paths to default to using forward slash (/) instead of backslash (\). This should work on both Windows and Linux machines. (Fixes scriptpack_dir bug)
    * Changed the event loader to look for both "cstrike/Resource/modevents.res" and "cstrike/resource/modevents.res". (Fixes problem on some Linux versions of srcds.)
    * Added additional debug information to help track down event misinformation issues.
    * Changed internal command syntax to hopefully help some of the event misinformation issues on Linux.
    * Increased the performance of the es_math functions: cleaned-up float/int detection, disabled console spam, reordered it such that common operators (e.g. add/subtract) are checked before uncommon ones (e.g. multiply/divide)
ServerMail script pack example showing-off a lot of v0.8.0 features:
    1. Allows users to leave the server admin a message by saying
    Quote:
    !report <message>

    2. A single admin can check the messages in their client console by saying
    Quote:
    !checkmsgs

    3. Download http://mattie.info/downloads/servermail.zip
    4. Extract it into the 'servermail' directory underneath your eventscripts_subdirectory.
    5. Add the following lines to your autoexec.cfg (use your STEAMID):
    Quote:
    eventscripts_register servermail
    setinfo servermailid "STEAM_0:0:0000000"

    6. Restart your server
    7. The script probably won't be actively supported by me-- it's mainly a proof of concept example.
Two new variables, both of which I recommend you ignore:
    * eventscripts_datadirectory "cfg"
    Allows users to change the directory where keygroup data files are stored. It must be a subdirectory of your cstrike directory and it is highly recommended that you do not change it. This variable exists for those people who must change it due to situations beyond their control.
    * eventscripts_cmdline <server command-line>
    Read-only variable that just captures the server's command-line at start-up. Useful for diagnostics purposes.
Lots of new/updated commands:
    * eventscripts_version
    Outputs the version of EventScripts that you have loaded. New in v0.8.0: This also works from the client console without rcon access.
    * es_getclientvar <variable> <userid> <varname>
    * es_xgetclientvar <variable> <userid> <varname>
    Reads a console variable from a given player and stores its value in the variable. Please note that some client console variables are not accessible to the server. [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_getplayercount <variable> [team#]
    * es_xgetplayercount <variable> [team#]
    Stores the count of players on the server into a variable. Optionally, a team can be specified and the count of that team will be returned. This function returns -1 if an error occurs (e.g. you specify a non-existent team index). [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_string <variable> replace <text> <with text>
    * es_xstring <variable> replace <text> <with text>
    Within the variable provided, replaces all instances of text with with text. A search and replace function. (Note that es_string currently only supports the 'replace' operator.) [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keygroupcreate <groupname>
    * es_xkeygroupcreate <groupname>
    Creates an internal keygroup that can be used for storing other keys and values. These groups can be written to file in Valve's KeyValues format (see es_keygroupsave). It's recommended that you call es_keygroupdelete when you are done with a group so that the memory can be freed on the server. [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keygroupdelete <groupname>
    * es_xkeygroupdelete <groupname>
    Deletes a keygroup from memory so that it's not leaked. [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keygrouplist <groupname>
    * es_xkeygrouplist <groupname>
    Prints to console a list of all keygroups currently in memory on the server. (Useful for script writers, but probably doesn't work over rcon.) [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keygroupsave <groupname> [path]
    * es_xkeygroupsave <groupname> [path]
    Saves a keygroup from memory to a text file based on the group's name (e.g. es_groupname_db.txt). Optionally, a path can be provided. If a path is not specified, it is placed in your eventscripts_subdirectory. If a path is specified, it will look under eventscripts_datadirectory. It is recommended that you do not change eventscripts_datadirectory because it might break script packs.. The file uses Valve's KeyValues text file structure. [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keygroupload <groupname> [path]
    * es_xkeygroupload <groupname> [path]
    Loads a keygroup from a text file to memory. Optionally, a path can be provided. If a path is not specified, it is loaded from your eventscripts_subdirectory. If a path is specified, it will look relative to the eventscripts_datadirectory. It is recommended that you do not change eventscripts_datadirectory because it might break script packs.. The file uses Valve's KeyValues text file structure. [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keycreate [groupname] <key>
    * es_xkeycreate [groupname] <key>
    Creates a key that can be free-floating or associated with a keygroup (so its values can be saved to a file). Keys created this way must be deleted with es_keydelete when you no longer need them (to prevent leaking memory on the server). [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keydelete [groupname] <key>
    * es_xkeydelete [groupname] <key>
    Deletes a key created with es_keycreate. If a group is specified, it deletes the key from that group, otherwise it deletes the key from the global free-floating keys. Keys created with es_keycreate must be deleted with es_keydelete when you no longer need them (to prevent leaking memory on the server). [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keylist [groupname]
    * es_xkeylist [groupname]
    Lists all keys in memory that are not associated with a group. If a group name is specified, it will list all keys and all values from that keygroup. (Useful for script writers, but probably doesn't work over rcon.) [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keysetvalue [groupname] <key> <valuename> <value>
    * es_xkeysetvalue [groupname] <key> <valuename> <value>
    Sets/creates a value named by valuename in the given key (and, optionally, keygroup). The value can be retrieved with es_keygetvalue. [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_keygetvalue <variable> [groupname] <key> <valuename>
    * es_xkeygetvalue <variable> [groupname] <key> <valuename>
    Looks up the value from valuename from key and stores it in the server variable you probide in variable. These values can be set with es_keysetvalue. [small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]
    * es_foreachkey <variable> in <groupname> <command>
    * es_xforeachkey <variable> in <groupname> <command>
    (EXPERIMENTAL) This command will loop through each key in the specified keygroup. Each iteration through the loop, it will set the specified variable to the name of the current key from the keygroup. It will then execute the command-string. It will repeat this for all keys in the keygroup. Note: Please be careful using complex commands with es_foreachkey; the server might dramatically slow down and/or stop accepting commands until the command queue is addressed.[small](es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)[/small]

Whew. I'll update the full documentation with step-by-step usage instructions when I can. I just wanted to be sure you guys had access to play with this before I went to bed tonight.

Enjoy!
-Mattie


User avatar
Site Administrator
Site Administrator
Profile

Posts: 7640
Location:
At Work
 
New postPosted: 2005-06-16, 8:16 pm 
   Post subject: EventScripts v0.8.2 beta has released!

What's New in v0.8.2?

Bug fixes:
    1. Stopped "couldn't exec cfg/events/player_say.cfg" console messages when a script pack is registered and no similar .cfg exists in the events directory.
    2. Reverted a v0.8.0 change to internal event command handling because at least one person reported problems.
    3. Cleaned-up additional console spam for commands like es_gettime, es_copy, es_getuserid, es_rand, etc.
New variables:
New commands:
    * es_gettimestring <variable>
    * es_xgettimestring <variable>
    Returns (in the variable you provide), the current server time in string form. It formats the text according to the eventscripts_timeformat variable. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getlivingplayercount <variable> [team number]
    * es_xgetlivingplayercount <variable> [team number]
    Similar to es_getplayercount, but only counts players that are not dead. Note: Valve takes a second or two to register a player as fully dead, so this value is not so reliable in player_death.cfg, etc. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayerlocation <variable x> <variable y> <variable z> <userid>
    * es_xgetplayerlocation <variable x> <variable y> <variable z> <userid>
    Stores a player's current x, y, and z coordinates in the variables you provide. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayermovement <variable forward> <variable side> <variable up> <userid>
    * es_xgetplayermovement <variable forward> <variable side> <variable up> <userid>
    Stores a player's current forward, side, and upwards movement in the variables provided. These floating point values typically reflect the player's desired direction (i.e. the keys they're holding down) and likely isn't affected by that player's environment (falling, walking into a wall, bullets, etc).(es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_isbot <variable> <userid>
    * es_xisbot <variable> <userid>
    Sets the provided variable to 1 if the userid belongs to a bot, 0 if it belongs to a legit player, or -1 if it's an invalid userid. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
Enjoy,
-Mattie

:D


User avatar
Site Administrator
Site Administrator
Profile

Posts: 7640
Location:
At Work
 
New postPosted: 2005-07-07, 12:42 am 
   Post subject: MAJOR Update: EventScripts v0.9.0 Released!

EventScripts v0.9.0 Beta

Download:
New file added to installation:
  • cstrike/addons/mattie_eventscripts.res
Bug fixes:
  • Thanks to some wonderful assistance from Valve, EventScripts should now work equally well on all dedicated server platforms and processors! As always this includes Windows and Linux P6 machines (srcds_i686)-- now, though this also includes AMD (srcds_amd) and older Pentium machines (srcds_i486). As a result:
    • eventscripts_sigscan variable is now useless
    • eventscripts_sigoffset variable is now useless
  • Fixed "9mm" variable expansion bug. EventScripts v0.8.2 and earlier couldn't ever expand variables that contained strings which began with numbers. For example "9mm" would always resolve to "9". This has been resolved.
  • Changed default value of eventscripts_cflags to 875. If you set this directly yourself in some file, you need to remove that line or change it to 875. This controls the behavior of es_getmoney.
New variables:
  • eventscripts_currentmap <currentmap>
    Read-only variable that just contains the name of the current map.
New commands:
    * esnq <string>
    Use with caution. Behaves just like "es" except that it will only place quotation marks around server_var() and event_var() values if there is a semicolon inside them. (Primarily recommended only for ma_msay, but might have other uses.)
    * es_cexec <userid> <command-string>
    * es_xcexec <userid> <command-string>
    Forces the user specified by userid to execute the console command-string provided. Similar to the cexec commands of popular plugins but only supports a single userid (not entire teams). (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayername <variable-name> <userid>
    * es_xgetplayername <variable-name> <userid>
    Stores the user's name in the variable specified. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayersteamid <variable-name> <userid>
    * es_xgetplayersteamid <variable-name> <userid>
    Stores the user's steamid in the variable specified. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_getplayerteam <variable-name> <userid>
    * es_xgetplayerteam <variable-name> <userid>
    Stores the user's team index number in the variable specified. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
    * es_loadevents <path-to-res-file>
    * es_xloadevents <path-to-res-file>
    Loads the specified .res file and registers EventScripts as a listener for those events. Useful for other plugin authors who wish to fire custom events that EventScripts can trigger on. (es_x versions of EventScripts functions do not expand variables like server_var(), and are faster as a result.)
EventScripts Custom Events
    New to v0.9.0 is a list of custom events that EventScripts itself triggers. Other plugins can register for these, but more importantly you can create .cfg files for them just as you would Valve events. Here's what mattie_eventscripts.res looks like for v0.9.0:
    Code:
    //=========== (C) Copyright 2005 Mattie Casper All rights reserved. ===========
    //
    // Events triggered by the EventScripts plugin


    // No spaces in event names, max length 32
    // All strings are case sensitive
    // total game event byte length must be < 1024
    //
    // valid data key types are:
    //   none   : value is not networked
    //   string : a zero terminated string
    //   bool   : unsigned int, 1 bit
    //   byte   : unsigned int, 8 bit
    //   short  : signed int, 16 bit
    //   long   : signed int, 32 bit
    //   float  : float, 32 bit

    "eventscriptsevents"
    {
       "es_map_start"
       {
          "mapname"   "string"      // name of the map
       }
       "es_scriptpack_register"
       {
          // this runs after the scriptpack is actually registered
          "scriptpack"   "string"    // name of the script pack being unregistered
       }
       "es_scriptpack_unregister"
       {
          // this runs before the scriptpack is actually unregistered
          "scriptpack"   "string"    // name of the script pack being unregistered
       }
       "es_player_validated"
       {
          // fired when a client is authenticated
          "name"      "string"    // username
          "networkid"   "string"   // networkID
       }
       "es_player_setting"
       {
          // fired when a client changed one/several replicated cvars (name etc)
          "userid"   "short"    // username
       }
       "es_client_command"         // fires when a client console command is passed to server
       {
          "userid"   "short"      // user ID who issued the command
          "command"   "string"    // name of the command
          "commandstring"   "string"   // text of the command after the commandname
       }

    }


    All of the traditional extended event variables work with these events, too (i.e. if there's a userid, there's also an es_username, es_steamid, etc.)

    The best part for me is es_client_command. It can let you trigger upon console commands from the client. E.g. menuselect, !ban, whatever. One great use for this: if you use Mani's plugin 'commandlist.txt' to define 'say' commands, these can be translated to a client console command (so Mani would 'eat' the say command and reduce say spam).

    Note to script writers: If you write an es_client_command that triggers off of a particular event_var(command), please be sure that it begins with a "!". E.g. "!details Mattie". The reason being that there can be a lot of spam with es_client_command since Valve passes a lot of commands (e.g. buy, etc). In the future, I may limit the commands triggered by es_client_command by a certain prefix character to improve server performance.

More documentation updates to come soon. I wanted to get this release out as soon as possible. Feel free to ask questions if anything is unclear.

-Mattie


User avatar
Site Administrator
Site Administrator
Profile

Posts: 7640
Location:
At Work
 
New postPosted: 2005-07-10, 7:37 pm 
   Post subject: Minor, minor v0.9.1 release

This was primarily a performance release. I made many performance improvements to EventScripts.

I also set the appropriate default for eventscripts_cflags to 875.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group