player_manager.RunClass
Description
Execute a named function within the player's set class
Arguments
Returns
Example
Run the player's class 'Loadout' function when PlayerLoadout is called
Output: The player's class 'Loadout' function is executed
Example
Call a greeting function within the playerclass system.
local PLAYER = {}
PLAYER.DisplayName = "Hooman"
PLAYER.WalkSpeed = 200
PLAYER.greet = function( tbl ) // create a function named 'greet'
// the first argument passed is the source table
// which includes the classID, the player entity, and the function itself
local ply = tbl.Player // here we extract the player entity from the table
ply:ChatPrint("Hello "..ply:Nick().." !") // tell the player
end
// link it to the spawn hook, so each time a player (re-)spawns, he will be greeted with a hello
hook.Add("PlayerSpawn","greet",function(ply)
player_manager.RunClass( ply, "greet" )
end)
Output: Hello Flowx !