Is there any way to do vgui all in a table like this?
[lua]GUI.Frame = vgui.Create( "DFrame" )
GUI.Frame.Position = GUI.Frame:SetPos(SW, SH)[/lua]
Then do something like GUI.Frame()?
[QUOTE=Kidd;38024745]Is there any way to do vgui all in a table like this?
[lua]GUI.Frame = vgui.Create( "DFrame" )
GUI.Frame.Position = GUI.Frame:SetPos(SW, SH)[/lua]
Then do something like GUI.Frame()?[/QUOTE]
what would be the point?
[QUOTE=Banana Lord.;38024824]what would be the point?[/QUOTE]
I'm just trying to find a cleaner way then typing out each vgui control I want.
Plus it looks nicer.
you can throw the elements into a table, ya
local gui = { }
gui.Frame = vgui.Create( "DFrame" )
gui.Frame:SetTitle( "example!!!" )
Hey all,
I'm having some trouble setting a ClientConVar..
I have it set in the client side of the files, how ever when I load up the game and join the server, it's set to 0.
How can I run a check to see if the convar is set to 1 if it isn't, to do so?
Any help would be great.
[QUOTE=Banana Lord.;38025255]you can throw the elements into a table, ya
local gui = { }
gui.Frame = vgui.Create( "DFrame" )
gui.Frame:SetTitle( "example!!!" )[/QUOTE]
Yeah, I know. I was just looking to see if there was another way. Thanks for the replies anyways, Banana!
[QUOTE=Kidd;38025493]Yeah, I know. I was just looking to see if there was another way. Thanks for the replies anyways, Banana![/QUOTE]
Any other way would be super complicated and I'm not sure how different it would be than just accessing the object directly (unless I'm confused in what you're trying to accomplish!)
[QUOTE=Banana Lord.;38025653]Any other way would be super complicated and I'm not sure how different it would be than just accessing the object directly (unless I'm confused in what you're trying to accomplish!)[/QUOTE]
Now that I think about it, the way I was thinking would just as annoying as typing out every control because I basically still have to do it. I guess I was thinking of having it look cleaner as all in one table instead of having functions and properties all over the place.
I've made a script that allows me to make controls in a single function so I guess I could just use that instead.
[QUOTE=Twerty;38022677]Thank you handsomely brandonj4. Because of your concise example, I see quite clearly what it is I'm confused about -- the [what I assume are] built-in table references for ply, cmd, and args when creating a new function. You quite clearly use args[1] there to refer to whatever the user inputs as the first argument when calling the function. By slipping print(ply) and print(cmd) inside your function, I get "Player [1][Twerty]" and "AmIFive" respectively. So ply is a table of connected players (and maybe bots), but what exactly is cmd? It seems almost self-explanatory, but I find it very strange that defining a function would make a table with the only contents being the name of the given function -- so I'm guessing there's more to it than that?
Sorry I'm blindly guessing like this -- I can't seem to find any documentation or explained examples for those three fields which seem so incremental to using functions in GMod. Just those that define the function simply as a name with the code body, and the end. So your help is appreciated, Chessnut and brandonj4. :smile:[/QUOTE]
No problem, if you need help with anything else just post here.
I was wondering if anyone can help me to change some features in the pointshop addon. The thread for the addon is here: [url]http://www.facepunch.com/showthread.php?t=1022682[/url]
I know the project has been abandoned but it does still work. I was wondering however, how would I go about making certain items only be available to buy by certain usergroups such as donators. The person who made that addon added one item to be admin only so I know it's possible, I'm just not experienced enough in lua to know how to edit it.
Vector math expert please! I need some help ):
[url]http://www.facepunch.com/showthread.php?t=1160598&p=38006236&viewfull=1#post38006236[/url]
[QUOTE=find me;38028358]Vector math expert please! I need some help ):
[url]http://www.facepunch.com/showthread.php?t=1160598&p=38006236&viewfull=1#post38006236[/url][/QUOTE]
There's no picture anymore :tinfoil:
Ah okay:
[IMG]http://s14.postimage.org/k2g96qmgv/image.png[/IMG]
Right here, and if the image is being goofy here's an explanation of what I need. There are two points, A and B. These two points form a straight line AB. A player is looking somewhere between point A and B, so their the trace of their view would go through line AB. How do I figure out where on that line AB their view trace thing would crosses at?
[IMG]http://s14.postimage.org/e1ik9nzun/image.png[/IMG]
I guess to explain it more simply, How do I calculate where the trace of a players view crosses an imaginary line. This is to determine where on the line a player is looking.
[QUOTE=find me;38028847]Right here, and if the image is being goofy here's an explanation of what I need. There are two points, A and B. These two points form a straight line AB. A player is looking somewhere between point A and B, so their the trace of their view would go through line AB. How do I figure out where on that line AB their view trace thing would crosses at?
[IMG]http://s14.postimage.org/e1ik9nzun/image.png[/IMG]
I guess to explain it more simply, How do I calculate where the trace of a players view crosses an imaginary line. This is to determine where on the line a player is looking.[/QUOTE]
Can you give a purpose for doing this?
What is the imaginary line supposed to be?
(I fixed my last issue, now I have a new one that is pretty frustrating)
I have the Point shop on my TTT server and when I add a skin, it comes up as ERROR. It does not actually load the model that it's supposed to be. I have tried several times to fix this issue, to no avail. Currently, I've tried just having it addons. I've also attempted to put the files in the /materials and /models to no avail. I'm not sure what I should be doing. Perhaps someone can help me with this issue! Thanks!
[QUOTE=find me;38028847]Right here, and if the image is being goofy here's an explanation of what I need. There are two points, A and B. These two points form a straight line AB. A player is looking somewhere between point A and B, so their the trace of their view would go through line AB. How do I figure out where on that line AB their view trace thing would crosses at?
[IMG]http://s14.postimage.org/e1ik9nzun/image.png[/IMG]
I guess to explain it more simply, How do I calculate where the trace of a players view crosses an imaginary line. This is to determine where on the line a player is looking.[/QUOTE]
Do you mean the point on the line that is the closest to the trace line? 'Cause the odds of the lines actually crossing eachother in 3d space is extremely low.
Im trying to make so if a player is wanted it will show up a start at their screen, but right now the entire hud disepeard. [I]DarkRP gmod13 ofcourse[/I].
if LocalPlayer == PlayerWanted then
surface.SetDrawColor( 255, 255, 255, 255 )
local tid = surface.GetTextureID( 'gui/silkicons/shield' )
surface.SetTexture( tid )
surface.DrawTexturedRect(ScrW( ) / 10,ScrH() - 300, 16, 16 )
end
Is there a function or something that will allow me to get what STool the player is holding when he fires?
Player:GetInfo("gmod_toolmode")
Weapon:GetMode()
how do i FIX THIS: [QUOTE]ERROR: GAMEMODE:'PlayerSetModel' Failed: [gamemodes\darkrpsvn\gamemode\sv_gamemode_functions.lua:415] attempt to index local 'TEAM' (a nil value)[/QUOTE]
[QUOTE=twitchyb1t;38034291]how do i FIX THIS:[/QUOTE]
Code will help post sv_gamemode_functions.lua file and show us the whole file of the code.
i will i looked at it and theres nothing wrong with it i dont think but here the code : [CODE]require("datastream")
/*---------------------------------------------------------
Gamemode functions
---------------------------------------------------------*/
-- Grammar corrections by Eusion
function GM:Initialize()
self.BaseClass:Initialize()
end
function GM:PlayerSpawnProp(ply, model)
if not self.BaseClass:PlayerSpawnProp(ply, model) then return false end
-- If prop spawning is enabled or the user has admin or prop privileges
local allowed = ((GetConVarNumber("propspawning") == 1 or (FAdmin and FAdmin.Access.PlayerHasPrivilege(ply, "rp_prop")) or ply:IsAdmin()) and true) or false
if RPArrestedPlayers[ply:SteamID()] then return false end
model = string.gsub(tostring(model), "\\", "/")
if string.find(model, "//") then Notify(ply, 1, 4, "You can't spawn this prop as it contains an invalid path. " ..model)
DB.Log(ply:SteamName().." ("..ply:SteamID()..") tried to spawn prop with an invalid path "..model) return false end
if allowed then
if GetConVarNumber("proppaying") == 1 then
if ply:CanAfford(GetConVarNumber("propcost")) then
Notify(ply, 0, 4, "Deducted " .. CUR .. GetConVarNumber("propcost"))
ply:AddMoney(-GetConVarNumber("propcost"))
return true
else
Notify(ply, 1, 4, "Need " .. CUR .. GetConVarNumber("propcost"))
return false
end
else
return true
end
end
return false
end
function GM:PlayerSpawnSENT(ply, model)
return self.BaseClass:PlayerSpawnSENT(ply, model) and not RPArrestedPlayers[ply:SteamID()]
end
function GM:PlayerSpawnSWEP(ply, model)
return self.BaseClass:PlayerSpawnSWEP(ply, model) and not RPArrestedPlayers[ply:SteamID()]
end
function GM:PlayerSpawnEffect(ply, model)
return self.BaseClass:PlayerSpawnEffect(ply, model) and not RPArrestedPlayers[ply:SteamID()]
end
function GM:PlayerSpawnVehicle(ply, model)
return self.BaseClass:PlayerSpawnVehicle(ply, model) and not RPArrestedPlayers[ply:SteamID()]
end
function GM:PlayerSpawnNPC(ply, model)
return self.BaseClass:PlayerSpawnNPC(ply, model) and not RPArrestedPlayers[ply:SteamID()]
end
function GM:PlayerSpawnRagdoll(ply, model)
return self.BaseClass:PlayerSpawnRagdoll(ply, model) and not RPArrestedPlayers[ply:SteamID()]
end
function GM:PlayerSpawnedProp(ply, model, ent)
self.BaseClass:PlayerSpawnedProp(ply, model, ent)
ent.SID = ply.SID
ent.Owner = ply
end
function GM:PlayerSpawnedRagdoll(ply, model, ent)
self.BaseClass:PlayerSpawnedRagdoll(ply, model, ent)
ent.SID = ply.SID
end
function GM:EntityRemoved(ent)
self.BaseClass:EntityRemoved(ent)
if ent:IsVehicle() then
local found = ent.Owner
if ValidEntity(found) then
found.Vehicles = found.Vehicles or 1
found.Vehicles = found.Vehicles - 1
end
end
for k,v in pairs(DarkRPEntities or {}) do
if ent:IsValid() and ent:GetClass() == v.ent and ent.dt and ValidEntity(ent.dt.owning_ent) and not ent.IsRemoved then
local ply = ent.dt.owning_ent
local cmdname = string.gsub(v.ent, " ", "_")
if not ply["max"..cmdname] then
ply["max"..cmdname] = 1
end
ply["max"..cmdname] = ply["max"..cmdname] - 1
ent.IsRemoved = true
end
end
end
function GM:ShowSpare1(ply)
umsg.Start("ToggleClicker", ply)
umsg.End()
end
function GM:ShowSpare2(ply)
umsg.Start("ChangeJobVGUI", ply)
umsg.End()
end
function GM:OnNPCKilled(victim, ent, weapon)
-- If something killed the npc
if ent then
if ent:IsVehicle() and ent:GetDriver():IsPlayer() then ent = ent:GetDriver() end
-- If it wasn't a player directly, find out who owns the prop that did the killing
if not ent:IsPlayer() then
ent = Player(ent.SID)
end
-- If we know by now who killed the NPC, pay them.
if ValidEntity(ent) and GetConVarNumber("npckillpay") > 0 then
ent:AddMoney(GetConVarNumber("npckillpay"))
Notify(ent, 0, 4, string.format(LANGUAGE.npc_killpay, CUR .. GetConVarNumber("npckillpay")))
end
end
end
function GM:KeyPress(ply, code)
self.BaseClass:KeyPress(ply, code)
/*if code == IN_USE then
local trace = { }
trace.start = ply:EyePos()
trace.endpos = trace.start + ply:GetAimVector() * 95
trace.filter = ply
local tr = util.TraceLine(trace)
-- Begin trading server-side (Although this appears to be unstable, don't worry, I've planned the system out, I've just not implemented the update completely).
-- Note: Uncomplete; Please leave for Eusion to complete. :)
if ValidEntity(tr.Entity) and tr.Entity:IsPlayer() then
ply.Trading = nil
local recipient = tr.Entity
local items = {}
for k, v in pairs(ents.GetAll()) do
local owner = (v.dt and v.dt.owning_ent) or nil
if owner and ValidEntity(owner) and owner == ply then
table.insert(items, v)
end
end
if #items > 0 then
datastream.StreamToClients(ply, "darkrp_trade", items)
items = {}
ply.Trading = recipient
else
Notify(ply, 1, 4, "You have no items that you can trade.")
end
end
end*/
end
/*
local AllowedTrades = {"money_printer"}
concommand.Add("rp_tradeitem", function(ply, cmd, args)
local ent = Entity(tonumber(args[1]))
local owner = (ent.dt and ent.dt.owning_ent) or nil
local recipient = ply.Trading or nil
if owner and owner == ply and ValidEntity(ent) and recipient and ValidEntity(recipient) then
if table.HasValue(AllowedTrades, ent:GetClass()) then
vote:Trade(tonumber(ply:EntIndex()), ply, recipient, ent)
else
Notify(ply, 1, 4, "An administrator has forbidden trades using this item!")
end
else
Notify(ply, 1, 4, "Can't trade at this time.")
end
end)
concommand.Add("rp_killtrade", function(ply, cmd, args)
local id = args[1]
if not Trades[id] then return end
local recipient = Trades[id].recipient
local client = Trades[id].client
if not recipient then return end
if not client then return end
if not id then return end
if (ply == client or ply == recipient) then
local rf = RecipientFilter()
rf:AddPlayer(client)
rf:AddPlayer(recipient)
umsg.Start("darkrp_killtrade", rf)
umsg.Entity(ply) -- Send the player who declined.
umsg.End()
Trades[id] = {}
table.remove(Trades, id)
end
end)*/
local function IsInRoom(listener, talker) -- IsInRoom function to see if the player is in the same room.
local tracedata = {}
tracedata.start = talker:GetShootPos()
tracedata.endpos = listener:GetShootPos()
local trace = util.TraceLine( tracedata )
return not trace.HitWorld
end
function GM:PlayerCanHearPlayersVoice(listener, talker, other)
if listener.DarkRPVars and talker.DarkRPVars and ValidEntity(listener.DarkRPVars.phone) and ValidEntity(talker.DarkRPVars.phone) and listener == talker.DarkRPVars.phone.Caller then
return true, tobool(GetConVarNumber("3dvoice"))
elseif talker.DarkRPVars and ValidEntity(talker.DarkRPVars.phone) then
return false, tobool(GetConVarNumber("3dvoice"))
end
if GetConVarNumber("voiceradius") == 1 and listener:GetShootPos():Distance(talker:GetShootPos()) < 550 then
if GetConVarNumber("dynamicvoice") == 1 then
if IsInRoom( listener, talker ) then
return true, tobool(GetConVarNumber("3dvoice"))
else
return false, tobool(GetConVarNumber("3dvoice"))
end
end
return true, tobool(GetConVarNumber("3dvoice"))
elseif GetConVarNumber("voiceradius") == 1 then
return false, tobool(GetConVarNumber("3dvoice"))
end
return true, tobool(GetConVarNumber("3dvoice"))
end
function GM:CanTool(ply, trace, mode)
if not self.BaseClass:CanTool(ply, trace, mode) then return false end
if ValidEntity(trace.Entity) then
if trace.Entity.onlyremover then
if mode == "remover" then
return (ply:IsAdmin() or ply:IsSuperAdmin())
else
return false
end
end
if trace.Entity.nodupe and (mode == "weld" or
mode == "weld_ez" or
mode == "spawner" or
mode == "duplicator" or
mode == "adv_duplicator") then
return false
end
if trace.Entity:IsVehicle() and mode == "nocollide" and GetConVarNumber("allowvnocol
[lua]TEAM = {}
[/lua]
At the top of the file silly :dance:
Change
[lua]local TEAM = RPExtraTeams[ply:Team()]
[/lua]
To
[lua]TEAM.model = RPExtraTeams[ply:Team()]
[/lua]
Also Change..
[lua]if type(TEAM.model) == "table" then
[/lua]
To
[lua]if type(TEAM) == "table" then
[/lua]
[editline]14th October 2012[/editline]
Actually saying that if you're trying to add Classes, that could be the problem, Or if you read at the SVN they've changed to github. [URL="https://github.com/FPtje/DarkRP"]DarkRP[/URL]
[code]BFD: Warning: /home/srcds/orangebox/core is truncated: expected core file size >= 150683648, found: 1204224.
[/code]
does this when calling
game.CleanUpMap()
[QUOTE=/dev/sda1;38036723][code]BFD: Warning: /home/srcds/orangebox/core is truncated: expected core file size >= 150683648, found: 1204224.
[/code]
does this when calling
game.CleanUpMap()[/QUOTE]
12 or 13?
[QUOTE=twitchyb1t;38034291]how do i FIX THIS:[/QUOTE]
You stop using Dark RP.
[QUOTE=twitchyb1t;38034291]how do i FIX THIS:[/QUOTE]
You Obviously Need To Get A New Version Of DarkRP Stupid Bitch
[lua]if SERVER then
AddCSLuaFile("ghtd.lua")
resource.AddFile("sound/ghtd.mp3")
end[/lua]
Doesnt work. Wondering if the "sound" is required.
[QUOTE=ralle105;38030956]Do you mean the point on the line that is the closest to the trace line? 'Cause the odds of the lines actually crossing eachother in 3d space is extremely low.[/QUOTE]
I knew I should have added that the z(or up an down) plane doesn't matter, pretend it goes on forever. I think I might know how to solve it and I'll give it a couple more tries. Imagine though line AB is a big wall, I need to know if the player is looking at that wall regardless of how high or low they are aiming.
[QUOTE=find me;38042661]I knew I should have added that the z(or up an down) plane doesn't matter, pretend it goes on forever. I think I might know how to solve it and I'll give it a couple more tries. Imagine though line AB is a big wall, I need to know if the player is looking at that wall regardless of how high or low they are aiming.[/QUOTE]
Yeah Your Trying To Make An Aimbot Sorry Skid Do Your Own Math
Sorry, you need to Log In to post a reply to this thread.