• Help with scope
    10 replies, posted
I'm new in Lua and I want to make a scope like in CSS, the scope I saw in a GMOD Wiki toturial only zooms. How to put a scope model. HELP
There is a scope texture somewhere. Just draw it to screen with render.DrawScreenQuad()
[QUOTE=ralle105;25616120]There is a scope texture somewhere. Just draw it to screen with render.DrawScreenQuad()[/QUOTE] You mean CSS scope texture? Where do i put the location of the scope? [editline]24th October 2010[/editline] I found the texture it is on materials/models/v_models/snip_swp/v_AWP_scope.vtf
[lua] local mat = Material("path/to/scope") --DONT include the .vmt extension function SWEP:DrawHUD() if (self.SomeZoomingVar) then render.SetMaterial(mat) render.DrawScreenQuad() end end [/lua]
OK i will try thanks. [editline]24th October 2010[/editline] How i put Lua tags? [lua][/lua]? [editline]24th October 2010[/editline] [QUOTE=ralle105;25616341][lua] local mat = Material("path/to/scope") --DONT include the .vmt extension function SWEP:DrawHUD() if (self.SomeZoomingVar) then render.SetMaterial(mat) render.DrawScreenQuad() end end [/lua][/QUOTE] It keeps only "zooming". Where do i put that code, beyond function SWEP:SecondaryAttack()?
Do i put it inside beyond function SWEP:SecondaryAttack()?
Put the first code I gave you client-side. Then put this client-side too [lua] function SWEP:ToggleZoom() self.SomeZoomingVar = not self.SomeZoomingVar end [/lua] And this in SWEP:SecondaryAttack() (server-side) [lua] self:CallOnClient("ToggleZoom") [/lua]
[QUOTE=ralle105;25618878]Put the first code I gave you client-side. Then put this client-side too [lua] function SWEP:ToggleZoom() self.SomeZoomingVar = not self.SomeZoomingVar end [/lua] And this in SWEP:SecondaryAttack() (server-side) [lua] self:CallOnClient("ToggleZoom") [/lua][/QUOTE] Ok I will try thanks. [editline]24th October 2010[/editline] How i put it on server side? Like this? [lua]function SWEP:SecondaryAttack() self:CallOnClient("ToggleZoom") end[/lua] [editline]24th October 2010[/editline] I got an error on serverside :(
All works but i got an error on serverside :(
Care to post that error?
[QUOTE=ralle105;25625490]Care to post that error?[/QUOTE] You mean to post the error?
Sorry, you need to Log In to post a reply to this thread.