• What mean the call_vgui and ply in the umsg.Start('' '')
    2 replies, posted
I trying to learning lua but some things seem to be confusing me and I don't what mean this part. sorry for my spelling. Thanks for help. [lua]---- AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include( 'shared.lua' ) function GM:PlayerInitialSpawn(ply) self.BaseClass:PlayerInitialSpawn(ply) -- don't know if you need baseclass here but it couldn't hurt umsg.Start("call_vgui", ply) umsg.End() end --And to set a player's model: function GM:PlayerSpawn(ply) self.BaseClass:PlayerSpawn(ply) ply:SetModel("models/Player/Group01/male_01.mdl") --Model you want when you spawn. end [/lua]
umsg.Start arguments are the unique id, and the player to send to. If you skip the player part it sends it to all players. [url]http://wiki.garrysmod.com/?title=Umsg[/url]
[QUOTE=lotus006;18695207]I trying to learning lua but some things seem to be confusing me and I don't what mean this part. sorry for my spelling. Thanks for help. [lua]function GM:PlayerInitialSpawn(ply) self.BaseClass:PlayerInitialSpawn(ply) -- don't know if you need baseclass here but it couldn't hurt umsg.Start("call_vgui", ply) umsg.End() end [/lua][/QUOTE] Where you've got [lua]self.BaseClass:PlayerInitialSpawn(ply)[/lua] you need to have [lua]self.BaseClass.PlayerInitialSpawn(self,ply)[/lua] because [lua]object:func(...)[/lua] is just a shorthand for [lua]object.func(object, ...)[/lua] and what you're essentially doing is [lua]self.BaseClass.PlayerInitialSpawn(self.BaseClass, ply)[/lua]
Sorry, you need to Log In to post a reply to this thread.