• What do you need help with? V3
    6,419 replies, posted
Have you tried; [lua]SaveMoney(v) SaveMoney(ply)[/lua]
[QUOTE=_NewBee;36794720]I'm fixing up my (very ancient) gamemode, but when it is uploaded to a server I get the following errors [img]http://puu.sh/J0Jh[/img] Does anybody know what may be causing that?[/QUOTE] Are yousure yur not supposed to be using AddCSLua file? Becuase in the errors i see you are using includefile?
[QUOTE=_NewBee;36794720]I'm fixing up my (very ancient) gamemode, but when it is uploaded to a server I get the following errors [img]http://puu.sh/J0Jh[/img] Does anybody know what may be causing that?[/QUOTE] The text is yellow, meaning that it's clientside error. You can't include them because you simply didn't send them, do AddCSLua in init.lua
1. hunky-dory [IMG]http://i.imgur.com/GQlEe.jpg[/IMG] 2. uhh, what? [IMG]http://i.imgur.com/TyNUs.jpg[/IMG] 3. okay, what the fuck [IMG]http://i.imgur.com/2Uxxk.jpg[/IMG] 4. the FUCK. [IMG]http://i.imgur.com/3jMim.jpg[/IMG] 5. FFFFFFFFFFUUUUUUUUUUUU- [IMG]http://i.imgur.com/66XZD.jpg[/IMG] It always draws in the right position relative to the machine, but it only draws at the right angle when the machine is at an angle of (0,0,0). This is bad. [LUA]function ENT:Draw() self.Entity:DrawModel() local Text="$".." "..tostring(self:GetDTFloat(0)) --THIS IS EXPENSIVE local TheAngle=-self:GetRight():Angle() TheAngle:RotateAroundAxis(TheAngle:Forward(),90) cam.Start3D2D(self:GetPos()+self:GetForward()*17.5-self:GetRight()*19.5+self:GetUp()*10,TheAngle,0.035) draw.RoundedBox(6,0,0,140,45,Color(255,255,255,255)) draw.DrawText(Text,"HUDNumber5",12,0,Color(0,20,40),255) cam.End3D2D() end[/LUA] Would someone please just tell me what I'm doing wrong? Because I thought I was drawing always relative to the machine by using GetRight():Angle(), but [b]I just don't know what went wrong[/b]
hi I'm trying to use AbyssRP in Garry's Mod 13 beta for my server. It had a few LUA errors in it about Fonts not being found. Those were easy to fix, just changed the font to something it did find. But I can't fix these [QUOTE][lua\includes\modules\draw.lua:71] surface.SetFont - no such font "TabLarge" [lua\includes\modules\draw.lua:145] surface.SetFont - no such font "TabLarge"[/QUOTE] And they keep getting spammed, It causes minor lag, and isn't fun to play with. I can find the 2 lines, but nothing to find called TabLarge, I've searched through every LUA script in that folder. Anyone know a fix for it?
[QUOTE=Jackarunda;36805710] Would someone please just tell me what I'm doing wrong? Because I thought I was drawing always relative to the machine by using GetRight():Angle(), but [b]I just don't know what went wrong[/b][/QUOTE] Just use self:GetAngles()
[QUOTE=ralle105;36807010]Just use self:GetAngles()[/QUOTE] But then it's not oriented properly. And even WHILE it's not oriented properly, it continues to rotate all out of whack as the machine turns. It's not a question of orientation. GetRight():Angle() is the same as GetAngles():Right():Angle(). It's a matter of getting the piece of shit to stay aligned with the damn machine at all angles. [b]Edited:[/b] Ok, nevermind, I got it by doing this: [LUA]local TheAngle=self:GetAngles() TheAngle:RotateAroundAxis(TheAngle:Forward(),90) TheAngle:RotateAroundAxis(TheAngle:Right(),-90)[/LUA] Apparently you can't use Right(), Up(), Forward(), GetRight(), GetUp() or GetForward() or else everything fucks up. Thanks anyways.
[QUOTE=Jackarunda;36807285]But then it's not oriented properly. And even WHILE it's not oriented properly, it continues to rotate all out of whack as the machine turns. It's not a question of orientation. GetRight():Angle() is the same as GetAngles():Right():Angle(). It's a matter of getting the piece of shit to stay aligned with the damn machine at all angles. [b]Edited:[/b] Ok, nevermind, I got it by doing this: [LUA]local TheAngle=self:GetAngles() TheAngle:RotateAroundAxis(TheAngle:Forward(),90) TheAngle:RotateAroundAxis(TheAngle:Right(),-90)[/LUA] Apparently you can't use Right(), Up(), Forward(), GetRight(), GetUp() or GetForward() or else everything fucks up. Thanks anyways.[/QUOTE] [lua] local ENT = Entity(83) // vending machine function DrawText() local angle = ENT:GetAngles() angle:RotateAroundAxis(ENT:GetAngles():Right(),90) cam.Start3D2D(ENT:GetPos() + ENT:GetForward()*17.5 + ENT:GetRight()*-26,angle,1) draw.RoundedBox(0,1,1,5,8,Color(255,255,255,255)) cam.End3D2D() end hook.Add("PostDrawTranslucentRenderables","DrawText",DrawText) [/lua] That worked perfectly for my vending machine.
Need help turning CSS skins into Gmod sweps.
[QUOTE=I Fail At Lua;36802719]I can't seem to get my timer and disconnect hook to work. The timer for some reason makes "Money" nil and the save on disconnect doesn't work either and I can't figure out why. They're both not producing any errors either. [LUA] function meta:SaveMoney( ) -- Works file.Write( "Money/" .. self:FormatSteamID() .. ".txt", tostring( self:GetMoney() ) ) end; timer.Create( "SaveMoney", 20, 0, function( ) for k, v in pairs(player.GetAll() ) do v:SaveMoney() end end) function MoneySaveDisconnect( ply ) ply:SaveMoney( ) timer.Destroy("PayDayTimer" .. ply:UserID() ) end hook.Add( "PlayerDisconnected", "playerdisconnected", MoneySaveDisconnect ) [/LUA] I know ply:SaveMoney() works because I tested it out in a different function.[/QUOTE] [LUA] local meta = FindMetaTable( "Player" ) [/LUA]
[QUOTE=Jackarunda;36807285]Ok, nevermind, I got it by doing this: [LUA]local TheAngle=self:GetAngles() TheAngle:RotateAroundAxis(TheAngle:Forward(),90) TheAngle:RotateAroundAxis(TheAngle:Right(),-90)[/LUA] Apparently you can't use Right(), Up(), Forward(), GetRight(), GetUp() or GetForward() or else everything fucks up. Thanks anyways.[/QUOTE] That's what I told you.
Hey everyone, is there a way to make players not swim in water? So that they just walk always on the ground and can not swim? I tried the DropToFloor method, but than you always stuck at the border of the water. Would be cool, if somebody knows a way how to do it.
I want to detect if the entity is touching the world or not. Here's my code : [PHP] function ENT:IsTouchingSomething() MsgN("called ENT:IsTouchingSomething") if !Touching then return false; end MsgN("ENT:IsTouchingSomething returned true !") return true; end function ENT:StartTouch( ent ) if ent:IsWorld() then Touching = true; MsgN("Entity is touching world") end MsgN("Entity is touching something") end function ENT:EndTouch( ent ) if ent:IsWorld() then Touching = false; MsgN("Entity is no longer touching world") end MsgN("Entity is no longer touching something") end [/PHP] ENT:StartTouch and ENT:EndTouch aren't called when touching the world. Is there another way to detect world/entity colisions ? Please help.
[QUOTE=MrManiak;36813603]I want to detect if the entity is touching the world or not. Here's my code : [PHP] function ENT:IsTouchingSomething() MsgN("called ENT:IsTouchingSomething") if !Touching then return false; end MsgN("ENT:IsTouchingSomething returned true !") return true; end function ENT:StartTouch( ent ) if ent:IsWorld() then Touching = true; MsgN("Entity is touching world") end MsgN("Entity is touching something") end function ENT:EndTouch( ent ) if ent:IsWorld() then Touching = false; MsgN("Entity is no longer touching world") end MsgN("Entity is no longer touching something") end [/PHP] ENT:StartTouch and ENT:EndTouch aren't called when touching the world. Is there another way to detect world/entity colisions ? Please help.[/QUOTE] Try the ENT:PhysicsCollide hook. [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexbf26.html[/url]
Thanks. But how would I detect if it stops touching ... ?
I'm trying to make an edit on the WAC Base for my custom helicopters, and I want to know if there is a way to make it so that for example helicopter_interior.mdl is visible to players inside the helicopter and helicopter_exterior.mdl is visible to players outside the helicopter, and if it's possible how can I do it?
[QUOTE=A Lost Sandwich;36807654][LUA] local meta = FindMetaTable( "Player" ) [/LUA][/QUOTE] I have that I just forgot to include it in the snippet I posted.
How can I make it so every time a player gets a kill it runs a command (such as ply:GiveMoney )
[QUOTE=Earl.;36821348]How can I make it so every time a player gets a kill it runs a command (such as ply:GiveMoney )[/QUOTE] [php] hook.Add( "PlayerDeath", "Money_On_Death", function( ply, Inflictor, Killer) ply:GiveMoney() end) [/php]
[QUOTE=triscuit6264;36821425][php] hook.Add( "PlayerDeath", "Money_On_Death", function( ply, Inflictor, Killer) ply:GiveMoney() end) [/php][/QUOTE] Thanks, but this is giving money when the player dies, I need it to give money when the player kills someone else
Give the money to the 'Killer' instead of the Victim. [lua] hook.Add( "PlayerDeath", "Money_On_Death", function( ply, Inflictor, Killer) Killer:GiveMoney(-100) end) [/lua]
Also make sure ply and killer aren't the same person (no money for suicide)
And that killer is a player.
How do i set player's model trough lua? [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5952.html[/url] That doesn't seem to be working right: [IMG]http://puu.sh/JPvZ[/IMG] [lua] function GM:PlayerSpawn( ply ) self.BaseClass:PlayerSpawn( ply ) ply:SetModel( "models/humans/Group03/male_02.mdl" ) end [/lua]
[QUOTE=ollie;36836582]How do i set player's model trough lua? [URL]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5952.html[/URL] That doesn't seem to be working right: -img- function GM:PlayerSpawn( ply ) self.BaseClass:PlayerSpawn( ply ) ply:SetModel( "models/humans/Group03/male_02.mdl" ) end[/QUOTE] You're using the path to the NPC model, use the path to the player model. "models/player/Group03/male_02.mdl"
[QUOTE=goldenlukis;36836929]You're using the path to the NPC¨model, use tha path to the player model. "models/player/Group03/male_02.mdl"[/QUOTE] Thanks a lot!
Rather simple, but I don't know what hook this would go on. Essentially, for the deathrun gamemode I am working on, players will have the ability to use !redie, meaning if they die and have the upgrade, they can respawn as a 'Ghost' and run around and such. I want to know how to disable the ghosts from activating triggers/pressure plates and stuff like that. My current use is via a network boolean of "DEAD", and this disables them from picking up weapons/ hurting players/ pressing buttons. tl;dr How do I stop a player from being able to activate things like trigger_once, breaking func_breakables, and all that type of thing.
Is there a way to do a trace that will tell me if it hits NPC Clip? ("tools/toolsnpclip" in hammer) Edit: Solved it myself: mask = MASK_NPCSOLID_BRUSHONLY
I'm trying to make a round timer in cl_init, counting down from 300 seconds: function DrawTimer() local roundLength = 300 local time = round(NextPrintTime,0) local roundtimeleft = roundLength - time local roundsInSession = 0 if (CurTime() >= NextPrintTime) then function self:HUDPaint() if roundtimeleft > 0 then draw.RoundedBox(6, ScrW()/2 - 120, 0, 243,50, Color(50,50,50,200)) draw.DrawText("Time Left in Round: "..roundtimeleft.." seconds", "ScoreboardText", ScrW() / 2, 15, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER) else roundsInSession = roundsInSession + 1 roundtimeleft= roundtimeleft +(300*roundsInSession) draw.RoundedBox(6, ScrW()/2 - 120, 0, 243,50, Color(50,50,50,200)) draw.DrawText("Time Left in Round: "..roundtimeleft.." seconds", "ScoreboardText", ScrW() / 2, 15, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER) end end NextPrintTime = CurTime() - 2 end end hook.Add("Think", "DrawTimer", DrawTimer) end However this only runs for two iterations before going onward to negative infinity... how could I get it to loop endlessly?
Nvm, I figured it out.
Sorry, you need to Log In to post a reply to this thread.