• What do you need help with? V3
    6,419 replies, posted
What I need help with: Making E2 a VIP only feature (Obv admins can use too....) I'm using the ULX admin mod and its for my DarkRP. I'm using the latest version of DakRP and Wiremod, and ULX. I can pay if necessary. Add me on steam please.
[QUOTE=Kamshak;39690713]does anyone know of a lua OO script that will allow me to have classes and inheritance? i found [url]http://lua-users.org/wiki/ClassesAndMethodsExample[/url] but it is unclear to me how i would go about overwriting super class methods. what i need is class methods, that i can overwrite but still access the superclass method.[/QUOTE] I think this is what you need: [url]http://lua-users.org/wiki/ObjectOrientationClosureApproach[/url]
Hey. I am wondering how to disable vehicle spawning for admins and also making it so admins cant just set themselves or others on a team. thanks I have ulx and fadmin. I am running a DarkRP uptodate server.
I'm having a lot of difficulty finding a good example of this; how do you create your own ammo types? I want to create an ammo called "ion_battery" or "plasma_battery" as well as maybe "pulse_battery" but I have no idea on how I could do that. And this is dumb... why?
Hi there! I'm having issues with my provider/pdata ever since updating to the latest github stuff. So I'm getting the error of Missing provider: etc etc etc. My PS.Config.DataProvider = 'pdata', and my pdata looks like this:[CODE]function PROVIDER:GetData(ply, callback) return callback(ply:GetPData('PS_Points', 0), util.JSONToTable(ply:GetPData('PS_Items', '{}'))) end function PROVIDER:SetData(ply, points, items) ply:SetPData('PS_Points', points) ply:SetPData('PS_Items', util.TableToJSON(items)) end[/CODE] Just copy and pasted from my pointshop thread. Really confused on this issue.
And this forum seems dead right now... Yeah, sure, this comment seems dumb, doesn't it? Well, when I posted it I could hear my echos in this forum, so to speak. I suppose I didn't think about the future, if anyone has the nerve, patience and bravery to look back at old posts then this post doesn't make much sense...
[LUA] hook.Add("HUDPaint", "Faringitis", function() local ply = LocalPlayer() local Health = LocalPlayer():Health() if ply:InVehicle() then surface.SetDrawColor(255,255,0,150) surface.DrawRect(15, 15, 150, 150) end [/LUA] [ERROR] gamemodes/dragracer/gamemode/vehiclehud.lua:15: attempt to call method 'InVehicle' (a nil value) 1. unknown - gamemodes/dragracer/gamemode/vehiclehud.lua:15 --EDIT-- I'm confused, InVehicle is a shared value, why won't it work clientside? -- EDIT #2 -- It was checking for LocalPlayer():InVehicle() before LocalPlayer() was Valid, so it was just breaking the hook, I added an IsValid check before it, works like a charm!
Okay, well I got my own ammo made, but how do I check if a player is "picking me up"? That is, how do I get the swep to run a function when it's picked up by the player and the player already has a copy of it? [editline]24th February 2013[/editline] <snip>
[QUOTE=luavirusfree;39694429]Okay, well I got my own ammo made, but how do I check if a player is "picking me up"? That is, how do I get the swep to run a function when it's picked up by the player and the player already has a copy of it? [editline]24th February 2013[/editline] <snip>[/QUOTE] Would you be able to use networked values?
[QUOTE=Minteh Fresh;39694498]Would you be able to use networked values?[/QUOTE] What do you mean? [editline]24th February 2013[/editline] I have a weapon where SWEP.Primary.DefaultClip = 0. It is scripted to give the owner 100 of a custom ammo when picked up, but it won't give any when you pick it up after you already have the weapon. I'm using think to give you the first 100, and clip size is 100. [editline]24th February 2013[/editline] I suppose I could just give it a default clip size, but I would prefer not to. Is there a way to do this without it?
When you call "Oh hey I'm getting picked up" check if they already HAVE the weapon, and then check if he has ammo. When I made custom ammo, I made it all through Networked Variables. Player:SetNWInt("LASERAMMO", Player:GetNWInt("LASERAMMO") + 100) or however you want to go about it. And then when I shot, I'd do, Player:SetNWInt("LASERAMMO", Player:GetNWInt("LASERAMMO") - 1) it's probably a stupid way of doing it, but it worked for me.
What are the causes of a player not getting Keys in DarkRP and the /buy not working?
I'm using real ammo and not variables. [lua]game.AddAmmoType( { name = "ion_battery", dmgtype = DMG_PLASMA, tracer = TRACER_LINE, plydmg = 4, npcdmg = 4, force = 2000, minsplash = 5, maxsplash = 10 } )[/lua] I just want to know HOW to call any code when it gets picked up so I can add ammo to the one that touched it.
Not quite understanding why when I try to call [lua] if target:InVehicle() [/lua]when hooking it with EntityTakeDamage it's nil, but this does not say it's nil? [lua] for k,v in pairs (player.GetAll()) do if v:InVehicle() print("Someone's In a Vehicle") end end [/lua] Edit: Actually I think it's calling the target as the vehicle and not a player which would make sense...Answered my own question I guess.
Is there any way to call code when the weapon is within A player's ammo/weapon pickup zone? A way to run code when the player walks near the weapon, making the weapon disappear?
[QUOTE=luavirusfree;39695246]Is there any way to call code when the weapon is within A player's ammo/weapon pickup zone? A way to run code when the player walks near the weapon, making the weapon disappear?[/QUOTE] You could use one of these: [url]http://wiki.garrysmod.com/page/Libraries/ents/FindInSphere[/url] [url]http://wiki.garrysmod.com/page/Classes/Vector/Distance[/url]
I could, I suppose. BTW your avatar creeps me out, it looks like she's rubbing her eye.
[QUOTE=luavirusfree;39695380]I could, I suppose. BTW your avatar creeps me out, it looks like she's rubbing her eye.[/QUOTE] changed it for you bb
What's required to make a scripted ent solid to the physgun? Phys beam goes straight through my entity, but I can still weld it to props so it seems solid to traces. Here's my init function with most irrelevant stuff removed; [lua]DEFINE_BASECLASS("base_gmodentity") function ENT:Initialize() self.Model = "models/missiles/aim54.mdl" self:SetModel( Model(self.Model) ) self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(SOLID_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) local phys = self.Entity:GetPhysicsObject() if IsValid(phys) then phys:Wake() phys:EnableMotion(true) phys:SetMass(100) end self.Owner = self:GetOwner() end[/lua] No other code which messes with the ent physics is invoked.
Need help. I made a SENT that has a derma panel which is opened when you click "E" on it. But more then one frame gets created for some reason, any fixes, or ideas?
I just need to understand why some of my lua updates on sents make clients get kicked. This change: from: [CODE] function SWEP:DropDeagle() [...] self:Remove() end [/CODE] to: [CODE] function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:DropDeagle() self:Remove() end [/CODE] This change made clients get kicked with a CLCopyInvalidEntity or something like this. Is this happening to anyone else? If not then just ignore the question... Thanks for the help =) I really appreciate this kind of initiative.
Quick question since I cant find any quality documentation on cleanup: How can I run 1 type of cleanup, such as cleanup all balloons on server? Ive tried running through all ents on server and if class == "balloon" remove it but it never finds it. Thanks guys.
how do you add something to the entity rightclick menu?
[QUOTE=tissue903;39697478]Quick question since I cant find any quality documentation on cleanup: How can I run 1 type of cleanup, such as cleanup all balloons on server? Ive tried running through all ents on server and if class == "balloon" remove it but it never finds it. Thanks guys.[/QUOTE] It's gmod_balloon, not just balloon [img]http://i.imgur.com/QROldVZ.png[/img]
Is there a better way to go about this? Like DButton.OnHover or something similar? [lua]Button.Think = function( self ) local mx, my = gui.MouseX(), gui.MouseY(); local bx, by = x * 1.60, y * 1.80; local wide, tall = self:GetWide(), self:GetTall(); if ( mx >= bx && mx <= (bx + wide) && my >= by && my <= (by + tall) ) then col = Color( 180, 0, 0, 255 ); else col = Color( 255, 255, 255, 255 ); end end[/lua]
[QUOTE=Annoyed Tree;39699777]Is there a better way to go about this? Like DButton.OnHover or something similar?[/QUOTE] [CODE]Button.OnCursorEntered = function(self) self.Overed = true end Button.OnCursorExited = function (self) self.Overed = false end[/CODE]
[QUOTE=lucasmontec;39696784]I just need to understand why some of my lua updates on sents make clients get kicked.[/QUOTE] Make sure you are not removing entities on the client. Try: [code]if SERVER then self:DropDeagle() self:Remove() end[/code] or [code]if SERVER then self:DropDeagle() SafeRemoveEntityDelayed(self,0) end[/code]
If I have something like this: [lua]local name = (ply.GetRPName and ply:GetRPName()) or ply:Nick();[/lua] That should (theoretically) make name the equivalent to Player.GetRPName(ply) [b]if that function exists[/b], otherwise it would return Player.Nick(ply)? I've never quite understood how that stuff works.
I posted this in the forums but I didn't get any replies. So I'm posting it here. I have three combo boxes which selects a weapon, when the player hits done I need the weapons to spawn in for the player. I'm not really sure how to do that. The weapon1/2/3 are the combo boxes with which the player selects the weapons from. I'm not sure if I'm doing this correctly though. Also is there any way to disable comboboxes when the player hits a checkbox? I looked on the wiki for the checkbox and combobox controls but I couldn't find anything like that. [CODE] button.DoClick = function() base:Close() if weapon1:GetSelectedItems() == 1 then ply:Give( "weapon_stunstick" ) elseif weapon1:GetSelectedItems() == 2 then ply:Give( "weapon_pistol" ) elseif weapon1:GetSelectedItems() == 3 then ply:Give( "weapon_357" ) end if weapon2:GetSelectedItems() == 1 then ply:Give( "weapon_smg1" ) elseif weapon2:GetSelectedItems() == 2 then ply:Give( "weapon_ar2" ) elseif weapon2:GetSelectedItems() == 3 then ply:Give( "weapon_shotgun" ) end if weapon3:GetSelectedItems() == 1 then ply:Give( "weapon_crossbow" ) elseif weapon3:GetSelectedItems() == 2 then ply:Give( "weapon_rpg" ) end end [/CODE]
Ok, I have another problem that is actually really weird. I'm using the net library to send over my Inventory data from the server -> client. However when the client gets the data some of the key and values switch. Meaning I have on the server: [code]PrintName = "PrintName Yay!"[/code] But when I try to get this from the client I get [code]"PrintName Yay!" = PrintName[/code] I'm using [I]net.WriteTable[/I] and [I]net.ReadTable[/I] anybody know if there is a problem with using this? [b]SERVER:[/b] [lua]net.Start( "bs_Inventory" ); net.WriteString( item.Class ); net.WriteTable( self.Inventory[ item.Class ] ); net.Send( self );[/lua] [b]CLIENT:[/b] [lua]net.Receive( "bs_Inventory", function( len ) local str = net.ReadString(); local tbl = net.ReadTable(); if ( !Inventory ) then Inventory = {}; end Inventory[ str ] = tbl; end );[/lua]
Sorry, you need to Log In to post a reply to this thread.