Squirrel/Server/Functions/Scripts/CallClientFunc

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(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>CallFunc( player Player, string scriptPath, string funcName, params )</code>
+
<code>CallClientFunc( player Player, string scriptPath, string funcName, params )</code>
  
 
== Arguments ==
 
== Arguments ==

Latest revision as of 09:15, 13 January 2011

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function will call a function from a loaded script at client side.

[edit] Syntax

  1. 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.

  1.  
  2. function onPlayerCommand( pPlayer, cmd, text )
  3. {
  4. if ( cmd == "somecmd" )
  5. {
  6. CallClientFunc( pPlayer, "SomeScript/cain.nut", "SayHello", "param1", 2 );
  7. }
  8. return 1;
  9. }
  10.  

[edit] Notes

The function onPlayerCommand is used in in this example. More info about them in corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox