Garry's Mod

Garry's Mod

Florian's Script - Character System
 This topic has been pinned, so it's probably important
Florian #  [developer] Mar 6, 2020 @ 12:11pm
[EN] Script Events
CLIENT

FScript.CanOpenPlayerMenu( Player player, String name ) Checks whether an addon menu can be opened or not. Arguments : Player player (1), String name (2) (1) The player wanting to open the menu. (2) The menu name to be opened. Returns : Boolean canOpen (1) (1) If true the menu can be opened, otherwise (false), the menu will not be opened.

SHARED

FScript.OnStartedLoading() Allows you to execute code when you start loading the addon files. Arguments : None Returns : Nothing

FScript.OnFinishedLoading() Allows you to execute code after the addon files have loaded. Arguments : None Returns : Nothing

FScript.ScriptSettingsLoaded() Allows you to execute code when the addon's parameters have been loaded (this can be used to add or modify parameters without touching the original file). Arguments : Table parameters (1) (1) The table containing all addon parameters (FScript.Config). Returns : Nothing

FScript.OnLoadScriptTranslations() Allows you to execute code when the addon translations have been loaded (you can use this event to add custom translations as explained here or modify existing ones without touching the original file). Arguments : None Returns : Nothing

FScript.OnLoadScriptTranslations() Allows you to execute code when the selected language translations have been successfully loaded. Arguments : None Retourne : Nothing

FScript.CanUseAdminTool( Player player, String tool ) Allows you to check if a player can use an administration tool. Arguments : Player player (1), String tool (2) (1) The player wanting to use the tool. (2) The tool name the player wants to use. Returns : Boolean canUse (1) (1) If true, the tool can be used, otherwise (false), the tool cannot be used.

FScript.CanUseChatCommand( Player player, String commandName, String arguments ) Checks whether a player can use chat commands. Arguments : Player player (1), String commandName (2), String arguments (3) (1) The player wanting to execute a chat command. (2) The command name the player wants to execute. (3) The arguments given by the player for the command. Returns : Boolean canUse (1) (1) If true the command can be executed, otherwise (false), the command will not be executed.

WARNING, if you are using the DarkRP gamemode or derived, you must use the canChatCommand[wiki.darkrp.com] event, so the "FScript.CanUseChatCommand" event will never be triggered.

FScript.OnSendNotification( Player player, String messageType, String message ) Allows to execute code when a notification is going to be sent on a player. Arguments : Player player (1), String messageType (2), String message (3) (1) The Player who is the target of the notification. (2) The type of notification (information, error, etc.). (3) The notification message. Returns : Nothing

WARNING, if you are using the DarkRP gamemode or derived modes, you must use the onNotify[github.com] event, so the "FScript.OnSendNotification" event will never be triggered.

SERVER

FScript.OnResetPlayer( Player player ) Allows to execute code when the player is reset by the addon. Arguments : Player player (1) (1) The player who is going to be reset. Returns : Nothing

FScript.CanCreateCharacter( Player player ) Checks if the player can create a new character. Arguments : Player player (1) (1) The player who wants to create a character. Returns : Boolean canCreate (1) (1) If true the player will be able to create a character, otherwise (false), the player will not be able to create a character.

FScript.PreCreateCharacter( Player player ) Allows you to execute code before creating a character. Arguments : Player player (1) (1) The player who will create a character. Returns : Nothing

FScript.PostCreateCharacter( Player player, Table data ) Allows you to execute code after the character has been created. Arguments : Player player (1), Table data (2) (1) The player who created a character. (2) The created character's data. Returns : Nothing

FScript.CanChangeCharacter( Player player ) Allows you to check if the player can change characters. Arguments : Player player (1) (1) The player who wants to change characters. Returns : Boolean canChange (1) (1) If true, the player will be able to change the character, otherwise (false), the player will not be able to change it.

FScript.PreChangeCharacter( Player player ) Allows you to execute code before changing the character. Arguments : Player player (1) (1) The player who is going to change characters. Returns : Nothing

