Squirrel/Server/Functions/Scripts/CallClientFunc
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|CallClientFunc}} This function will call a function from a loaded script at client side. == Syntax == <code>CallFunc( player Player, string scriptPath, string …') |
|||
Line 4: | Line 4: | ||
== Syntax == | == Syntax == | ||
− | <code> | + | <code>CallClientFunc( player Player, string scriptPath, string funcName, params )</code> |
== Arguments == | == Arguments == |
Latest revision as of 09:15, 13 January 2011
This function will call a function from a loaded script at client side.
[edit] Syntax
CallClientFunc( player Player, string scriptPath, string funcName, params )
[edit] Arguments
- Player - The player you want to call the client function at
- scriptPath - The path of the script including the folder and filename
- funcName - The function being called
- params - Any parameters which need to be passed
[edit] Example
This example will call a function from SomeScript/client.nut when a player types /messageme.
function onPlayerCommand( pPlayer, cmd, text ) { if ( cmd == "somecmd" ) { CallClientFunc( pPlayer, "SomeScript/cain.nut", "SayHello", "param1", 2 ); } return 1; }
[edit] Notes
The function onPlayerCommand is used in in this example. More info about them in corresponding pages.