You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-25Lines changed: 30 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,31 +15,36 @@ The purpose of this plugin is to patch Portal 2 to make the mod work as well as
15
15
Note: While represented in C++, below functions are for Squirrel. `const char*` type is translated to `string` type. `byte`, `short`, and `long` types are translated to `integer` type. `void` types are simply the `function` type in Squirrel. `HSCRIPT` is a VScript script handle which is an entity instance.
16
16
17
17
```c++
18
-
voidprintlP2MM(int level, bool dev, const char* pMsgFormat); | "Logging for the P2MM VScript. The log message must be passed as a string or it will error."
19
-
const char* GetPlayerName(int playerIndex); | "Gets player username by their entity index."
20
-
int GetSteamID(int playerIndex); | "Gets the account ID component of player SteamID by the player's entity index."
21
-
int UserIDToPlayerIndex(int userid); | "Get the player's entity index by their userid."
22
-
bool IsMapValid(const char* map); | "Returns true is the supplied string is a available map to load and run."
23
-
int GetDeveloperLevelP2MM(); | "Returns the value of ConVar p2mm_developer."
24
-
bool IsDedicatedServer(); | "Returns true if this is a dedicated server."
25
-
void InitializeEntity(HSCRIPT ent); | "Initializes, spawns, then activates an entity in the map. Create a entity using CreateByClassname, then use this function on its handle. Note: Not all entities will work even after being initialized with this function."
26
-
void SendToChat(const char* msg, int playerIndex); | "Sends a raw message to the chat HUD. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
27
-
const char* GetGameMainDir(); | "Returns the current game directory. Ex. portal2"
28
-
const char* GetGameRootDir(); | "Returns the current root game directory. Ex. Portal 2"
29
-
void CallFirstRunPrompt(); | "Shows the first run prompt if enabled in config.nut."
30
-
int GetConVarInt(const char* cvName); | "Get the integer value of a ConVar."
31
-
const char* GetConVarString(const char* cvName); | "Get the string value of a ConVar."
32
-
void SetConVarInt(const char* cvName, int newValue); | "Set the integer value of a ConVar."
33
-
void SetConVarString(const char* cvName, const char* newValue); | "Set the string value of a ConVar."
34
-
HSCRIPT PlayerByIndex(int playerIndex); | "Takes the player's entity index and returns the player's script handle."
35
-
void RespawnPlayer(int playerIndex); | "Respawn the a player by their entity index."
36
-
void SetFlashlightState(int playerIndex, bool enable); | "Set the flashlight for a player on or off."
37
-
void ConsolePrint(int playerIndex, const char* msg); | "Print a message to a player's console, unlike printl() which is just the host. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
38
-
void ClientPrint(int playerIndex, const char* msg); | "Print a message to the top center position of a player's screen. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
39
-
void HudPrint(int playerIndex, const char* msg, Vector(float x, float y, int channel), int effect, float fxTime, Vector RGB1, float alpha1, Vector RGB2, float alpha2, Vector(float fadeinTime, float fadeoutTime, float holdTime));
40
-
| "Print a message to the screen based on what the game_text entity does, with many values to set. See Valve Developer Commentary for the game_text entity to see what each field does. Vectors are in place for sets of RGB values. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
41
-
int GetMaxPlayers(); | "Self-explanatory."
42
-
void ShowScoreboard(int playerIndex, bool bEnable); | "Enable or disable displaying the score board a player."
18
+
voidprintlP2MM(int level, bool dev, const char* pMsgFormat); | "Logging for the P2MM VScript. The log message must be passed as a string or it will error."
19
+
const char* GetPlayerName(int playerIndex); | "Gets player username by their entity index."
20
+
int GetSteamID(int playerIndex); | "Gets the account ID component of player SteamID by the player's entity index."
21
+
int UserIDToPlayerIndex(int userid); | "Get the player's entity index by their userid."
22
+
bool IsMapValid(const char* map); | "Returns true is the supplied string is a available map to load and run."
23
+
int GetDeveloperLevelP2MM(); | "Returns the value of ConVar p2mm_developer."
24
+
bool IsDedicatedServer(); | "Returns true if this is a dedicated server."
25
+
void InitializeEntity(HSCRIPT ent); | "Initializes, spawns, then activates an entity in the map. Create a entity using CreateByClassname, then use this function on its handle. Note: Not all entities will work even after being initialized with this function."
26
+
void SendToChat(const char* msg, int playerIndex); | "Sends a raw message to the chat HUD. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
27
+
const char* GetGameMainDir(); | "Returns the current game directory. Ex. portal2"
28
+
const char* GetGameRootDir(); | "Returns the current root game directory. Ex. Portal 2"
29
+
void CallFirstRunPrompt(); | "Shows the first run prompt if enabled in config.nut."
30
+
int GetConVarInt(const char* cvName); | "Get the integer value of a ConVar."
31
+
const char* GetConVarString(const char* cvName); | "Get the string value of a ConVar."
32
+
void SetConVarInt(const char* cvName, int newValue); | "Set the integer value of a ConVar."
33
+
void SetConVarString(const char* cvName, const char* newValue); | "Set the string value of a ConVar."
34
+
HSCRIPT PlayerByIndex(int playerIndex); | "Takes the player's entity index and returns the player's script handle."
35
+
void RespawnPlayer(int playerIndex); | "Respawn the a player by their entity index."
36
+
void SetFlashlightState(int playerIndex, bool enable); | "Set the flashlight for a player on or off."
37
+
void ConsolePrint(int playerIndex, const char* msg); | "Print a message to a player's console, unlike printl() which is just the host. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
38
+
void ClientPrint(int playerIndex, const char* msg); | "Print a message to the top center position of a player's screen. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
39
+
void HudPrint(int playerIndex, const char* msg, Vector(float x, float y, int channel), int effect, float fxTime, Vector RGB1, float alpha1, Vector RGB2, float alpha2, Vector(float fadeinTime, float fadeoutTime, float holdTime));
40
+
| "Print a message to the screen based on what the game_text entity does, with many values to set. See Valve Developer Commentary for the game_text entity to see what each field does. Vectors are in place for sets of RGB values. Specifying no playerIndex or 0 sends to all players. Supports printing localization strings but those that require formatting can't be formatted."
41
+
int GetMaxPlayers(); | "Return max amount of players that can be in the server."
42
+
void ShowScoreboard(int playerIndex, bool bEnable); | "Enable or disable displaying the score board a player."
43
+
void RemovePlayerUI(const int playerIndex, const bool bBanning) | "Display UI for either banning or kicking so host can ban or kick a player. WIP, need to manually open pause menu to see VGUI"
44
+
float TraceLineEx(const Vector& vecAbsStart, const Vector& vecAbsEnd, const int mask, const HSCRIPT ignore, const int collisionGroup)
45
+
| "Improved version of TraceLine that allows for checking with bit masks and collision groups. Returns a fraction of line where a collision occured, or if in a solid, the amount spent outside the solid."
46
+
const Vector& Script_EyeAngles(const int playerIndex) | "Get the eye angles of a player. WIP seems to crash."
47
+
43
48
```
44
49
45
50
## Game Events Interfaced To Squirrel VScript Functions:
"Supports printing localization strings but those that require formatting can't be formatted."
375
371
"Vectors are used to consolidate some parameters so function isn't monstrously big."
376
372
);
377
-
ScriptRegisterFunction (g_pScriptVM, GetMaxPlayers, "Returns the current max players in the server.");
373
+
ScriptRegisterFunction (g_pScriptVM, GetMaxPlayers, "Return max amount of players that can be in the server.");
378
374
ScriptRegisterFunction (g_pScriptVM, ShowScoreboard, "Enable or disable displaying the score board for players.");
379
375
ScriptRegisterFunction (g_pScriptVM, RemovePlayerUI, "Display UI for either banning or kicking so host can ban or kick a player.");
380
376
ScriptRegisterFunctionNamed(g_pScriptVM, Script_UTIL_TraceLine, "TraceLineEx", "Improved version of TraceLine that allows for checking with bit masks and collision groups.");
0 commit comments