Weapon.CallOnClient

From GMod Wiki

Jump to: navigation, search
Function
Syntax Weapon:CallOnClient( String function on client, String any extra parameters )
Description:
Allows you to call a piece of code on the client
Returns: nil
In Object: Weapon
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Weapon.CallOnClient]Weapon.CallOnClient [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCalls a clientside function on the server in a SWEP
Used onNewerServer.png
Code
 
 function SWEP:PrimaryFire()
   self:CallOnClient("BananaEffect", "0 10 20")
 end 
 
 function SWEP:BananaEffect(param)
   local temp = string.Explode(" ", param)
   local a = tonumber(temp[1])
   local b = tonumber(temp[2])
   local c = tonumber(temp[3])
   print(a+b+c)
 end 
 
 
Output30. Anything in BananaEffect will be called clientside


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox