[QUOTE=Bandit Kitteh;38506150]Trying to get a plugin for evolve to work that shows the name on the client who sprayed an image.
I'm getting: [code]Hook 'HUDPaint' in plugin 'Sprays' failed with error:
addons/evolve/lua/ev_plugins/sh_sprays.lua:19: bad argument #1 to 'pairs' (table expected, got nil)
[/code]
here is line 18-22 [code] function PLUGIN:HUDPaint()
for name, position in pairs( EV_Sprays ) do
if position:Distance( LocalPlayer():GetEyeTrace().HitPos ) < 48 then
draw.SimpleText( "Sprayed by: " .. name, "Trebuchet24", 10, ScrH() / 2, Color( 255, 0, 0 ), 0, 1 )
break[/code]
I'm unsure of how to fix it.[/QUOTE]
I'm obviously no lua expert, but it looks like its recieving the wrong type of variable or something like that.
Or what Banana Lord said. :P
EV_Sprays looks nil then
I need help solving the issue of this error for several models on the map rp_evocity_v33x
SOLID_VPHYSICS static prop with no vphysics model! (models/props_foliage/tree_pine_tall_01.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/msc/e_bush2.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/sickness/dooframe_01.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props/pi_shrub.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/env/lighting/corridorlamp/corridorlamp.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props/cs_office/light_outsidewall.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/env/decor/painting/paint_ship_a.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props/de_tides/tides_woodenfences_b.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/cliffs/rocks_medium02.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props/de_tides/tides_flag_a.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props/cs_militia/trees2.mdl)
I've tried using ents.GetAll() to isolate the objects and remove them, but they can't be removed as they don't show up. I've got all content in the addons directory of garrysmod, as well as in the SRCDS workspace. I also have tried putting the content in the content directory of the game-mode.
I've set SRCDS to mount the games as listed below.
garrysmod/cfg/mountdepots.txt
[code]"gamedepotsystem"
{
"hl2" "1"
"cstrike" "1"
"dod" "1"
"tf" "1"
"ep2" "1"
"episodic" "1"
"hl2mp" "1"
"portal" "1"
}[/code]
I've searched around, and I'm at a loss, I don't know how to fix the error as I don't have access to the map file and can not edit the physics file. I'd either a) like to make the trees, etc solid, or b) remove them from the map to avoid the spam.
I'm implementing a new chatbox addon into my server, I'm getting in console:
[code][ERROR] lua/cl_hatschat.lua:76: attempt to call method 'GetPData' (a nil value)
1. unknown - lua/cl_hatschat.lua:76
Timer Failed! [Simple][@lua/cl_hatschat.lua (line 74)]Chat emoticons set up![/code]
Here is line 72-77. I'm assuming that GetPData was replaced with something else by now? If so, what should I replace it with?
[code]--Line icons, default on. Text "glow", default off
local ShowLineIcons, ShowLineGlow
timer.Simple(1, function() --Seems to error without a delay
--Set false to disable, set true to force on, leave as is to default on, change the 1 to 0 to default off
ShowLineIcons = CreateConVar("HatsChat_LineIcons", LocalPlayer():GetPData("HatsChat_LineIcons", 1) )
ShowLineGlow = CreateConVar("HatsChat_LineGlow", LocalPlayer():GetPData("HatsChat_LineGlow", 0) ) [/code]
Is there a list I can refer to for these kinds of changes?
Hey guys amateur poster here, hopefully I did something right.
I need help with a flashing names script for a TTT server. Thanks for your time!
[CODE]if SERVER then
AddCSLuaFile( "scoreboardglow.lua" )
end
hook.Add("TTTScoreboardColorForPlayer", "scoreboardglow", juicez);
local glow = math.abs(math.sin(CurTime() * 2) * 255);
local flashingRed = ( Color(glow, 0, 0, 255) );
local flashingGreen = ( Color(glow, 0, 0, 255) );
local flashingBlue = ( Color(0, 0, glow) );
local namecolor = {
default = COLOR_WHITE,
admin = ( Color(220, 180, 0, 255) ),
dev = flashingRed,
donator = COLOR_BLUE,
green = flashingGreen
};
local specialID = {
Name1 = "STEAM_0:0:51152726",
Name2 = "STEAM_0:0:35552069",
Name3 = "STEAM_0:0:19847227",
Name4 = "STEAM_0:1:24341229",
};
function juicez(ply)
if not IsValid(ply) then return namecolor.default end
if ply:SteamID() == specialID.NAME then
return namecolor.dev
elseif ply:SteamID() == specialID.NAME then
return namecolor.green
elseif ply:IsUserGroup(owner) and GetGlobalBool("ttt_highlight_admins", true) then
return namecolor.admin
else
return namecolor.default;
end
end[/CODE]
EDIT: Probably should add whats wrong with it, *facepalm*.
It just stays a solid color and doesn't change.
[QUOTE=Bandit Kitteh;38506705]I'm implementing a new chatbox addon into my server, I'm getting in console:
Is there a list I can refer to for these kinds of changes?[/QUOTE]
Get/Set/RemovePData are serverside functions. [url=http://wiki.garrysmod.com/page/Global/CreateClientConVar]CreateClientConVar[/url] has an option third arg to save the value.
[QUOTE=prang123;38502173]How would I go about making chat commands with arguments for my concomands?
I would like to do !addtokens playername tokens.[/QUOTE]
I was also wondering if something like a Killcam could be done?
Two things concerning my SWEP: [URL]http://pastebin.com/PhY62pwy[/URL]
[del]1) When ever any NPC gets killed with this SWEP Gmod freezes and crashes. The code used to inflict the damage (lines 144-151) is copied from another one of my SWEPs that doesn't cause the crashing.[/del]
[del]2) This SWEP has a scope and when you zoom in with the secondary fire it sets a network var to true it causes the scope texture to draw. But this method don't seem to work properly all the time and it seems mess up between the server and the client. Is there a different way to do this or am I just doing something wrong?[/del]
Fixed number 2, copying lines 175-181 to the SecondaryAttack hook did the trick because KeyPressed was getting called twice in the think hook.
Dammit, of course I don't figure out whats wrong until I ask for help.. number 1 was caused by some code I added a long time ago to test some things and never removed (lines 110 and 111)
I might as well ask this here now that those issues are out of the way: Is there a NPC equivalent to player:GetRagdollEntity()? Or a way to get a dead NPCs ragdoll?
In init.lua:
[lua]
function team_3( ply )
if team.NumPlayers( 3 ) == 1 then end
elseif ply:Team() == 1 then end
else
ply:SetTeam( 3 ) //Make the player join team 3
ply:KillSilent()
ply:SetArmor( 50 )
end
end
[/lua]
Error:
[code]
[ERROR] gamemodes/******/gamemode/init.lua: 5: 'end' expected (to close 'function' at line 1) near 'elseif'
1. unknown - gamemodes/******/gamemode/init.lua:0
[/code]
I edited the line numbers to correspond with those that are displayed in my init.lua code that YOU see.
elseif and else count as end
[QUOTE=Bandit Kitteh;38504772]I'm interested to know as well. Can anybody shed some light on this?[/QUOTE]
You want to return ACT_GMOD_DEATH, -1 in GM:CalcMainActivity. Either in a hook or the gamemode. Then you want to use ply:SetPlaybackRate(1) in GM:UpdateAnimation
That would be simplest way. You'd probably want to play around with cycles and stuff too depending on what you're using it for.
This may deserve its own post or payed coder, but I will ask anyway. How could I go about making a timer in lua. NOT a timer.Create or timer.Simple timer. I mean a countdown timer. As in, it displays Time Left: 4:00 and counts down. Time Left: 3:59 Time Left: 3:58 I understand the vgui concept somewhat, but I can't figure out how to execute it and put it into code.
I also have this error:
[CODE]
Couldn't include file 'init.lua' (File not found) (@gamemodes/*****/gamemode/cl_init.lua (line 2
[/CODE]
I think its the reason why my custom hud and other vgui content aren't working.
Try this:
[QUOTE=Pon-3;38510048]In init.lua:
[lua]
function team_3( ply )
if team.NumPlayers( 3 ) == 1 then
elseif ply:Team() == 1 then
else
ply:SetTeam( 3 ) //Make the player join team 3
ply:KillSilent()
ply:SetArmor( 50 )
end
end
[/lua]
You only need to end the initial IF statement and the function, not every if, elseif, etc.
[QUOTE=Pon-3;38510558]This may deserve its own post or payed coder, but I will ask anyway. How could I go about making a timer in lua. NOT a timer.Create or timer.Simple timer. I mean a countdown timer. As in, it displays Time Left: 4:00 and counts down. Time Left: 3:59 Time Left: 3:58 I understand the vgui concept somewhat, but I can't figure out how to execute it and put it into code.
[/QUOTE]
Whenever you want to start the timer, store a variable of CurTime() + <time you want in seconds>. Whenever you want to get the time, just do var - CurTime().
For example,
[lua]
local time = CurTime() + 60
local function Get_Time()
return string.ToMinutesSeconds( time - CurTime() )
end[/lua]
It would return 01:00, if it's called the same time it's set. Then again, I'm not sure if garry fixed the bug with string.ToMinutesSeconds.
-snippy de do da-
Are player collisions fixed yet? Players are still going through each other on my server.
Is there any specific code I can use to fix this?
Thanks
Is it possible to properly z-sort 3D2D stuff? I think it currently just sorts on what gets called first.
[editline]19th November 2012[/editline]
[t]http://puu.sh/1rWRx[/t]
The panel with the text should be partially behind the green panel here.
[QUOTE=Cardcapture1;38503175]Quoting myself to see if anyone has an idea.[/QUOTE]
[QUOTE=JustSoFaded;38501267]The PlayerConnect hook is called when the player_connect source event is fired, so honestly your best bet would be just saving unique information about the player, and then later you can obtain the player handle and just :IsValid() it. If it returns true than, the player made it in. If it returns false, the player is gone. I can't really think of a way to see if the player is still connecting.[/QUOTE]
So how would I apply that new antialiasing feature garry added recently to 3d2d panels? I'm drawing 3d2d in an entity's Draw hook.
[QUOTE=JustSoFaded;38512440][/QUOTE]
It would be better if you just use the PlayerAuthed hook when the player is connected I think.
Reposting this again since no one answered it and it got buried a few pages back.
What am I supposed to do to get Entity:SetEyeTarget to work? All I'm trying to do is get an entity to look in front of itself instead of locking its eyes onto the center of the map, but no matter what I try, it just doesn't want to work.
[lua]
function ENT:Initialize()
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_BBOX)
self.aimtarget = ents.Create( "info_target" )
local pos = self:GetPos() + Vector(0,0,75)
local ang = self:GetAngles():Forward()
local tracedata = {}
tracedata.start = pos
tracedata.endpos = pos+(ang*80)
tracedata.filter = self
local trace = util.TraceLine(tracedata)
self.aimtarget:SetPos(trace.HitPos)
self.aimtarget:SetParent(self)
self.aimtarget:Spawn()
self:DeleteOnRemove(self.aimtarget)
//spawn a melon at the aimtarget to make sure it exists
self.determiner = ents.Create( "prop_physics" )
self.determiner:SetPos(self.aimtarget:GetPos())
self.determiner:SetModel( "models/props_junk/watermelon01.mdl" )
self.determiner:Spawn()
self:DeleteOnRemove(self.determiner)
self:SetEyeTarget(self.aimtarget:GetPos())
//these aren't related to the eye posing
self:Think()
self:LoopAnimation()
end
[/lua]
The melon appears in the place the model [I]should[/I] be looking, so the aimtarget is spawning correctly, but the entity just won't move its eyes. What am I doing wrong here? Is SetEyeTarget just broken? Am I using it wrong? What?
[lua]
self.Weapon:SendWeaponAnim(ACT_VM_PULLPIN)
[/lua]
It animates nothing,does someone know why?
All the other ACT_VMs work perfectly.
[vid]https://dl.dropbox.com/u/18131951/Videos/Gmod%202012-11-19%2020-03-58-42.webmsd.webm[/vid]
Is there any way to show the text on both sides? (In one 3d2d if possible, otherwise, how do I flip text?)
[QUOTE=_NewBee;38512538]So how would I apply that new antialiasing feature garry added recently to 3d2d panels? I'm drawing 3d2d in an entity's Draw hook.[/QUOTE]
Currently the feature is broken, it will be fixed in the next update. Also it is enabled by default, so you dont have to do anything special. :smile:
[QUOTE=MDave;38515116]Currently the feature is broken, it will be fixed in the next update. Also it is enabled by default, so you dont have to do anything special. :smile:[/QUOTE]
Huh, since when was it enabled by default and since when was it broken?
[editline]19th November 2012[/editline]
It definitely works fine for me, if you're cam scale is > 1 then use
[lua]
render.PushFilterMag( TEXFILTER.ANISOTROPIC )
-- draw text here
render.PopFilterMag()
[/lua]
if cam scale is < 1 then use
[lua]
render.PushFilterMin( TEXFILTER.ANISOTROPIC )
-- draw text here
render.PopFilterMin()
[/lua]
So I'm doing something along these lines, in this case using mysqloo. I always get confused with the way 'self' works and how to pass it along to nested functions. Here's the concept of what I mean:
[code]
function PLAYER:DoSomeMysqlShit()
local query = DB:query( "SomeWorkingQuery")
function query:onSuccess(dt)
print(self:Nick()) --self needs to be the PLAYER but it's using 'query'
PrintTable(dt)
end
query:start()
end
[/code]
So how would I pass the player into the onSuccess function?
[QUOTE=hemirox;38515374]So I'm doing something along these lines, in this case using mysqloo. I always get confused with the way 'self' works and how to pass it along to nested functions. Here's the concept of what I mean:
[code]
function PLAYER:DoSomeMysqlShit()
local query = DB:query( "SomeWorkingQuery")
function query:onSuccess(dt)
print(self:Nick()) --self needs to be the PLAYER but it's using 'query'
PrintTable(dt)
end
query:start()
end
[/code]
So how would I pass the player into the onSuccess function?[/QUOTE]
Two options, either:
[lua]
function PLAYER:DoSomeMysqlShit()
local query = DB:query( "SomeWorkingQuery")
query.onSuccess = function(q, dt)
print(self:Nick())
PrintTable(dt)
end
query:start()
end
[/lua]
or:
[lua]
function PLAYER:DoSomeMysqlShit()
local query = DB:query( "SomeWorkingQuery")
local ply = self
function query:onSuccess(dt)
print(ply:Nick())
PrintTable(dt)
end
query:start()
end
[/lua]
Umm...
[QUOTE=garry]I just noticed this too. I' looking into it now.[/QUOTE]
In: [URL="http://facepunch.com/showthread.php?t=1226988&p=38512458&viewfull=1#post38512458"][BUG] Push|PopFilterMin|Mag broke[/URL]
[QUOTE=garry]Was annoying me, so I added the ability to force texture filtering. I enabled it by default between 3d2d camera calls[/QUOTE]
In: [URL="http://facepunch.com/showthread.php?t=1215271&p=38195448&viewfull=1#post38195448"]What Are You Working On? -- October 2012[/URL]
[QUOTE=Drakehawke;38515408]Two options, either:
[lua]
function PLAYER:DoSomeMysqlShit()
local query = DB:query( "SomeWorkingQuery")
query.onSuccess = function(q, dt)
print(self:Nick())
PrintTable(dt)
end
query:start()
end
[/lua]
or:
[lua]
function PLAYER:DoSomeMysqlShit()
local query = DB:query( "SomeWorkingQuery")
local ply = self
function query:onSuccess(dt)
print(ply:Nick())
PrintTable(dt)
end
query:start()
end
[/lua][/QUOTE]
Thanks for clearing that up, I appreciate it!
Must have missed that it was done by default, still makes a difference with and without it for me though
Sorry, you need to Log In to post a reply to this thread.