[QUOTE=mcd1992;48738247]I don't see any signs of gmod using that header. If I had to guess... -snip-[/QUOTE]
Thanks mang, ended up taking your advice on Steam to search the game's strings for the IGameConsole interface version. Turns out gmod uses a version 004 instead of 003 which was on the wiki. I'll now have to figure out the changes, but the index for Clear() is the same.
Lua how to SetModelScale and increase prop collision box to match modelscale ?
[code]hook.Add("InitPostEntityMap", "Adding", function()
local ent2 = ents.Create("prop_dynamic_override")
if ent2:IsValid() then
ent2:SetPos(Vector(-260, 250, 64))
ent2:SetAngles(Angle(0, 0, 90))
ent2:SetKeyValue("solid", "6")
ent2:SetModel(Model("models/props_lab/blastdoor001c.mdl"))
ent2:SetModelScale( 10, 0)
--ent2:SetRenderBounds(Vector (-260, 250, 64), Vector (-260, 650, 64))
ent2:SetCollisionBounds(Vector (-260, 250, 64), Vector (-260, 650, 64))
ent2:Spawn()
-- ent2:Activate()
end
end)[/code]
So with the following code i spawn a blast door into a map and scale it up but the collision hitbox when i walk into the blast door is still default and the code that is nulled out is because it is not working.
And "ent2:Activate()" makes the prop have no collision at all.
Is there a way to copy an NPC's current bone positions and angles and apply them to a serverside ragdoll?
SetBonePosition is client side, and setting the position of the individual physics objects does nothing.
Hey i'm trying to share some var from server to client in an entity i'm using the net.library here is my problem
init.lua
[lua]
self.Myvar = 0
varr = self.Myvar
if (varr == 1) then
SetNWInt(varr, 1)
end
[/lua]
cl_init.lua ()
[lua]
conditionm = GetNWInt(varr)
if (conditionm == 1) then
install:SetVisible( true ) //install is a button in my derma menu
end
[/lua]
"conditionm = GetNWInt(varr)" -> attempt to call Global "GetNWInt" (a nil value)
[QUOTE=alex223;48744575]Hey i'm trying to share some var from server to client in an entity i'm using the net.library here is my problem
init.lua
[lua]
self.Myvar = 0
varr = self.Myvar
if (varr == 1) then
SetNWInt(varr, 1)
end
[/lua]
cl_init.lua ()
[lua]
conditionm = GetNWInt(varr)
if (conditionm == 1) then
install:SetVisible( true ) //install is a button in my derma menu
end
[/lua]
"conditionm = GetNWInt(varr)" -> attempt to call Global "GetNWInt" (a nil value)[/QUOTE]
You have to assign NWVars to entity's, and also that is not strictly the net library.
[code]-- Server side shit
local Meta = FindMetaTable("Player");
function Meta:SetThatVar( bool )
self.RandomValue = bool
net.Start("Random:UpdateVar")
net.WriteBool( self.RandomValue )
net.Send( self )
end
-- Client side shit
net.Receive("Random:UpdateVar",function()
LocalPlayer().RandomValue = net.ReadBool()
end)
-- Now in that derma menu you can use.
if (LocalPlayer().RandomValue) then
install:SetVisible( true )
end[/code]
Do not copy and paste the code directly, but that is the general idea of how to network the value.
[QUOTE=AIX-Who;48745000]You have to assign NWVars to entity's, and also that is not strictly the net library.
[code]-- Server side shit
local Meta = FindMetaTable("Player");
function Meta:SetThatVar( bool )
self.RandomValue = bool
net.Start("Random:UpdateVar")
net.WriteBool( self.RandomValue )
net.Send( self )
end
-- Client side shit
net.Receive("Random:UpdateVar",function()
LocalPlayer().RandomValue = net.ReadBool()
end)
-- Now in that derma menu you can use.
if (LocalPlayer().RandomValue) then
install:SetVisible( true )
end[/code]
Do not copy and paste the code directly, but that is the general idea of how to network the value.[/QUOTE]
Thanks for the reply but, i can't make it work and there are no error message
init.lua
[lua]
self.gotmere = False
....
util.AddNetworkString ("tourm")
util.AddNetworkString ("tourd")
local meta = FindMetaTable("Player")
function meta:tourvar(bool)
net.Start("tourd")
net.WriteBool(self.gotmere)
net.Send(self)
print ("ee" , self.gotmere) // i did this to see if the function is runing or not and nothing appear
end
//ent:use bla bla
net.Start("tourm")
net.Send(caller)
[/lua]
cl_init.lua
[lua]
net.Receive("tourd",function()
LocalPlayer().gotmere = net.ReadBool()
print ("lol") // Again i did this to see if the function is runing or not and nothing appear
end)
net.Receive("tourm", function(tt)
//creating derma blabla
mere.DoClick = function()
if (LocalPlayer().gotmere) then
install:SetVisible( true )
end
end
[/lua]
I don't know if i'm missing something to make it work, i tryed to find the solution everywhere but i can't find it. The value won't be shared.
[QUOTE=alex223;48745754]Thanks for the reply but, i can't make it work and there are no error message
init.lua
[lua]
self.gotmere = False
....
util.AddNetworkString ("tourm")
util.AddNetworkString ("tourd")
local meta = FindMetaTable("Player")
function meta:tourvar(bool)
net.Start("tourd")
net.WriteBool(self.gotmere)
net.Send(self)
print ("ee" , self.gotmere) // i did this to see if the function is runing or not and nothing appear
end
//ent:use bla bla
net.Start("tourm")
net.Send(caller)
[/lua]
cl_init.lua
[lua]
net.Receive("tourd",function()
LocalPlayer().gotmere = net.ReadBool()
print ("lol") // Again i did this to see if the function is runing or not and nothing appear
end)
net.Receive("tourm", function(tt)
//creating derma blabla
mere.DoClick = function()
if (LocalPlayer().gotmere) then
install:SetVisible( true )
end
end
[/lua]
I don't know if i'm missing something to make it work, i tryed to find the solution everywhere but i can't find it. The value won't be shared.[/QUOTE]
You need to use playerEntity:tourvar(whatever) not just do:
[code]
net.Start("tourm")
net.Send(caller)
[/code]
[lua]local angl = math.acos( self.Owner:GetVelocity():Normalize():Dot( self.Owner:GetAimVector() ) )
//Gets the angle between velocity Dir and aim Dir [/lua]
that's the line it's referencing
[ERROR] addons/braindamage/lua/weapons/weapon_forcegun/shared.lua:92: attempt to index a nil value
1. unknown - addons/braindamage/lua/weapons/weapon_forcegun/shared.lua:92
So It's a weapon and this statement is inside of the PrimaryAttack() function. It's probably a missing : or something. I came to lua from C++ and E2 which are structured alot differently. If you need additional information let me know
[QUOTE=Druu;48746540]
[lua]
local angl = math.acos( self.Owner:GetVelocity():Normalize():Dot( self.Owner:GetAimVector() ) )
| This is your problematic index
[/lua]
[/QUOTE]
Vector:Normalize changes the vector object in place, and does not return anything, that is where you have your nil value.
Use Vector:GetNormal/GetNormalized instead
Is it possible to block a single client from receiving updates both visually and physics-wise for certain objects?
I have a clientside Think hook set up that sets the NODRAW flag on the entity, which is fine, but if the entity starts moving, the enity's shadow will start drawing/flickering.
[QUOTE=Z0mb1n3;48747204]Is it possible to block a single client from receiving updates both visually and physics-wise for certain objects?
I have a clientside Think hook set up that sets the NODRAW flag on the entity, which is fine, but if the entity starts moving, the enity's shadow will start drawing/flickering.[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetPreventTransmit]Entity:SetPreventTransmit[/url] I believe there's also some flag you can set to prevent networking to everyone.
[QUOTE=MDave;48746813]Vector:Normalize changes the vector object in place, and does not return anything, that is where you have your nil value.
Use Vector:GetNormal/GetNormalized instead[/QUOTE]
thanks a bunch man!
Is it possible to stop a derma panel from closing by returning 'false' in some function? (I tried returning true and false in the OnClose function of a panel to stop it from closing, but neither did anything). I just want the panel to be open long enough to be used by another panel!
How do you retrieve the player model you're set as on Sandbox?
[editline]24th September 2015[/editline]
Basically I'm working on a non sandbox derived gamemode but would like that model to be the player's default - like fretta does (which I can't seem to find)
[QUOTE=NiandraLades;48749974]How do you retrieve the player model you're set as on Sandbox?
[editline]24th September 2015[/editline]
Basically I'm working on a non sandbox derived gamemode but would like that model to be the player's default - like fretta does (which I can't seem to find)[/QUOTE]
It's part of the [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/gamemode/player_class/player_sandbox.lua"]player class[/URL]
RunStringEx or CompileString?
[QUOTE=LegoGuy;48750068]RunStringEx or CompileString?[/QUOTE]
CompileString because RunStringEx errors if there's a compiling error, whereas CompileString can stay silent.
Hey, is there a built-in function that allows identification of the current gmod version/update? If not is there a good way of finding out if the version has changed?
I suppose I could somehow get information from the [url]http://www.garrysmod.com/updates/[/url] page but I'm not sure how reliable that will be.
[QUOTE=MPan1;48749463]Is it possible to stop a derma panel from closing by returning 'false' in some function? (I tried returning true and false in the OnClose function of a panel to stop it from closing, but neither did anything). I just want the panel to be open long enough to be used by another panel![/QUOTE]
I assume you are doing this with a DFrame. If you use DFrame:SetDeleteOnClose(false), the panel will not delete ifself, only make itself invisible. Then you can remove the now hidden panel in a timer if you wish from the DFrame:OnClose() callback.
Hi, I was wondering if there is a way to make a vehicle (car) out of any model or would I need to recompile the model with specific bones for wheels etc?
How do you hide the right-click 'cut-copy-paste' menu of a DTextEntry? I saw it done with the Luapad addon and I commented this on it, but the creator is offline. Anyone know?
[editline]25th September 2015[/editline]
DAYUM 300 POSTS
[QUOTE=MPan1;48757229]How do you hide the right-click 'cut-copy-paste' menu of a DTextEntry? I saw it done with the Luapad addon and I commented this on it, but the creator is offline. Anyone know?
[editline]25th September 2015[/editline]
DAYUM 300 POSTS[/QUOTE]
Where is this feature used? I can probably find out how, because the only text entry I know of is the save dialogue, and I see nothing about the menu being hidden.
[QUOTE=Z0mb1n3;48757678]Where is this feature used? I can probably find out how, because the only text entry I know of is the save dialogue, and I see nothing about the menu being hidden.[/QUOTE]
Well, according to the code of the Luapad, there is a TextEntry created (not a DTextEntry, but just a TextEntry), which is the one you type the code into! If you right-click on this one, you can see the options are different, but I myself looked through the code and couldn't find what was used to hide the menu. Just CTRL+F and search for 'TextEntry'. You'll find it.
Anyone got some easy-to-read code regarding 3D stencils and all that? I once saw a guy do a button within the breen bust, how do I do something like that?
[QUOTE=MPan1;48758563]Well, according to the code of the Luapad, there is a TextEntry created (not a DTextEntry, but just a TextEntry), which is the one you type the code into! If you right-click on this one, you can see the options are different, but I myself looked through the code and couldn't find what was used to hide the menu. Just CTRL+F and search for 'TextEntry'. You'll find it.[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/DermaMenu]Global.DermaMenu[/url]
"...closes any current menus."
Opening your own dermamenu when the user right clicks and having no content inside it and removing it shortly thereafter should serve your purpose.
Hey again, i need to share a var (from my player database) to an entity and and get it back from the entity to the database, because it might be change by the player. But i don't know how to share a var between the init.lua(gamemode) and the init.lua/cl_init.lua(entity).
Check out [url=http://wiki.garrysmod.com/page/ENTITY/SetupDataTables]ENTITY.SetupDataTables[/url]
[QUOTE=KingofBeast;48760823]Check out [url=http://wiki.garrysmod.com/page/ENTITY/SetupDataTables]ENTITY.SetupDataTables[/url][/QUOTE]
[quote]
"You can of course set and get from outside of the entity"
[lua]MyEntity:GetAmount()[/lua]
[/quote]
Can you give me an example on how to use this one. I mean how to change these var from the init.lua(in the gamemode folder)
Sorry, you need to Log In to post a reply to this thread.