• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
On DarkRP, when you choose a skin on the job selection menu you respawn with it. How does one edit that var so the player respawns with that certain model?
Pane:NoClipping() does not work.
How do I remove things like [I]Drive[/I] and [I]Disable Collisions[/I] from the context menu of my sent?
Either use ENTITY:CanProperty or m_tblToolsAllowed. ENT.m_tblToolsAllowed = {}
Can i auto redirect players to second server if first is full?
[QUOTE=GreenGold;46967505]Can i auto redirect players to second server if first is full?[/QUOTE] Brilliant question, and I have a similar one. Is it possible to search for / seek out servers with specific gamemodes in-game (so in a server), and have players join a found server? Idk how to better describe it. You're in a server, you browse for servers while actually playing (you dont press ESC or ~), you join a server you found. [editline]19th January 2015[/editline] It's also a question if I can share data between servers, like player stats. If you leveled up in "Jon's Gaming" server, and traveled to "Martha's Gaming" server, the stats would be the same? (without saving files to the client, cus people would cheat) of course hopefully a safe way, that would NOT trigger antivirus, antispyware, and not in anyway that seems like a hack.
[QUOTE=RedNinja;46966387]Pane:NoClipping() does not work.[/QUOTE] You are doing it wrong then. Works for me. You do know the argument is a bool[I] right?[/I]
[QUOTE=WalkingZombie;46967582]Brilliant question, and I have a similar one. Is it possible to search for / seek out servers with specific gamemodes in-game (so in a server), and have players join a found server? Idk how to better describe it. You're in a server, you browse for servers while actually playing (you dont press ESC or ~), you join a server you found. [editline]19th January 2015[/editline] It's also a question if I can share data between servers, like player stats. If you leveled up in "Jon's Gaming" server, and traveled to "Martha's Gaming" server, the stats would be the same? (without saving files to the client, cus people would cheat) of course hopefully a safe way, that would NOT trigger antivirus, antispyware, and not in anyway that seems like a hack.[/QUOTE] sql. Also about coroutines, not sure if they're the same in GLua but this chapter of PiL should help: [url]http://www.lua.org/pil/9.1.html[/url]
ent.PrintName returns null when it's a vehicle. How do I access it? im writing in the HUDPaint hook Also is there a function to get the status of a vehicle (If it's locked/unlocked)
[QUOTE=RedNinja;46968303]ent.PrintName returns null when it's a vehicle. How do I access it? im writing in the HUDPaint hook Also is there a function to get the status of a vehicle (If it's locked/unlocked)[/QUOTE] PrintName is a think for Lua SWEPs only. ( Maybe Lua SENTs too ). As for locked/unlocked, not on client without networking.
[QUOTE=Robotboy655;46968424]PrintName is a think for Lua SWEPs only. ( Maybe Lua SENTs too ). As for locked/unlocked, not on client without networking.[/QUOTE] What do I do then for vehicles? Is there a way to get the printname on the Q menu? Also how do I get the state of it?
[QUOTE=RedNinja;46968432]What do I do then for vehicles? Is there a way to get the printname on the Q menu? Also how do I get the state of it?[/QUOTE] There is no way you can do that at the moment.
[QUOTE=WalkingZombie;46967582]Brilliant question, and I have a similar one. Is it possible to search for / seek out servers with specific gamemodes in-game (so in a server), and have players join a found server? Idk how to better describe it. You're in a server, you browse for servers while actually playing (you dont press ESC or ~), you join a server you found. [editline]19th January 2015[/editline] It's also a question if I can share data between servers, like player stats. If you leveled up in "Jon's Gaming" server, and traveled to "Martha's Gaming" server, the stats would be the same? (without saving files to the client, cus people would cheat) of course hopefully a safe way, that would NOT trigger antivirus, antispyware, and not in anyway that seems like a hack.[/QUOTE] If you don't want to share a database then I guess you could make a sort of save code system? hash/encrypt a stat that is bound to the player's steamid and save it to the client, never let the secret you used to hash/encrypt with leave the server.. then verify the code that the client has when they join, using your secret (by either re-hashing a saved plain text value that is the same value as the hashed one, or decrypting).
[QUOTE=Robotboy655;46968648]There is no way you can do that at the moment.[/QUOTE] Do what? I put two questions :v:
[QUOTE=Robotboy655;46968648]There is no way you can do that at the moment.[/QUOTE] There might not be a direct way, but we can certainly conjure it from the tools we have available. [code] function PrintNameForVehicle( ent ) local result = "N/A" for k, v in pairs( list.GetForEdit( "Vehicles" ) ) do --Not editing, but it skips a call to table.Copy if ent:GetModel( ) == v.Model and v.Class == ent:GetClass( ) then return v.Name end return result end[/code] It isn't 100% accurate - if, for some reason, someone had a vehicle with the same class and model, but something different happens when it spawns ( the jeep with the gun enabled, airboat with the gun enabled come to mind ), it will select whichever one is in the list first - this may or may not be desirable.
[QUOTE=Kogitsune;46968900]There might not be a direct way, but we can certainly conjure it from the tools we have available. [code] function PrintNameForVehicle( ent ) local result = "N/A" for k, v in pairs( list.GetForEdit( "Vehicles" ) ) do --Not editing, but it skips a call to table.Copy if ent:GetModel( ) == v.Model and v.Class == ent:GetClass( ) then return v.Name end return result end[/code] It isn't 100% accurate - if, for some reason, someone had a vehicle with the same class and model, but something different happens when it spawns ( the jeep with the gun enabled, airboat with the gun enabled come to mind ), it will select whichever one is in the list first - this may or may not be desirable.[/QUOTE] Works. Thank you. Now, how does one get a state of a locked/unlocked door/vehicle? I saw some mods displaying a lock if i remember right.
That can only be done on the server currently - doors you can check with ent:GetSaveTable( ).m_bLocked and then network that to the client, vehicles are probably the same but I'd have to go root in the sdk to find out - you can just print the table that GetSaveTable returns to find the value.
[QUOTE=zerf;46968101]sql. Also about coroutines, not sure if they're the same in GLua but this chapter of PiL should help: [URL]http://www.lua.org/pil/9.1.html[/URL][/QUOTE] Someone else on steam recommended sql, for sharing data between servers. I have no idea how to use it though! I don't quite understand the relevance of coroutines. Would that be for finding servers? [editline]19th January 2015[/editline] [QUOTE=Blasteh;46968690]If you don't want to share a database then I guess you could make a sort of save code system? hash/encrypt a stat that is bound to the player's steamid and save it to the client, never let the secret you used to hash/encrypt with leave the server.. then verify the code that the client has when they join, using your secret (by either re-hashing a saved plain text value that is the same value as the hashed one, or decrypting).[/QUOTE] Sharing a database sounds golden, that is, if it can share between servers. That is yet another thing I believe I do not know how to do. Anything on the client sounds bad, especially since, if I'm hasing / encrypting with Lua code, I believe people can tear my files out of a steam addon cache. In such a case, people could scramble through my code to find the method.
[QUOTE=Kogitsune;46968900]There might not be a direct way, but we can certainly conjure it from the tools we have available. [code] function PrintNameForVehicle( ent ) local result = "N/A" for k, v in pairs( list.GetForEdit( "Vehicles" ) ) do --Not editing, but it skips a call to table.Copy if ent:GetModel( ) == v.Model and v.Class == ent:GetClass( ) then return v.Name end return result end[/code] It isn't 100% accurate - if, for some reason, someone had a vehicle with the same class and model, but something different happens when it spawns ( the jeep with the gun enabled, airboat with the gun enabled come to mind ), it will select whichever one is in the list first - this may or may not be desirable.[/QUOTE] Yes, that is exactly the problem. That's why I finally added something that will help with this in the next version: Vehicle:GetVehicleClass(), that will return the "class name" of the vehicle spawned through spawnmenu, the class name being the one you put in list.Set( "Vehicles", "this_is_vehicle_classname", {} ) so you will be able to get the vehicle table by doing local t = list.Get("Vehicles")[Vehicle:GetVehicleClass()]
I've been trying to create a [B]new[/B] material from some random paint functions but it never seems to exist :( [lua]local cat local mat local rt local function TestFunc() local uid = "testtexture" local w, h = 512, 512 if cat then --surface.SetTexture(surface.GetTextureID(uid .. "mat")) -- broken :( surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect(0, 0, w, h) return end rt = GetRenderTarget(uid, w, h, true) mat = CreateMaterial(uid .. "mat", "UnlitGeneric", {["$basetexture"] = rt}) local oldw, oldh, oldRt = ScrW(), ScrH(), render.GetRenderTarget() render.SetRenderTarget(rt) render.SetViewPort( 0, 0, w, h) render.Clear(0, 0, 0, 255, true) surface.SetDrawColor(50, 50, 255, 255) surface.DrawRect(0, 0, w/2, h/2) render.CopyRenderTargetToTexture(mat:GetTexture("$basetexture")) render.SetViewPort(0, 0, oldw, oldh) render.SetRenderTarget(oldRt) print(mat:IsError(), surface.GetTextureID(uid), surface.GetTextureID(uid .. "mat")) -- prints -- false 37529 37530 --- Missing Vgui material testtexture --- Missing Vgui material testtexturemat cat = true end hook.Add("HUDPaint", "a", TestFunc)[/lua] Textures/Materials confuse me The goal is to for example, render some really complicated texture from some draw functions to a material so the engine only has to draw that texture instead of calling 40-50 draw functions.
[QUOTE=OzymandiasJ;46969777]I've been trying to create a [B]new[/B] material from some random paint functions but it never seems to exist :( [/QUOTE] if you have mat, can't you just use surface.SetMaterial(mat)? do you need to use surface.GetTextureID? you also may need to call cam.Start/End2D() before and after you draw to the render target
[QUOTE=PortalGod;46969804]if you have mat, can't you just use surface.SetMaterial(mat)? do you need to use surface.GetTextureID? you also may need to call cam.Start/End2D() before and after you draw to the render target[/QUOTE] I was just using that to debug, seeing as it's obviously not going to render if the base texture doesn't exist. Same result with surface.SetMaterial
[lua]local name = 'mcrt'..CurTime() local rt = GetRenderTarget(name, w*16, h*16, true) local mat = CreateMaterial(name, 'UnlitGeneric', { ["$basetexture"] = name, ["$vertexcolor"] = 1 }) local oldrt = render.GetRenderTarget() local oldw, oldh = ScrW(), ScrH() render.SetRenderTarget(rt) render.Clear(255, 255, 255, 0, true) render.SetViewPort(0, 0, w*16, h*16) cam.Start2D() --draw stuff cam.End2D() render.SetViewPort(0, 0, oldw, oldh) render.SetRenderTarget(oldrt) return mat[/lua] this is out of an old gamemode, works fine for me
[QUOTE=PortalGod;46970042] this is out of an old gamemode, works fine for me[/QUOTE] it was because I was trying to make the basetexture the RenderTarget... ["$basetexture"] = rt du
Does anyone know where I could get started in coding HLSL and DirectX stuff for Gmod? I got the (learning how to code HLSL down) My problem is how to do it for Source.
Blargh.... Honestly I have no idea what I've done, ENT:Think isn't working. I keep adding and changing stuff, so it's become a mess. Any ideas as to why this would simply not work without erroring would be great, thanks! Seriously, Print doesn't even work. [CODE]function ENT:Think() print("loltest") local vPoint = self:GetPos() local effectdata = EffectData() effectdata:SetStart( vPoint ) effectdata:SetOrigin( vPoint ) effectdata:SetScale(1) //util.Effect( 'alien_flare_fire', effectdata ) if (self:IsOnGround()) then print("Parachuted") self:EmitSound('npc/combine_soldier/zipline_clip2.wav', 100) local ParaAB = ents.Create("parachute_flattened") if ( !IsValid( ParaAB ) ) then return end //ParaAB:SetPos(v:GetPos() + v:GetUp()*115 + v:GetForward()*10) ParaAB:SetPos(self:GetPos() + self:GetUp() + self:GetForward()*10) ParaAB:SetAngles(self:GetAngles()) ParaAB:Spawn() return true; end end[/CODE]
How can I emit a blood particle from an entity similar to how the blood splatters from an NPC when shot?
I'm looking to add 3d2d text above players heads, and I can get it to display and position properly, but I can't get the angle right. I want it to always face the player who is looking at them. Any help?
[QUOTE=stupid-;46971154]I'm looking to add 3d2d text above players heads, and I can get it to display and position properly, but I can't get the angle right. I want it to always face the player who is looking at them. Any help?[/QUOTE] (vec1 - vec2):Angle()
[QUOTE=Robotboy655;46971234](vec1 - vec2):Angle()[/QUOTE] Thanks for the help but now I just can't get it to appear at all =/ Anything more specific?
Sorry, you need to Log In to post a reply to this thread.