• What do you need help with? V3
    6,419 replies, posted
I've been trying to get a basic SNPC working, copied the code from: [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexde03.html[/url] Replaced: [code]self:CapabilitiesAdd( CAP_MOVE_GROUND | CAP_OPEN_DOORS | CAP_ANIMATEDFACE | CAP_TURN_HEAD | CAP_USE_SHOT_REGULATOR | CAP_AIM_GUN )[/code] for: [code]self:CapabilitiesAdd(bit.bor( CAP_MOVE_GROUND, CAP_OPEN_DOORS, CAP_ANIMATEDFACE, CAP_TURN_HEAD, CAP_USE_SHOT_REGULATOR, CAP_AIM_GUN))[/code] and I'm getting the following errors: [code][ERROR] lua/includes/modules/ai_task.lua:117: bad argument #1 to 'RunEngineTask' (number expected, got nil) 1. RunEngineTask - [C]:-1 2. Run - lua/includes/modules/ai_task.lua:117 3. RunTask - gamemodes/base/entities/entities/base_ai/schedules.lua:148 4. DoSchedule - gamemodes/base/entities/entities/base_ai/schedules.lua:71 5. unknown - gamemodes/base/entities/entities/base_ai/schedules.lua:22[/code] Can someone point me in the right direction, I can't find anything to help... Edit: [b]"Garry removed snpc functions a while ago while he works on better alternatives. Who knows why he removed them before any were added... "[/b]
you can use gui.EnableScreenClicker(bEnable) which allows you to use the mouse while still enabling you to use your binds.
Perp for gmod 13 private message im payings with cookies i mean money.
SV_CreatePacketEntities: GetEntServerClass happens when a ragdoll is removed. What causes this? :)
EDIT: FIXED (Thanks to Chessnut for pointing out my silliness) by centring the image then drawing it outside a 2D3D block [lua] local plyeye = LocalPlayer():EyeAngles() local warningAngle = Angle(0, plyeye.y - 90, 90) local point = Vector(0,0,0) cam.Start3D2D( point, Angle(0, 0, 0), 1 ) draw.TexturedQuad { texture = surface.GetTextureID "cubejailbreak/marker", color = Color(200, 200, 200, 255), x = 0, y = 0, w = 80, h = 80 } cam.End3D2D() cam.Start3D2D( point, warningAngle, 1 ) draw.TexturedQuad { texture = surface.GetTextureID "cubejailbreak/warning", color = Color(200, 200, 200, 255), x = 0, y = 0, w = 60, h = 60 } cam.End3D2D() cam.End3D(); [/lua] At my wits end here. I need to draw a 2D circle flat on the ground. That draws just fine and dandy. The next draw/2D3D cam is supposed to draw another texture hovering above the circle on the ground and facing the player. I got it to face the player just fine, however the problem comes when viewing the point from different angles. Below is a picture starting at rotation 0, ending at 360 in increments of 90 degrees anticlockwise. If you imagine a camera at the "point" vector, this behaviour makes perfect sense. Trouble is, how do I correct it? I would like the hovering texture to always be above the circle on the ground... (shown here on the ground just for ease of seeing what I mean) [img]https://dl.dropbox.com/u/10518681/Screenshots/2012-12-08_00-23-01.jpg[/img] [img]https://dl.dropbox.com/u/10518681/Screenshots/2012-12-08_00-29-11.jpg[/img] [img]https://dl.dropbox.com/u/10518681/Screenshots/2012-12-08_00-29-26.jpg[/img] [img]https://dl.dropbox.com/u/10518681/Screenshots/2012-12-08_00-29-39.jpg[/img] Thanks very much for any help
[QUOTE=Chrik;38744372]SV_CreatePacketEntities: GetEntServerClass happens when a ragdoll is removed. What causes this? :)[/QUOTE] you removed it on the client. Which is a no-no.
How can I assign god mode on a team on spawn for a certain amount of time?
When doing net.SendToServer() clientside, is it possible to get the player that is sending in net.Receive()?
[QUOTE=ms333;38745044]When doing net.SendToServer() clientside, is it possible to get the player that is sending in net.Receive()?[/QUOTE] Yes, net.Receive's callback takes two arguments serverside [lua]local function netHelloWorld(len, ply) print(ply:Nick() .. 'says, "Hello, world!"') end net.Receive("helloworld", netHelloWorld)[/lua] [QUOTE=Bandit Kitteh;38745004]How can I assign god mode on a team on spawn for a certain amount of time?[/QUOTE] Use ply:GodEnable() when he spawns and create a timer to call ply:GodDisable() on him. Just make sure he's still valid when the timer goes off. [lua]function GM:PlayerSpawn(ply) ... -- Start spawn protection ply:GodEnable() local function unprotect() if IsValid(ply) then ply:GodDisable() end end timer.Simple(30, unprotect) ... end[/lua] Probably a good idea to use a few other hooks to disable spawn protection if he moves too far from his spawnpoint or fires a weapon etc
[QUOTE=ms333;38745044]When doing net.SendToServer() clientside, is it possible to get the player that is sending in net.Receive()?[/QUOTE] [URL="http://wiki.garrysmod.com/page/Libraries/net/Receive"]net/Receive[/URL] It's the second argument? damn it.
How would I color the hands of my weapon that I am holding? This colors the weapon but not my hands: [code] LocalPlayer():GetViewModel():SetColor(Color(50,50,50)) [/code] I've tried multiple combinations but no luck of coloring the hands.
It uses the weapon color thing. player:SetWeaponColor( Vector(0, 1, 0) ) I think.
[QUOTE=Chessnut;38746950]It uses the weapon color thing. player:SetWeaponColor( Vector(0, 1, 0) ) I think.[/QUOTE] [URL="http://wiki.garrysmod.com/page/Classes/Player/SetWeaponColor"]It[/URL] didn't change the color of it. [lua] if SERVER then ply:SetWeaponColor(Vector(1,0,0))--inside concommand else LocalPlayer():SetWeaponColor(Vector(1,0,0)) end [/lua] Assuming it doesn't work for most models.
Here's what I use clientside and it works, don't know why yours doesn't work. [lua] local self = LocalPlayer() -- Set our viewmodel color self:GetViewModel():SetColor( self.viewModelColor ) self:GetViewModel():SetRenderMode( RENDERMODE_TRANSALPHA )[/lua]
[QUOTE=CrashLemon;38747090]-bad reading-[/QUOTE] I said it doesn't change the color of the [B][U]hands[/U][/B] and arms, it works perfectly fine on the weapon.
[QUOTE=brandonj4;38747142]I said it doesn't change the color of the [B][U]hands[/U][/B] and arms, it works perfectly find on the weapon.[/QUOTE] It does change colors of hands here. That's why I'm wondering why yours doesn't work. [B]Edit[/B]: Although I just found out that it works on CS:S models and not HL2 models. [B]Edit 2:[/B] I'm wondering why you assumed that I misread your post yet I never mentioned in mine that it only colored the weapon.
[QUOTE=CrashLemon;38747186]It does change colors of hands here. That's why I'm wondering why yours doesn't work. [B]Edit[/B]: Although I just found out that it works on CS:S models and not HL2 models. [B]Edit 2:[/B] I'm wondering why you assumed that I misread your post yet I never mentioned in mine that it only colored the weapon.[/QUOTE] Yeah sorry, I figured it should work on all models but I was testing it on a hl2 pistol. [editline]7th December 2012[/editline] I tried doing what you suggested with the Fog and in gm_flatgrass, [B]the color will not change on the fog in the skybox.[/B] [lua] local fog = ents.FindByClass("env_fog_controller") if fog[1] then -- PrintTable(fog[1]:GetKeyValues()) fog[1]:SetKeyValue("fogcolor", "0 0 0") fog[1]:SetKeyValue("fogstart", "1") fog[1]:SetKeyValue("fogend", "9000") end local skycam = ents.FindByClass("sky_camera") if skycam[1] then -- PrintTable(skycam[1]:GetKeyValues()) skycam[1]:SetKeyValue("fogcolor", "0 0 0") skycam[1]:SetKeyValue("fogstart", "1") skycam[1]:SetKeyValue("fogend", "9000") end [/lua]
[QUOTE=Trumple;38740832]Post the code[/QUOTE] I forgot, sorry. [lua] local parent, size, bone, pos, ang, mod, and_offset function ENT:Initialize() --mod = ClientsideModel(self:GetModel()) end local LocalPlayer = LocalPlayer function ENT:Draw() parent = parent or self:GetDTEntity(1) size = size or self:GetDTFloat(1) vector = vector or hats[self:GetDTFloat(2)].vector_offset ang_offset = ang_offset or hats[self:GetDTFloat(2)].ang_offset bone = bone or parent:LookupBone( self:GetDTString( 1 ) ) pos, ang = parent:GetBonePosition(bone) --mod = mod or ClientsideModel( self:GetModel() ) /*if offset then mod:SetRenderOrigin( pos + self:offset(pos, ang )) else mod:SetRenderOrigin( pos ) end mod:SetRenderAngles( ang ) mod:SetModelScale( size, 1 ) mod:SetupBones() mod:DrawModel()*/ if parent == LocalPlayer() then return end if vector then self:SetRenderOrigin( vector( pos, ang ) ) else self:SetRenderOrigin( pos ) end if ang_offset then ang_offset(ang) self:SetRenderAngles( ang ) else self:SetRenderAngles( ang ) end self:SetModelScale( size, 1 ) self:SetupBones() self:DrawModel() end[/lua] All of the DTVars exist, all of the functions exist, i have even made debug prints to make sure, so that's not the case. The model just dissappears when facing a certain direction. I can't record it on a video cause my pc is slightly more powerfull than a microwave.
Hi. Is there a way to delete all contents from a sheet? There's an AddSheet() function, but I'm missing something like ClearSheet(). :/ [B]DPropertySheet [/B][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexb285.html[/url] [B]Edit 1:[/B] I think this problem may be solved. :P Looks like ULX Lib has a useful function for this. Now I'll just have to figure out how to use it. /reading Oh, and here's the link if somebody is interested in this: [url]https://gist.github.com/SticklyMan/xgui/blob/master/lua/ulx/modules/cl/xgui_helpers.lua[/url] [B]Edit 2:[/B] Okay, this Clear() function seems to be enabled by default and works fine so I assume maurits wiki is outdated? :P
[QUOTE=TNOMCat;38700655]Is it possible to hook a collision check to a "no-collide with everything" entity? Like when another entity tries to touch the no-collide entity. I tried the ShouldCollide hook but it didnt seem to work at all with anything[/QUOTE] still wondering this
Ever since the kinect update, mysql queries on my server take ages to run the callback, anyone got a solution to this?
[QUOTE=Matt W;38750708]Ever since the kinect update, mysql queries on my server take ages to run the callback, anyone got a solution to this?[/QUOTE] Working fine for me, is this mysqloo or tmysql?
[QUOTE=Drakehawke;38750795]Working fine for me, is this mysqloo or tmysql?[/QUOTE] mysqloo, it starts at around 40 players. Takes ages to execute the query
[QUOTE=Matt W;38750837]mysqloo, it starts at around 40 players. Takes ages to execute the query[/QUOTE] Are you calling db:status() to check if the database is connected before you run each query?
[QUOTE=Drakehawke;38750860]Are you calling db:status() to check if the database is connected before you run each query?[/QUOTE] Nope, this is the code i'm using for queries [lua] function DB:Query(query, callback, test) if !query then -- Check to make sure the right args are being passed print("Error executing query, no query specified.") return else local q = DB:query(query) -- Execute the query if !q then return end function q:onSuccess(data) -- If query is success if callback then callback(data) end end function q:onError(err, qur) -- If it fails print("Error executing query, "..qur.." with error: "..err) end q:start() end end [/lua]
i searched for dbutton toggle functionality and there were posts saying that it exists, but i have no idea how to do it. should i just make a var toggle? or is there a visually represented dbutton toggle thing im not seeing?
Any ideas why this: [code]local effectdata = EffectData() effectdata:SetEntity( self.Entity ) util.Effect( "lightsaber_blade", effectdata )[/code] won't create the damn effect for some people?
[QUOTE=Robotboy655;38752312]Any ideas why this: [code]local effectdata = EffectData() effectdata:SetEntity( self.Entity ) util.Effect( "lightsaber_blade", effectdata )[/code] won't create the damn effect for some people?[/QUOTE] not sure why but effects in workshop addons break alot
[QUOTE=Robotboy655;38752312]Any ideas why this: [code]local effectdata = EffectData() effectdata:SetEntity( self.Entity ) util.Effect( "lightsaber_blade", effectdata )[/code] won't create the damn effect for some people?[/QUOTE] Try using self, self.Entity just re-routes to the entity garry even wanted to remove it I think.
Can someone tell me what [b][url=http://wiki.garrysmod.com/page/Classes/Weapon/CallOnClient]Weapon:CallOnClient()[img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] exactly does? Is it a single function which gets called on the client or does it make the whole weapon script to be called on the client?
Sorry, you need to Log In to post a reply to this thread.