FScript.PostChangeCharacter( Player player, String characterNumber ) Allows you to execute code after the character change. Arguments : Player player (1), String characterNumber (2) (1) The player who has changed characters. (2) The chosen character's number. Returns : Nothing

FScript.CanEditCharacterInformations( Player player ) Allows you to check if the player can edit his character's information. Arguments : Player player (1) (1) The player who wants to edit his character's information. Returns : Boolean canEdit (1) (1) If true, the player will be able to edit his character's information, otherwise (false), the player will not be able to edit it.

FScript.PreEditCharacterInformations( Player player ) Allows you to execute code before editing the character information. Arguments : Player player (1) (1) The player who is going to edit his character's information. Returns : Nothing

FScript.PostEditCharacterInformations( Player player, Table data ) Allows you to execute code after editing the character information. Arguments : Player player (1), Table data (2) (1) The player who edited his character information. (2) The character data edited. Returns : Nothing

FScript.CanEditCharacterNotes( Player player ) Allows you to check if the player can edit his character's notes. Arguments : Player player (1) (1) The player who wants to edit his character's notes. Returns : Boolean canEdit (1) (1) If true, the player will be able to edit his character's notes, otherwise (false), the player will not be able to edit them.

FScript.PreEditCharacterNotes( Player player ) Allows you to execute code before editing the character's notes. Arguments : Player player (1) (1) The player who will edit his character's notes. Returns : Nothing

FScript.PostEditCharacterNotes( Player player, String notes ) Allows you to execute code after editing the character's notes. Arguments : Player player (1), String notes (2) (1) The player who edited his character's notes. (2) The edited character's notes. Returns : Nothing

FScript.CanViewCharacterDatabase( Player player ) Checks if the player can access the character database. Arguments : Player player (1) (1) The player who wants to access the character database. Returns : Boolean canView (1) (1) If true the player will be able to access the character database, otherwise (false), the player will not be able to access it.

FScript.PreViewCharacterDatabase( Player player ) Allows you to execute code before accessing the character database. Arguments : Player player (1) (1) The player who will access the character database. Returns : Nothing

FScript.PostViewCharacterDatabase( Player player, String action, String steamID64, String characterNumber ) Allows you to execute code after accessing the character database. Arguments : Player player (1), String notes (2), String steamID64 (3), String characterNumber (4) (1) The player who has access to the character database. (2) The action that has been done on the database. (3) The concerned player's SteamID64. (4) The concerned character number. Returns : Nothing

FScript.CanSaveCharacter( Player player ) Checks if the player can save his character on the server. Arguments : Player player (1) (1) The player who wants to save his character. Returns : Boolean canSave (1) (1) If true, the player will be able to save his character, otherwise (false), the player will not be able to save it.

FScript.OnCharacterSaved( Player player, Table data ) Allows you to execute code when the character save is complete (this can be used to save custom information as explained here). Arguments : Player player (1), Table data (2) (1) The player who saved his character. (2) The saved character data. Returns : Nothing

FScript.CanLoadCharacter( Player player, String characterNumber ) Allows you to check if the player can load another character. Arguments : Player player (1), String characterNumber (2) (1) The player who wants to save his character. (2) The chosen character number. Returns : Boolean canLoad (1) (1) If true (true) the player will be able to load another character, otherwise (false), the player will not be able to change.

FScript.OnCharacterLoaded( Player player, Table data ) Allows you to execute code when the character loading is complete (this can be used to load custom information as explained here). Arguments : Player player (1), Table data (2) (1) The player who loaded another character. (2) The loaded character data. Returns : Nothing

FScript.CanViewCharacterInformations( Player player ) Checks if the player can display a character's information. Arguments : Player player (1) (1) The player who wants to display a character's information. Returns : Boolean canView (1) (1) If true, the player will be able to display the character's information, otherwise (false), the player will not be able to display it.

FScript.OnViewCharacterInformations( Player player ) Allows you to execute code when the player displays a character's information. Arguments : Player player (1) (1) The player who displayed a character's information. Returns : Nothing
Last edited by Florian #; Mar 8, 2020 @ 1:16pm