• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
Getting a weird error from this code local HintText = {} HintText.font = "FONT_WeaponEntitySmall" HintText.xalign = ScrW() - 6 - ( x + 20 ) HintText.yalign = TEXT_ALIGN_TOP HintText.color = Color( 26, 117, 255, Alpha ) HintText.outlinewidth = 2 HintText.outlinecolor = Color( 26, 117, 255, Alpha ) HintText.text = Hint.Text local x2 = ScrW() - 6 - ( x + 17 ) local y2 = Height + 6 + 1 * ( Hint_Text_Height - 13 ) HintText.pos = { x2, y2 } draw.SimpleTextOutlined( HintText ) [ERROR] lua/includes/modules/draw.lua:103: attempt to perform arithmetic on local 'outlinewidth' (a nil value) Error comes from the draw.SimpleTextOutlined( HintText ) line.
CUserCmd/GetMouseX and CUserCmd/GetMouseY can be used to get the mouse speed - the actual angle that turns the player depends on their sensitivity setting.
Hey guys. I'm using @FPtje MySQLite Module (MySQLite). But when I try to include it in init.lua I get this error: [ERROR] gamemodes/alpharp/gamemode/libraries/mysqlite/mysqlite.lua:135: Couldn't load module library! 1. require - [C]:-1 2. loadMySQLModule - gamemodes/alpharp/gamemode/libraries/mysqlite/mysqlite.lua:135 3. unknown - gamemodes/alpharp/gamemode/libraries/mysqlite/mysqlite.lua:144 4. include - [C]:-1 5. unknown - gamemodes/alpharp/gamemode/init.lua:21 This only happen when MySQL is enabled in the MySQL Config. If it is disabled everything is fine. I hope somenone can help me. Your Alphaverse
You either need MySQLOO or tmysql4
I know. Both is installed correctly. And the MySQL Config is also setup correctly.
The error would only occur when the module fails to load (doesn't exist or isn't compatible with your system). What OS is your server on, and what is the name of the module and path to it?
The server is on linux. The mysql modules are in lua/bin/ and are called "gmsv_mysqloo_linux.dll" "gmsv_tmysql4_linux.dll" My preferred module is set to "mysqloo".
Do you have libmysqlclient.so installed on your server?
i don't know. It was all pre-installed. But MySQL things of other scripts are working. Only MySQLite in my Gamemode is giving me this error. Scripts like GExtension, which also uses mysql are working completly fine.
You're passing a table where it's expecting a vararg. You could either just put in each value independently, or you could do it the 'fun' way with varargs. With varargs, you'll need to restructure your table so that it's numerically indexed in the order of expected arguments for draw.SimpleTextOutlined, then unpack the table as the argument. If you don't get what I mean: local HintText = {} HintText.outlinewidth = 2 HintText.text = Hint.Text //snipped to shorten, but just what you'd done draw.SimpleTextOutlined( HintText ) //Won't work because this function doesn't expect a table as first argument vs local HintText = { Hint.Text, "FONT_WeaponEntitySmall" //rest of the arguments in order go here } draw.SimpleTextOutlined( unpack(HintText) ) //Will work because our elements are in the expected order See the vararg Category for some more information on varargs.
My nextbot keeps getting stuck on stairs, if I try to walk up a stairway, he gets caught on the side and can't walk around the wall. I keep updating his path, but he makes the same path over and over again, he keeps trying to take the shortest path only, and only moves along the edges/corners of navmeshes unless his objective is not on that. Any idea how to not make him walk along the edges only and properly generate a new path?     function ENT:FollowRecruiter( options )         if IsValid(self.Recruiter) and self.Recruited then             local navs = navmesh.Find(self:GetPos(), math.random(1,1), 40, 40)             local nav = navs[math.random(1,#navs)]             local pos = nav:GetCenter()             local options = options or {}             local path = Path( "Chase" )             path:SetMinLookAheadDistance( options.lookahead or 5 )             path:SetGoalTolerance( options.tolerance or 110  )             path:Compute( self, self.Recruiter:GetPos() )      -- Compute the path towards the enemy's position             if self:HaveTarget() then                 path:SetGoalTolerance(options.tolerance or 10000)                 self.loco:SetMaxYawRate(500)                 self.loco:FaceTowards(self.Target:GetPos())             end             if (!self.Recruiter:Alive()) then                 self.loco:SetDesiredSpeed(0)                  self:Remove()                 net.Start("Dead")                 net.Send(self.Recruiter)             end             if ( !path:IsValid() ) then coroutine.yield() end             while ( path:IsValid() ) do                 if ( path:GetAge() > .3 ) and (!self:HaveTarget()) and self.ShouldReset then                 -- Since we are following the player we have to constantly remake the path                     path:Compute( self, self.Recruiter:GetPos() )-- Compute the path towards the enemy's position again                     path:Draw()                 end                 path:Update( self )                            -- This function moves the bot along the path                 if ( options.draw ) and (!IsValid(self.Target)) then path:Draw() end                 -- If we're stuck then call the HandleStuck function and abandon                 if IsValid(self) and ( self.loco:IsStuck() ) then                     self.loco:ClearStuck()                     return "stuck"                 end                 if path:GetStart() == path:GetPositionOnPath(path:GetCursorPosition()) then                     self.ShouldReset = false                     timer.Simple(1, function()                         if path:GetStart() == path:GetPositionOnPath(path:GetCursorPosition()) then                             path:Invalidate()                             path:SetMinLookAheadDistance( options.lookahead or 500 )                             path:SetGoalTolerance( options.tolerance or 220  )                             timer.Simple(2,function()                                 self.ShouldReset = true                             end)                         end                     end)                     path:Update(self)                 end                 coroutine.yield()             end             return "ok"         end     end
I've been having this issue where the bullet particle created from Entity:FireBullets() isn't in sync with the actual bullet. Here's a video of said discrepancy: GIF And here's the code that gets executed: -- lua\entities\turret_gun\init.lua function ENT:ShootAt(ent) local ammo = self:GetAmmo() if (ammo > 0) then self:SetAmmo(ammo - 1) local src = self:GetPos() + self:GetUp() * 32.9 + self:GetForward() * - 16 local dir = (ent:EyePos() - src):GetNormalized() local bulletInfo = {} bulletInfo.Damage = 5 bulletInfo.Force = 2 bulletInfo.Num = 1 bulletInfo.Tracer = 1    bulletInfo.Dir = dir bulletInfo.Spread = Vector(0.05, 0.05, 0) bulletInfo.Src = src bulletInfo.IgnoreEntity = self:GetParent() self:FireBullets(bulletInfo, false) self:EmitSound("weapons/ar2/fire1.wav", 100, 100, 0.25, CHAN_AUTO) end end Which is called from: -- lua\entities\turret_base\init.lua function ENT:Think() local targets = ents.FindByClass("npc_*") if (table.Count(targets) < 1) then return end local distance = math.huge for i, target in pairs(targets) do local targetDistance = self:GetPos():Distance(target:GetPos()) if (targetDistance < distance) then distance = targetDistance self:SetTarget(target) end end self:GetGun():LookAt(self:GetTarget()) self:GetGun():ShootAt(self:GetTarget()) end
Anyone some ideas?
I will *bump* I want more information how I can catch entities on erroring
I tried as you suggested and moved the function but the problem still persists. To better explain what the issue is i made the following picture: https://files.facepunch.com/forum/upload/170263/31aed2fd-e107-4af8-af0a-3c2b6d832993/Capture.PNG As of right now, the bullet is "fired" from the green dot so the ray-tracing for the impact is calculated correctly both server-side and client-side. The only issue is that the client is sees the bullet particles being shot from the red dot (origin of the entity). Here's the video from the previous post for more reference: GIF
WEAPON/GetTracerOrigin would fix it if you were using a weapon, but there is no entity equivalent. You may just have to disable tracer effects from FireBullets and draw the tracer yourself.
Okay, i'll see what i can do. Thank you both @moat and @code_gs for your time.
quick question; I've been searching for a couple days but I can't anything on it... is it possible to customize the killfeed with custom fonts, images, etc.?
killicon.AddFont or killicon.Add
Thanks! I was just searching for killfeed
The font is hardcoded: garrysmod/cl_deathnotice.lua at 784cd57576d85712fa13a7cea3a9523b.. You will have to override DrawDeathNotice
Oof... here we go again... I hate the GM functions but thank you for pointing me in the right direction.
I haven't touched gmod in a while and got a bit rusty apparently. Does the function given to http://wiki.garrysmod.com/page/duplicator/RegisterEntityModifier ever run clientside? How do I send something from the server to the client in such a way that, if an entity has just been created (e.g. in the same function where I want to do this), the message will only arrive after the entity is valid on the client? Net messages are too fast apparently.
The safest bet would be an NW or DTVar so that all the data is sent together. Alternatively, you can send the entity index in a net message, and in the receive, you can check if the entity has been created yet, and if not, declare an OnEntityCreated or NetworkEntityCreated hook waiting for the entity to be received from the server. This method will require some form of timed-network verification in the case entity is never received and you don't have a dummy hook waiting for an entity to arrive that never will.
I think those functions have client cases only because they are also called from other places in the code, some of which are clientside.
We are hosting a DarkRP Server which has around 160 addons. 134 of these addons are automatically added to the download list of clients so if people who dont have our collection (so every person that joins the first time) they have to download 134 addons..which will take hours and no one will join like that just to test out a server the first time. So is therew a way to edit what addons get downloaded? Also can we add the Map to FastDL? Best cirtumstances would be if a client who joins the first time downloads the map so he doesnt get that shit "missing map, disconnetd" crap, and nothing else. SO he only download the map and maybe some little addons that are needed so they have join really quick, and then get the collection later. Because i see in the console often people joining but then disconnecting because it takes way too long to join the first time..we never get new players like that..
Remove unwanted addons from your resource.AddWorkshop file.
I am trying to debug some issues on my server does anyone know how to correctly use voice_printtalkers?Thanks
I've been trying to create a SWEP that fires bursts of varying count the longer you hold the trigger. Tapping during free aim does semi-automatic and/or slow automatic fire much like the default Pistol weapon. Tapping while aiming does semi-automatic fire with an intentional "trigger delay" for each shot, based on a variable. Holding while aiming 'charges' the burst up to as much as four rounds, resetting to 1 round if held long enough. I'm running into an issue and I'm having trouble finding out what's wrong. Sometimes firing in free aim won't work at all, and sometimes firing while aiming won't work at all, or will stop working after the first shot. Here's the function that handles this madness: function SWEP:FireListen() local c1 = self:Clip1() if self:GetModeing() then return end local ShotsCharged = self:GetShotsCharged(0) if !self:GetAiming() then if self.Owner:KeyDown(IN_ATTACK) then self:SetFireStart(CurTime()) self:EmitSound( QueueSound, 75, 100, .6, CHAN_STATIC ) self:SetShotsCharged(0) self:NewPrimaryAttack() end return end if self.Owner:KeyPressed(IN_ATTACK) && c1 > 0 && ShotsCharged <= 0 then self:SetFireStart(CurTime()+self.Primary.TriggerDelay) self:EmitSound( QueueSound, 75, 100, .6, CHAN_STATIC ) self:SetShotsCharged(ShotsCharged+1) end if self.Owner:KeyDown(IN_ATTACK) && c1 > 0 then if ShotsCharged < 4 && self:Clip1() > ShotsCharged && CurTime() > self:GetFireStart(CurTime()+100)+.3 then self:SetShotsCharged(math.min(ShotsCharged+1,self:Clip1())) self:EmitSound( QueueSound, 75, 100, .6+(ShotsCharged*.1), CHAN_STATIC ) self:SetFireStart(CurTime()) elseif ShotsCharged >= math.min(self:Clip1(),4) && CurTime() > self:GetFireStart(CurTime()+100)+.9 then self:SetShotsCharged(1) self:EmitSound( BurstSound ) self:SetFireStart(CurTime()+100) end else if CurTime() >= self:GetFireStart(CurTime()) && ShotsCharged > 0 then if self:GetShotsCharged(0) > 1 then self:SetMode(true) else self:SetMode(false) end self:NewPrimaryAttack() self:SetShotsCharged(1) self:SetFireStart(CurTime()+100) end end if self.Owner:KeyReleased(IN_ATTACK) then -- if self:GetFireStart() > CurTime()+self.Primary.TriggerDelay then self:SetFireStart(CurTime()-.1) end if CurTime() > self:GetFireStart(CurTime()+100) && ShotsCharged > 0 then if self:GetShotsCharged(0) > 1 then self:SetMode(true) else self:SetMode(false) end self:NewPrimaryAttack() self:SetShotsCharged(0) elseif c1 <= 0 && CurTime() > self:GetNextPrimaryFire() then self:NewPrimaryAttack() end end end I'm sure there's some optimization that could be done, but that's not what I'm asking. Could someone please help me figure out why sometimes it won't fire until I try to fire in the opposite aiming mode? (If aiming won't fire, free aim fire might work, and vice versa) I think it's related to the ShotsCharged variable. Notes: SWEP:NewPrimaryAttack() replaces the default SWEP:PrimaryAttack() function, which simply returns when called. Burst firing is handled in another function as well. I'm not finding any issues with either of those functions. Everything worked up until a certain point when I was writing the code I pasted in this message. I did not erase or add any comment lines when I pasted the code in this message.
Is there a way to "kick" a player while he's connecting to the server ? Because using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CheckPassword]GM:CheckPassword[/url] can't work with any asynchronous utilities (like MySQL).
Sorry, you need to Log In to post a reply to this thread.