• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
With the code I posted I am already setting the shedule and target before npccop:Spawn() Do you mean to try it after spawning the npc?
I guess my question should be... is it possible to load a website such as Twitch with Lua and display it properly in-game?
https://wiki.garrysmod.com/page/Category:HTML
Whoops. Yeah.
Hello GMod Forum. I've been watching in console for few month a error that pop-upped 5 times in a row after each client that connects to server. As I see, last question about it was asked in 2013. Well, I think it needs a refresh. The error is: Entity:Remove cannot be called while rendering What I need to check for solving it? I tried to find some Entity:Remove() in scripts and make timer(1 or 0 sec). It still continues. Did someone know smth about it?
That error should definitely be fixed with this. timer.Simple(0, function() ent:Remove() end ) And you will only find this error clientside or maybe shared [look for if CLIENT then statements] (because rendering duh). Think of any addons that may make client-side models or modifies the rendering of anything and check those out. Also keep in mind that "ent" is different in every case. For instance -- inside render hook if doneWithPurpouse then print( cEntity:Nick() .. " has served it's purpouse and became self-aware. Assimilation imminent." ) timer.Simple(0, function() cEntity:Remove() end) else cEntity:DrawModel() end
Do anyone knows why this is not working? hook.Add("CreateClientsideRagdoll", "Test123", function(npc,ragdoll)         local newrag = ClientsideRagdoll(npc:GetNW2String("ahr_model"))         newrag:SetPos(ragdoll:GetPos())         newrag:SetAngles(ragdoll:GetAngles())         newrag:SetNoDraw( false )         newrag:DrawShadow( true )                  ragdoll:Remove()     end) The clientside ragdoll is created in a specific position (probably the origin of the map), but the console throws an error, saying "newrag" is nil. For some reason "ClientsideRagdoll()" is not returning anything...
There's a chance you need to ENT:Spawn() it, can't remember. Sounds dumb when I say it. Also try putting it in a shared file But the big problem is that newrag is local to the hook (unless you are determining that it's returning nothing inside of the hook), and also ClientsideRagdoll() might be returning nil because your NW2String request doesn't have a fallback, in case "ahr_model" isn't valid. npc:GetNW2String("ahr_model", "models/player/barney.mdl")
The wiki page for ClientsideRagdoll() states that it isn't necessary to do ENT:Spawn(). I tried, but it still says "attempt to index local 'newrag' (a nil value)". The variable itself is declared inside the hook, and the other lines are in the same level, so they should "see" the variable. GetNW2String appears to be working fine, because the clientside ragdoll is being spawned with the correct model (the one in the networked variable). Anyway, I found the problem. I added a print to the hook and noticed it was printed twice. Apparently, doing ClientsideRagdoll() triggers the "CreateClientsideRagdoll" hook again, but this this time the "npc" variable points to another entity which is not an NPC. Adding a check to that variable solved the problem. However, the clientside ragdoll always spawns at the same spot. SetPos() and SetAngles() don't seem to be affecting it. hook.Add("CreateClientsideRagdoll", "HeadcrabRemoverCL3", function(npc,ragdoll)         if (!npc or !IsValid(npc) or !npc:IsNPC()) then return end         local newrag = ClientsideRagdoll(npc:GetNW2String("ahr_bm_model"),ragdoll:GetModel())         newrag:SetPos(npc:GetPos())         newrag:SetAngles(npc:GetAngles())         newrag:SetNoDraw( false )         newrag:DrawShadow( true )                  ragdoll:Remove()     end)
I have it only clientside. I can't actually find what makes it error
Did now, still the same. I also tried putting it in a simple timer with a small delay to see it happen, and it still doesn't shoot me and only attacks with hits when I am close to the npc.
That's how to load HTML but I don't know if it's enough. I don't think Twitch.tv just uses HTML, and what I want is a way to display the stream itself somewhere, and perhaps a way to integrate with chat. (I'll have to do some external research on that one.) It might be using Flash
Is there a way to have a server side entity exist but only show and interact with certain players? Like is it possible to just make a cube for example and only have player 1 or 2 or even a group of people be able to see it and move it while the rest cannot?
Entity/SetPreventTransmi will stop visibility and networking information clientside for certain players, but will not effect entity-to-player collision and usage. For tose, see GM/ShouldCollide and GM/PlayerUse, respectively.
I'm actually making this cool little ball thing that is an invisible hula doll model with no collide. I then override the rendering with drawSphere (you can probably do this selectively with some networking!) and a PhysicsCollide callback. It ended up getting so complicated I made it it's own SENT. It's not very practical but serves my uses.
What do you suggest?
It depends what you are wanting exactly - sounds exactly like the bouncy ball from your description, but using a spherical physics object would be better than a PhysicsCollide callback.
It removes itself on contact with anything. It has no gravity and no drag. It's just like a bullet. The physics mesh of the hula doll is roughly the same as the sphere. You can't notice it.
That's fine, I thought you were trying to relate it to gononono's post.
Look at Entity/SetPreventTransmit
trying to figure out how to make a if else statement for my fastDL so that only the current map of the server gets downloaded by clients joining rather then EVERY map including ones not currently in use. so far I have this but I'm not sure if I used the game.GetMap correctly. I'm also not sure if it will work right either :/ any thoughts or help would be nice if game.GetMap("map a") then resource.AddWorkshop('ID_A') elseif game.GetMap("map b") resource.AddWorkshop('ID_B') elseif game.GetMap("map c") resource.AddWorkshop('ID_C') elseif game.GetMap("map d") resource.AddWorkshop('ID_D') elseif game.GetMap("map e") resource.AddWorkshop('ID_E') elseif game.GetMap("map f") resource.AddWorkshop('ID_F') elseif game.GetMap("map g") resource.AddWorkshop('ID_G') else game.GetMap("map h") resource.AddWorkshop('ID_H') end --after this all the non-map addons are downloaded
Here's how to do it. Follow this if game.GetMap() == "map a"then resource.AddWorkshop('ID_A') elseif game.GetMap() == "map b" then resource.AddWorkshop('ID_B') --elseif ... the rest else resource.AddWorkshop('ID_H') end
@Bobblehead thank you kindly, really helps me out man ^~^
Or you can make a table, rather than if-else statements local map_id_list = { ["map1_name"] = "WORKSHOP_ID1", ["map2_name"] = "WORKSHOP_ID2" } local id = map_id_list[game.GetMap()] if id then resource.AddWorkshop( id ) end
when I add the code draw.RoundedBox(0,ScrW()/1280*math.max(client:Health(),0)/100*40,ScrH()/1024*710,185,25,Color(255,0,0,200)) draw.RoundedBox(0,ScrW()/1280*math.max(client:Armor(),0)/100*40,ScrH()/1024*745,185,25,Color(0,0,255,200)) https://files.facepunch.com/forum/upload/114360/f0b253a9-eb9a-4aab-9987-bfe7c900f8c6/image.png It does that, it makes go off the screen, not away, does the same for health when it lowers
Firstly, there is no need to use RoundedBox if your bordersize will just be 0, use surface.DrawRect. Next, you are changing the x-coordinate based on the health/armour - you should be changing the width, instead.
oh shit, im dumb, thanks
I am working with attachments right now and I am using ENTITY:SetParent(parent, attachment). It seems that when I do ENTITY:SetLocalPos(Vector(0, 0, 0)) it sets my entity to the origin of the attachment point, which is exactly what I'd expect. However, when I use ENTITY:SetLocalAngles(Angle(0, 0, 0)) it seems to set the angle relative to the parent entity, rather than the rotation of the attachment point. Can anyone confirm that I am not doing something stupid and gmod is indeed broken (as always)?
Bullets irl have gravity and drag. Every time in the past I've tried to create a bullet SENT I've given them some amount of physics simulation for that reason. Just throwing that out there, you do what you want to do and it sounds like to me what you're doing is trying to simulate a slower hitscan bullet. The first comparison that comes to my mind is a plasma bolt from a plasma rifle in Halo CE. I don't understand how a hula doll's collision mesh would offer a better result than a spherical collision box though. Personally I'd default to bugbait.
Any way to get the speed of the player's view? The only way I found to do this is by grabbing the value last frame, subtracting it by the value in the current frame, and then lerping it. It works, however when the player looks in a certain direction, it causes the value to flip by 360 degrees, turning -180 to 180. Kinda annoying because it completely messes up with calculations.
Sorry, you need to Log In to post a reply to this thread.