|
VSLib
Simple, powerful VScript Library for L4D2
|
Many, many helpful misc functions. More...
Private Member Functions | |
| string | StringReplace (string str, string original, string replacement) |
| object | SearchMainTables (string idx) |
| string | CombineArray (object[] args, string delimiter=" ") |
| string | BuildProgressBar (int width, int count, int goal, string fill="|", string empty=".") |
| void | printf (string str, params string[] values) |
| void | SayToAll (string str, params string[] values) |
| void | SayToTeam (Player player, string str, params string[] values) |
| void | SayToAllDel (string str, params string[] values) |
| void | SayToTeamDel (Player player, string str, params string[] values) |
| Entity | CreateEntity (string _classname, Vector pos=Vector(0, 0, 0), QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| void | SpawnL4D1Survivor (int survivor=4, Vector pos=Vector(0, 0, 0), QAngle ang=QAngle(0, 0, 0)) |
| void | SpawnZombie (Vector pos, string zombieType="default", bool attackOnSpawn=true) |
| bool | SpawnZombieNearPlayer (Player player, int zombieNum, double maxDist=128.0, double minDist=32.0, bool checkVisibility=true, bool useAltSpawn=false) |
| void | SpawnCommentaryZombie (string zombieModel="common_male_tshirt_cargos", Vector pos=Vector(0, 0, 0), QAngle ang=QAngle(0, 0, 0)) |
| double | CalculateDistance (Vector vec1, Vector vec2) |
| double | VectorDotProduct (Vector a, Vector b) |
| Vector | VectorCrossProduct (Vector a, Vector b) |
| Vector | VectorFromQAngle (QAngle angles, double radius=1.0) |
| double | GetDistBetweenEntities (Entity ent1, Entity ent2) |
| void | DrawLine (Vector pos1, Vector pos2, double time=10.0, int red=255, int green=0, int blue=0) |
| void | SlowTime (double desiredTimeScale=0.2, double re_Acceleration=2.0, double minBlendRate=1.0, double blendDeltaMultiplier=2.0, bool allowResumeTime=true) |
| void | ResumeTime () |
| void | PlaySoundToAll (string sound) |
| void | StopSoundOnAll (string sound) |
| Player | GetVictimOfAttacker (Player attacker) |
| int | GetRandNumber (int min, int max) |
| void | ForcePanicEvent () |
| object[] | GetTimeTable (double time) |
| void | BroadcastClientCommand (string command) |
| void | PrecacheModel (string mdl) |
| void | PrecacheCSSWeapons () |
| Entity | SpawnDynamicProp (string mdl, Vector pos, QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnPhysicsProp (string mdl, Vector pos, QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnRagdoll (string mdl, Vector pos, QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnCommentaryDummy (string mdl="models/survivors/survivor_gambler.mdl", string weps="weapon_pistol", string anim="Idle_Calm_Pistol", Vector pos=Vector(0, 0, 0), QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnMinigun (Vector pos, QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnL4D1Minigun (Vector pos, QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnWeapon (string weaponName, int Count=4, Vector pos=Vector(0, 0, 0), QAngle ang=QAngle(0, 0, 90), object[] keyvalues=null) |
| Entity | SpawnAmmo (string mdl="models/props/terror/ammo_stack.mdl", Vector pos=Vector(0, 0, 0), QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnFuelBarrel (Vector pos, QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| Entity | SpawnDoor (string mdl="models/props_downtown/door_interior_112_01.mdl", Vector pos=Vector(0, 0, 0), QAngle ang=QAngle(0, 0, 0), object[] keyvalues=null) |
| void | RemoveEntity (Entity ent) |
| Vector | GetNearbyLocationRadius (Player player, double minDist, double maxDist) |
| Entity | SpawnInventoryItem (string itemName, string mdl, Vector pos) |
| Entity | SetEntityHint (Entity entity, string hinttext, string icon="icon_info", double range=0.0, bool parentEnt=false, double duration=0.0, bool noOffScreen=1) |
| bool | AreVectorsEqual (Vector vec1, Vector vec2) |
| void | ShakeScreen (Vector pos=null, double _amplitude=2, double _duration=5.0, double _frequency=35, double _radius=500) |
| void | FadeScreen (Player player, int red=0, int green=0, int blue=0, int alpha=255, double _duration=5.0, double _holdtime=5.0, bool modulate=false, bool fadeFrom=false) |
| bool | IsValidMeleeWeapon (string classname) |
| bool | IsValidFireWeapon (string weapon) |
| bool | IsValidWeapon (string classname) |
| object | GetRandValueFromArray (object[] arr) |
| void | SanitizeHeldWeapons () |
| void | SanitizeHeldPrimary () |
| void | SanitizeHeldSecondary () |
| void | SanitizeHeldItems () |
| void | SanitizeHeldMeds () |
| void | SanitizeUnheldWeapons () |
| void | SanitizeUnheldPrimary () |
| void | SanitizeUnheldSecondary () |
| void | SanitizeUnheldItems () |
| void | SanitizeUnheldMeds () |
| void | SanitizeMiniguns () |
| void | KillZombieSpawns () |
| void | DisableCarAlarms () |
Many, many helpful misc functions.
Manually compares two vectors and returns true if they are equal. Fix for vector instance overloaded == not firing properly
|
private |
Broadcasts a command to all clients. Currently doesn't work for other clients, only works for the host.
|
private |
Returns a progress bar as a string.
For example: 30% ||||||-----------—
| width | The length (number of chars) that this progress bar should have |
| count | The current value |
| goal | The maximum value possible |
| fill | What character to fill in for a completed block |
| empty | What character to fill in for an incomplete block |
Calculates the distance between two vectors.
|
private |
Combines all elements of an array into one string
|
private |
Spawns a new entity and returns it as VSLib::Entity.
| _classname | The classname of the entity |
| pos | Where to spawn it (a Vector object) |
| ang | Angles it should spawn with |
| keyvalues | Other keyvalues you may want it to have |
|
private |
Disables car alarms.
|
private |
Draws a debug line from one location to another (can only be seen by host)
|
private |
Fades player's screen with the specified color, alpha, etc. Returns the env_fade entity. Note that the entity is automatically killed after its use is done.
|
private |
Forces a panic event
Calculates the distance between two entities.
|
private |
Returns a Vector position that is between the min and max radius, or null if not found.
|
private |
Returns a pseudorandom number from min to max
|
private |
Gets a random value from an array
|
private |
Returns a table with the hours, minutes, and seconds provided the total seconds (e.g. Time())
Example: local t = GetTimeTable ( Time() ); printf("Hours: %i, Minutes: %i, Seconds: %i", t.hours, t.minutes, t.seconds);
Returns the victim of the attacker player or null if there is no victim
|
private |
Returns true if the specified classname is a valid fire weapon (does not include melee weapons).
|
private |
Returns true if the specified classname is a valid melee weapon.
|
private |
Returns true if the specified classname is a valid weapon (includes melee and fire weapons).
|
private |
Kills common spawn locations.
|
private |
Plays a sound to all clients
|
private |
Precaches the CS:S weapons, making them usable
|
private |
Precaches a model
|
private |
Add printf helper to global table. Works just like C++ printf().
Supports up to 12 inputs.
|
private |
Kills the given entity. Useful to use with timers.
|
private |
Resumes time that is slowed by SlowTime().
|
private |
Removes all held items from the map.
|
private |
Removes all held meds from the map.
|
private |
Removes all held primary weapons from the map.
|
private |
Removes all held secondary weapons from the map.
|
private |
Removes all held weapons from the map.
|
private |
Removes all miniguns from the map.
|
private |
Removes all unheld items from the map.
|
private |
Removes all unheld meds from the map.
|
private |
Removes all unheld primary weapons from the map.
|
private |
Removes all unheld secondary weapons from the map.
|
private |
Removes all unheld weapons from the map.
|
private |
Wraps Say() to make it easier to read. This will Say to all into chatbox. Similar to C++ printf().
|
private |
Says some text into chatbox after a delay. Similar to C++ printf().
|
private |
Wraps Say() to make it easier to read. This will Say to the player's current team only (incl. the player). Similar to C++ printf().
|
private |
Says some text into chatbox after a delay to the player's team. Similar to C++ printf().
|
private |
Searches in the Vars and RoundVars tables if not found in the root table.
|
private |
Creates a hint on the specified entity, optionally "parenting" the hint.
| entity | The VSLib Entity or Player to set a hint to |
| hinttext | The hint to display |
| icon | The icon to show, see a list of icons here: https://developer.valvesoftware.com/wiki/Env_instructor_hint#Icons |
| range | The maximum range to display this icon. Enter 0 for infinite range |
| parentEnt | Set to true to make the hint "follow" the entity |
| duration | How long to show the hint. Enter 0 for infinite time. |
|
private |
Shakes the screen with the specified amplitude at the specified location. If the location specified is null, then the map is shaken globally. Returns the env_shake entity. Note that the returned entity is automatically killed after its use is done.
|
private |
Slows down time.
|
private |
Spawns an ammo pile at the specified location
|
private |
Spawns a commentary dummy model at the specified location
|
private |
Spawns the requested commentary zombie at the location you want.
|
private |
Spawns a door at the specified location
|
private |
Spawns a dynamic model at the specified location
|
private |
Spawns a fuel barrel at the specified location
Spawns an inventory item that can be picked up by players. Returns the spawned item.
|
private |
Spawns a L4D1 minigun at the specified location
|
private |
Spawns the requested L4D1 Survivor at the location you want.
|
private |
Spawns a minigun at the specified location
|
private |
Spawns a physics model at the specified location
|
private |
Spawns a ragdoll model at the specified location
|
private |
Spawns the requested weapon at the specified location
|
private |
Spawns the requested zombie via the Director at the specified location.
|
private |
Spawns the requested zombie near a player and also checks to make sure that the spawn point is not visible to any survivor. Attempts to locate a position 50 times. If it can't find a suitable spawn location, it'll return false. Keep in mind that the closer the min and max distances are to each other, the lesser the chance that a suitable spawn will be found. For a good spawn chance, keep the min and max dist far apart. If by chance the survivors are looking everywhere at once, the infected prob won't spawn!
|
private |
Stops a sound on all clients
|
private |
Replaces parts of a string with another string. The "original" param can be anything, but internally uses RegEx.
| str | The full string |
| original | The string to replace |
| replacement | The string to replace "original" with |
Calculates the cross product of two vectors.
Calculates the dot product of two vectors.
Converts QAngles into vectors, with an optional vector length.