• What do you need help with V4
    639 replies, posted
DynamicLight is a function, you have to call it.
the default bullet tracer is just a material right? If so, whats the file path?
[lua] local TabOne = vgui.Create( "DPanel" ) TabOne:SetVisible( true ) local Info = vgui.Create("DLabel", TabOne) Info:SetText( [[ Welcome to xenoGamers TTT Rules for players. Rule 1# Valid reason is required before killing or calling out. Rule 2# Accidental RDM(Random Deathmatch) requires that person slay themself. If they do not, they may be kicked. Rule 3# No ghosting or metagaming. Rule 4# Failing to respond to a Detective's livecheck makes a person KOS. Rule 5# Don't revenge RDM. Rule 6# Mic/text chat spam is not allowed. Players must use english! Rule 7# Don't exploit or hack. Rule 8# Be nice. No trolling, abuse, racism or progender. Rule 9# No pornographic sprays. Rule 10# The GMod Division leaders may override rules if needed. Div. Leaders: Charrax. Rule 11# Changing name during round results in a kick. Rule 12# Don't spam chat commands. Rule 13# Prop pushing or killing will be taken as RDM. Rule 14# Don't spam doors. Rule 15# Don't complain about the server. We have a forum for your ideas! Rule 16# If you see a person surrounded by freshly-dead bodies, let them ID the bodies. However, if they leave without ID'ing them, they are KOS. Rule 17# Respect Admins. Don't argue with admins unless they did something unjust. Rule 18# If someone is following you, give them 3 warnings in chat. (You are allowed to bind a key) After the third warning they can be killed. Rule 19# No alliances between Traitors and other teams. Rule 20# When/If there is less then 5 people... Camping is not allowed. Breaking any of these rules will result in a punishment. ]] ) Info:SetTextColor( Color( 0, 0, 0, 255 ) ) Info:SetPos( 5, 20 ) Info:SizeToContents( ) Info:SetVerticalScrollbarEnabled() [/lua] It only goes up to rule 16 then cuts the sentence!
[QUOTE=Charrax;35418368][lua] local TabOne = vgui.Create( "DPanel" ) TabOne:SetVisible( true ) local Info = vgui.Create("DLabel", TabOne) Info:SetText( [[ Welcome to xenoGamers TTT Rules for players. Rule 1# Valid reason is required before killing or calling out. Rule 2# Accidental RDM(Random Deathmatch) requires that person slay themself. If they do not, they may be kicked. Rule 3# No ghosting or metagaming. Rule 4# Failing to respond to a Detective's livecheck makes a person KOS. Rule 5# Don't revenge RDM. Rule 6# Mic/text chat spam is not allowed. Players must use english! Rule 7# Don't exploit or hack. Rule 8# Be nice. No trolling, abuse, racism or progender. Rule 9# No pornographic sprays. Rule 10# The GMod Division leaders may override rules if needed. Div. Leaders: Charrax. Rule 11# Changing name during round results in a kick. Rule 12# Don't spam chat commands. Rule 13# Prop pushing or killing will be taken as RDM. Rule 14# Don't spam doors. Rule 15# Don't complain about the server. We have a forum for your ideas! Rule 16# If you see a person surrounded by freshly-dead bodies, let them ID the bodies. However, if they leave without ID'ing them, they are KOS. Rule 17# Respect Admins. Don't argue with admins unless they did something unjust. Rule 18# If someone is following you, give them 3 warnings in chat. (You are allowed to bind a key) After the third warning they can be killed. Rule 19# No alliances between Traitors and other teams. Rule 20# When/If there is less then 5 people... Camping is not allowed. Breaking any of these rules will result in a punishment. ]] ) Info:SetTextColor( Color( 0, 0, 0, 255 ) ) Info:SetPos( 5, 20 ) Info:SizeToContents( ) Info:SetVerticalScrollbarEnabled() [/lua] It only goes up to rule 16 then cuts the sentence![/QUOTE] Are you using that as 'motd' ?
Hi, for some reason it won't pick up my hat when I want to sell it, instead it lets me buy another hat. To my knowledge this should work. [QUOTE]function store2Menu() local store2Menu = vgui.Create( "DFrame" ) store2Menu:SetPos((ScrW() / 2) -300,(ScrH() / 2) -200) store2Menu:SetSize( 600, 400 ) store2Menu:SetTitle( "Welcome to the "..ServerName.." Store!" ) store2Menu:SetVisible( true ) store2Menu:SetDraggable( false ) store2Menu:ShowCloseButton( false ) store2Menu:MakePopup() local PropertySheet = vgui.Create( "DPropertySheet" ) PropertySheet:SetParent( store2Menu ) PropertySheet:SetPos( 5, 30 ) PropertySheet:SetSize( 590, 365 ) local SheetItemIntro = vgui.Create( "DPanel", store2Menu ) SheetItemIntro:SetPos((ScrW() / 2) -950,(ScrH() / 2) -515) SheetItemIntro:SetSize( 600, 400 ) SheetItemIntro.Paint = function() surface.SetDrawColor( 125, 125, 125, 255 ) surface.DrawRect( 0, 0, SheetItemIntro:GetWide(), SheetItemIntro:GetTall() ) draw.SimpleText("Welcome to the Autisme store!","Default",140,10,Color(255,255,255,255)) draw.SimpleText("In this store, you can buy many items that allow you to upgrade your character","DefaultSmall",85,45,Color(255,255,255,255)) draw.SimpleText("When purchasing items remember the following:","DefaultSmall",175,60,Color(255,255,255,255)) end local DermaListView = vgui.Create("DListView") DermaListView:SetParent( SheetItemIntro ) DermaListView:SetPos(60, 80) DermaListView:SetSize(450, 225) DermaListView:SetMultiSelect(false) DermaListView:AddColumn("") DermaListView:AddLine("Enforcers automatically have sirens on all of their cars.") DermaListView:AddLine("Items may NOT be purchased if you are not a high enough level.") DermaListView:AddLine("Player's may only cary more then two weapons at once.") DermaListView:AddLine("Items can NOT be sent to other players.") DermaListView:AddLine("Once you buy a weapon mod, it cannot be sold.") DermaListView:AddLine("To put a weapon mod on your gun put press F2.") DermaListView:AddLine("Weapon Mods can be used on any weapon at any time.") DermaListView:AddLine("Trails are only active when you are on mission") DermaListView:AddLine("Hats in the 'silly' category are only in use when you are on mission") DermaListView:AddLine("Some weapon mods are not visual, deal with it") DermaListView:AddLine("Most Hats and Models have a benefits, beware that ones in the 'silly' provide 0 benefit") DermaListView:AddLine("Criminals do not get any sirens on there car at any point") DermaListView:AddLine("Certain items are specific to a team and are unavailable when on a different team") DermaListView:AddLine("Taunts are played when you kill someone in a mission, only the victim hears them.") local SheetItemOne = vgui.Create( "DPanel", store2Menu ) SheetItemOne:SetPos((ScrW() / 2) -950,(ScrH() / 2) -515) SheetItemOne:SetSize( 600, 400 ) SheetItemOne.Paint = function() surface.SetDrawColor( 125, 125, 125, 255 ) surface.DrawRect( 0, 0, SheetItemOne:GetWide(), SheetItemOne:GetTall() ) end DermaList = vgui.Create( "DPanelList", SheetItemOne ) DermaList:SetPos(10,5) DermaList:SetSize( 560, 320 ) DermaList:SetSpacing( 10 ) DermaList:EnableHorizontal( false ) DermaList:EnableVerticalScrollbar( true ) for k, v in pairs(Hats.hatdatabase) do local panel = vgui.Create("DPanel") panel:SetTall(80) local button = vgui.Create("DButton", panel) button:SetSize( 50, 25 ) button:SetText("Buy") button.DoClick = function() RunConsoleCommand("addHat", k) store2Menu:Close() end panel.PaintOver = function() draw.SimpleText(k.."-" ..v.Description, "default", panel:GetWide()/2, panel:GetTall()/2-10, color_white,1,1) local col = Color(0,255,0,255) local price = v.Price if LocalPlayer():GetMoney() < price then col = Color(255,0,0,255) button:SetDisabled(true) else button:SetDisabled(false) end if table.HasValue(PlayerHats,k) then button:SetText("Sell") button:SetDisabled(false) price = math.floor( price*0.45) col = Color(0,255,0,255) else button:SetText("Buy") end draw.SimpleText("$Au"..price,"default",panel:GetWide()/2, panel:GetTall()/2+10,col,1,1) button:SetPos(panel:GetWide()-55,panel:GetTall()/2-12.5) end local icon = vgui.Create("SpawnIcon", panel) icon:SetModel(v.Model) icon:SetToolTip(nil) icon.OnCursorEntered = function() end icon.OnCursorExited = function() end icon.OnMousePressed = function() end DermaList:AddItem(panel) end PropertySheet:AddSheet( "Intro", SheetItemIntro, "icon16/accept.png", false, false, "Information about the store!" ) PropertySheet:AddSheet( "Hats", SheetItemOne, "icon16/user.png", false, false, "Buy Hats!" ) end usermessage.Hook("store2Menu",store2Menu)[/QUOTE] heres my hats.lua [QUOTE] Hats = {} Hats.hatdatabase={} PlayerHats = {} function Hats.RegisterHat(name, tab) name=name or tab.Name or nil if !name then return end Hats.hatdatabase[name]=tab print("poo") end function Hats.LoadHats() for f, v in pairs(file.Find( "autisme/gamemode/hats/*.lua", LUA_PATH )) do AddCSLuaFile("autisme/gamemode/hats/"..v) include("autisme/gamemode/hats/"..v) end end hook.Add("Initialize", "loadhatPlugins", function() MsgN("======================") Hats.LoadHats() MsgN("======================") Hats.InitPluginsLoaded=true end) --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function printHatDatabase() PrintTable(Hats.hatdatabase) end concommand.Add("hatprint", printHatDatabase) function GetHats() return Hats end function givePlayerHat( Hat ) table.insert(PlayerHats, Hat) end concommand.Add("addHat", function( ply, cmd, args ) local addedHat = args[1] givePlayerHat( addedHat ) end) function removePlayerHat( Hat ) for k, v in pairs(PlayerHats) do if v == Hat then table.remove(PlayerHats, k) end end end concommand.Add("removeHat", function( ply, cmd, args ) local removedHat = args[1] removePlayerHat( removedHat ) end) function printPlayerHat() PrintTable(PlayerHats) end concommand.Add("currenthatprint", printPlayerHat)[/QUOTE] in other news I suck at lua scripting.
[QUOTE=Charrax;35418368][lua] local TabOne = vgui.Create( "DPanel" ) TabOne:SetVisible( true ) local Info = vgui.Create("DLabel", TabOne) Info:SetText( [[ Welcome to xenoGamers TTT Rules for players. Rule 1# Valid reason is required before killing or calling out. Rule 2# Accidental RDM(Random Deathmatch) requires that person slay themself. If they do not, they may be kicked. Rule 3# No ghosting or metagaming. Rule 4# Failing to respond to a Detective's livecheck makes a person KOS. Rule 5# Don't revenge RDM. Rule 6# Mic/text chat spam is not allowed. Players must use english! Rule 7# Don't exploit or hack. Rule 8# Be nice. No trolling, abuse, racism or progender. Rule 9# No pornographic sprays. Rule 10# The GMod Division leaders may override rules if needed. Div. Leaders: Charrax. Rule 11# Changing name during round results in a kick. Rule 12# Don't spam chat commands. Rule 13# Prop pushing or killing will be taken as RDM. Rule 14# Don't spam doors. Rule 15# Don't complain about the server. We have a forum for your ideas! Rule 16# If you see a person surrounded by freshly-dead bodies, let them ID the bodies. However, if they leave without ID'ing them, they are KOS. Rule 17# Respect Admins. Don't argue with admins unless they did something unjust. Rule 18# If someone is following you, give them 3 warnings in chat. (You are allowed to bind a key) After the third warning they can be killed. Rule 19# No alliances between Traitors and other teams. Rule 20# When/If there is less then 5 people... Camping is not allowed. Breaking any of these rules will result in a punishment. ]] ) Info:SetTextColor( Color( 0, 0, 0, 255 ) ) Info:SetPos( 5, 20 ) Info:SizeToContents( ) Info:SetVerticalScrollbarEnabled() [/lua] It only goes up to rule 16 then cuts the sentence![/QUOTE] Put the rules in a table, then loop through it and add a label for each rule?
[lua] local distance = OurPos:Distance( ImpactPos ) local gravity = -600 local velocity = 9999 local angle = 57.2957795 * ( 0.5 * math.asin( ( gravity * distance) / ( velocity ^ 2 ) ) ) [/lua] I'm trying to do impact point prediction, in reverse order, I know the impact position, I know the distance and I know the velocity but I don't know the pitch angle of the barrel. The above code is not quite working as intended, it seems to work at long distances but not when our positions Z differs from the target position Z. What am I doing wrong? No errors. Just doesn't give me the angle I need.
-- Edited Again [lua] function FirstSpawn( ply ) --saving weapons local path = "dotu/"..ply:UniqueID()..".txt" if file.Exists(path) then ply.weps = glon.decode(file.Read(path)) else ply.weps = {} ply:SaveWeps() ply:ChatPrint("Your weapons will be saved when you leave the server!") end print("Loaded weapons for"..ply:Nick()) end hook.Add( "PlayerInitialSpawn", "playerInitialSpawn", FirstSpawn ) hook.Add("PlayerDisconnected", "playerdisconnected", function(ply) local id = ply:UniqueID() print("Player Disconnect: Money saved to SQLLite and TXT") ply:SaveAllCurrency() ply:SaveAllCurrencyTXT() ply:SaveWeps() print("dotu/dotuweapons.txt saved") end) hook.Add("PlayerLoadout", "LoadWeapons",function(ply) local id = ply:UniqueID() local data = glon.decode(file.Read("dotu/weapons/"..id..".txt")) for _,v in ipairs(data) do ply:Give(v) end end) --META --FUNCTIONS local meta = FindMetaTable("Player") function meta:SaveWeps() for _,v in ipairs(self:GetWeapons()) do table.insert( self.weps, v:GetClass()) end file.Write("dotu/"..self:UniqueID()..".txt", glon.encode(self.weps)) print("Saved Weapons for" .. self:Nick()) end concommand.Add("dotu_give_weapons", function(ply) local data = glon.decode(file.Read("dotu/weapons/"..ply:UniqueID()..".txt")) for k,v in pairs(data) do --SAME ERROR NO IDEA WHAT IM DOING WRONG print(v) end -- file.Write("dotu/"..ply:UniqueID()..".txt", glon.encode(ply.weps)) -- print(glon.decode(file.Read("dotu/"..ply:UniqueID()..".txt"))) end) [/lua] Currently no errors but I do not get the weapons I had from the last time I joined on my multiplayer server. Aswell I get this in console [QUOTE]You are running too many commands too quickly, please wait before executing more [/QUOTE] How do I made it give me the weapons and how do I not run so many commands too fast?
[QUOTE]chunk has too many syntax levels[/QUOTE] i get this like, every fourth line for some reason and when i comment a line out, itll give the same error on an [B]earlier[/B] line [editline]SHAZBOT[/editline] and why doesnt [i]self.Weapon[/i] work anymore it just gives me this: [quote]attempt to index global 'self' (a nil value)[/quote]
I got a problem with SWEP. Player should commit suicide when pressed LMB, but it doesn't work. [LUA] self.Owner:Kill() [/LUA]
[QUOTE=Krizzu;35461732]I got a problem with SWEP. Player should commit suicide when pressed LMB, but it doesn't work. [LUA] self.Owner:Kill() [/LUA][/QUOTE] Are you calling it serverside?
[QUOTE=pennerlord;35462002]Are you calling it serverside?[/QUOTE] Yes, and nothing.
Can I put an entire code (like a TTT weapon) in a function that requires at least 10 people connected to the server for the weapon to be bought or even loaded on the server? I have a weapon that does a large area of effect but would only be fair on 10 or more people.
I'm using some code to make a set of NPCs move to where the player is looking; [LUA] v:SetLastPosition(EyeTrace) v:SetSchedule(SCHED_FORCED_GO_RUN) [/LUA] Anyone know how I would go about having them forget their enemy once they have reached their destination? At the moment, they move to their set location, and then move back to their enemy even if they are out of sight.
[QUOTE=fishcake;35465416]I'm using some code to make a set of NPCs move to where the player is looking; [LUA] v:SetLastPosition(EyeTrace) v:SetSchedule(SCHED_FORCED_GO_RUN) [/LUA] Anyone know how I would go about having them forget their enemy once they have reached their destination? At the moment, they move to their set location, and then move back to their enemy even if they are out of sight.[/QUOTE] [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index030c.html?title=NPC.ClearEnemyMemory"]NPC.ClearEnemyMemory[/URL]
[QUOTE=Hoffa1337;35452986][lua] local distance = OurPos:Distance( ImpactPos ) local gravity = -600 local velocity = 9999 local angle = 57.2957795 * ( 0.5 * math.asin( ( gravity * distance) / ( velocity ^ 2 ) ) ) [/lua] I'm trying to do impact point prediction, in reverse order, I know the impact position, I know the distance and I know the velocity but I don't know the pitch angle of the barrel. The above code is not quite working as intended, it seems to work at long distances but not when our positions Z differs from the target position Z. What am I doing wrong? No errors. Just doesn't give me the angle I need.[/QUOTE] Relevant code ( entirely clientside ): [code]sv_gravity = GetConVar( "sv_gravity" ) SWEP.BoxColor = Color( 000, 000, 000, 180 ) SWEP.TextColor = Color( 255, 128, 000, 255 ) SWEP.Numbers = { } SWEP.TargetPos = nil SWEP.BigPitch = nil SWEP.LowPitch = nil SWEP.State = "ASST OFF" function SWEP:GetGravAccel( ) --I was going to do the fancy form of getting the real gravitational acceleration here --But it made my head hurt and I had to guess at variables --So here's the ultimate guess! return ( sv_gravity:GetInt( ) / 600 ) * ( 600 / -16 ) end function SWEP:CalculateTrajectory( ) local theta, g, d, v, tr, a, b, x, y, k, v, v2, v4, x2, p, q, n tr = util.TraceLine{ start = self.Owner:EyePos( ), endpos = self.Owner:EyePos( ) + self.Owner:GetAimVector( ) * 8192, filter = self.Owner, mask = MASK_SHOT } a = tr.HitPos b = self.Owner:EyePos( ) a = a - b y = math.abs( a.z ) a.z = 0 d = a:Length( ) g = self:GetGravAccel( ) v = 500 --velocity of entity v2 = v * v v4 = v2 * v2 x = d x2 = x * x k = math.atan( ( ( v2 + ( v4 - g * ( g * x2 + 2 * y * v2 ) ) ^ .5 ) / ( g * x ) ) ) v = math.atan( ( ( v2 - ( v4 - g * ( g * x2 + 2 * y * v2 ) ) ^ .5 ) / ( g * x ) ) ) if math.min( k, v ) == math.huge then --It isn't possible to hit it from here, according to this math self.State = "ASST ERR" self.TargetPos = nil self:EmitSound( self.Sounds.Error, 30 ) return end k = 90 + math.deg( k ) v = 90 + math.deg( v ) p = tr.HitPos:ToScreen( ) q = self.Owner:EyeAngles( ) n = q.p q.p = n - math.min( k, v ) self.LowPitch = q:Forward( ) * v * .5 q.p = n - math.max( k, v ) self.BigPitch = q:Forward( ) * v * .5 self.TargetPos = tr.HitPos self.YCoord = ( self.Owner:GetShootPos( ) + q:Forward( ) * 6 ):ToScreen( ).y self.State = "ASST ON" self:EmitSound( self.Sounds.LockedOn, 30 ) end function SWEP:DrawHUD( ) self:OwnerChanged( ) local x, y, w, h, r, n, i, s, a, b, p, q, z, pos surface.SetFont( "Grenade_Computer_Screen" ) r, n = surface.GetTextSize( " " ) w = ( 4 + 8 + 2 ) * r h = n * 6 x = surface.ScreenWidth( ) - ( w + r ) y = surface.ScreenHeight( ) * .5 - ( h + n * 2 ) * .5 draw.RoundedBox( 1, x, y, w + r, h + n, self.BoxColor ) y = y x = x self.LastUpdate = self.LastUpdate or CurTime( ) self.LastPos = self.LastPos or LocalPlayer( ):GetPos( ) pos = LocalPlayer( ):GetPos( ) if pos:Distance( self.LastPos ) > 2 and self.TargetPos then --We've moved, probably not accurate anymore self.State = "ASST ERR" self.TargetPos = nil self:EmitSound( self.Sounds.Error, 30 ) end if self.Locked or self.Reloading and self.TargetPos then self.TargetPos = nil self.State = "LOCKED" end self.LastPos = pos for i = 1, 6 do s = "&x%02x %04x %04x" a = math.random( 65535 ) b = math.random( 65535 ) a = tostring( a ):sub( 1, 4 ) b = tostring( b ):sub( 1, 4 ) if i > self.Grenades then a = 65535 b = 65535 end if not self.Numbers[ i ] then self.Numbers[ i ] = { a, b } end if CurTime( ) > self.LastUpdate + .15 then self.Numbers[ i ][ 1 ] = a self.Numbers[ i ][ 2 ] = b end s = s:format( i, self.Numbers[ i ][ 1 ], self.Numbers[ i ][ 2 ] ):upper( ) draw.DrawText( s, "Grenade_Computer_Screen", x, y, self.TextColor, TEXT_ALIGN_LEFT ) y = y + n end draw.DrawText( "&X07 " .. self.State, "Grenade_Computer_Screen", x, y, self.TextColor, TEXT_ALIGN_LEFT ) if CurTime( ) > self.LastUpdate + .15 then self.LastUpdate = CurTime( ) end surface.SetDrawColor( 189, 000, 189, 120 ) if self.TargetPos then p = self.TargetPos:ToScreen( ) q = self.Owner:EyePos( ) z = ( q + self.LowPitch ):ToScreen( ) surface.DrawRect( p.x - ScrW( ) * .0125, z.y - ScrH( ) * .0125, ScrW( ) * .025, ScrH( ) * .025 ) z = ( q + self.BigPitch ):ToScreen( ) surface.SetDrawColor( 000, 189, 189, 120 ) surface.DrawRect( p.x - ScrW( ) * .0125, z.y - ScrH( ) * .0125, ScrW( ) * .025, ScrH( ) * .025 ) end surface.SetDrawColor( 255, 000, 000, 150 ) x = ScrW( ) * .5 - 1 y = ScrH( ) * .5 - 1 w = ScrW( ) * .0125 * .5 h = ScrH( ) * .0125 * .5 surface.DrawRect( x - w * .5, y - h * .5, w, h ) end[/code] This code is from nearly two years ago, so it might be in need of some fine tuning or adjustment, but the video shows it works.
So I am trying to port over a sweet TTT modification over to Garry's Mod 13. I have a good deal of everything sorted up but the main problem I am running into is attempt to index local 'L' (a nil value)(Hook: HUDPaint) in gamemodes/ttt/gamemode/cl_hud.lua:188 Like 188 is local text = L[ roundstate_string[GAMEMODE.round_state] ] When I click on it, the thing gives me Unknown lua\includes\modules\hook.lua Line 105 The hook.lua is the default that came with Garry's Mod 13 and the gamemode works fine with the older Garry's Mod. The cl_hud.lua is exactly the same as the default TTT hud. Any help?
-- Edited Again [lua] function FirstSpawn( ply ) --saving weapons local path = "dotu/"..ply:UniqueID()..".txt" if file.Exists(path) then ply.weps = glon.decode(file.Read(path)) else ply.weps = {} ply:SaveWeps() ply:ChatPrint("Your weapons will be saved when you leave the server!") end print("Loaded weapons for"..ply:Nick()) end hook.Add( "PlayerInitialSpawn", "playerInitialSpawn", FirstSpawn ) hook.Add("PlayerDisconnected", "playerdisconnected", function(ply) local id = ply:UniqueID() print("Player Disconnect: Money saved to SQLLite and TXT") ply:SaveAllCurrency() ply:SaveAllCurrencyTXT() ply:SaveWeps() print("dotu/dotuweapons.txt saved") end) hook.Add("PlayerLoadout", "LoadWeapons",function(ply) local id = ply:UniqueID() local data = glon.decode(file.Read("dotu/weapons/"..id..".txt")) for _,v in ipairs(data) do ply:Give(v) end end) --META --FUNCTIONS local meta = FindMetaTable("Player") function meta:SaveWeps() for _,v in ipairs(self:GetWeapons()) do table.insert( self.weps, v:GetClass()) end file.Write("dotu/"..self:UniqueID()..".txt", glon.encode(self.weps)) print("Saved Weapons for" .. self:Nick()) end concommand.Add("dotu_give_weapons", function(ply) local data = glon.decode(file.Read("dotu/weapons/"..ply:UniqueID()..".txt")) for k,v in pairs(data) do --SAME ERROR NO IDEA WHAT IM DOING WRONG print(v) end -- file.Write("dotu/"..ply:UniqueID()..".txt", glon.encode(ply.weps)) -- print(glon.decode(file.Read("dotu/"..ply:UniqueID()..".txt"))) end) [/lua] Currently no errors but I do not get the weapons I had from the last time I joined on my multiplayer server. Aswell I get this in console [QUOTE]You are running too many commands too quickly, please wait before executing more [/QUOTE] How do I make it give me the weapons and how do I not run so many commands too fast?
Life Support 3 - Auto link Tool works for about 15-20 minutes, then stops. Doesn't seem to matter what server I play on, but anytime I try and use the Auto Link Tool to connect a Resource Node to Generators, Storage tanks, etc it works for a while, but after 15-20 minutes, it stops and I have to manually link everything the old fashioned way. Does anyone know what's causing this? The friends I play with are also having this problem. We all have the current revisions of all the add ons required.
so, if a i have a table table with weapon names on it. how can i check if a player has any 2 weapons on him from the table?
need a bit of help with some sort of rts building system right now i can spawn the building succesfully but im stuck in updating the building position at first i tough it would be enough to stick an reference of the current building to the player like ply.CurrentBuilding = building where building is the building entity but well ends up that i cant use it since i need to update the position every tick since im all doing this from a first person perspective i only want it to follow the player view and always attached to ground so well so far i only have this [LUA]function meta:SpawnBD( name ) local bHasItems = true local recipe = nil local distance for k,v in pairs( self.BuildingRecipes ) do if v.Name == name then recipe = v break end end if not recipe then print("Recipe not found...") return end -- for _, ing in pairs(recipe.RequiredItems ) do -- if !self:HasItem(ing) then -- bHasItems = false -- break -- end -- end bHasItems = true; if bHasItems then distance = self:EyeTrace2(20) building = ents.Create("st_building") building:SetModel(recipe.Model); building:SetPos(self:GetShootPos()); building:Spawn(); self.CurrentBuilding = building; //SetTimer(recipe.BuildTime,false,) self.bUpdateBDPos = true; else end end[/LUA] since in GM:Think i cant use the ply parameter to update the CurrentBuilding pos what else can i use?
-managed to make a workaround-
[QUOTE=comet1337;35482291]okay new problem: [lua] function SwapWeapon(pl, cmd, arg) if pl:GetActiveWeapon() == pl:GetNWString("wep1") then pl:SelectWeapon(pl:GetNWString("wep2")) elseif pl:GetActiveWeapon() == pl:GetNWString("wep1") then pl:SelectWeapon(pl:GetNWString("wep2")) end end concommand.Add("selectweapons", SwapWeapon)[/lua] that should cycle between wep1 and wep2, right? no errors no nothing, it just doesnt do anything[/QUOTE] [lua]pl:GetActiveWeapon()[/lua] That is a entity...you need a class right? you must use [lua]pl:GetActiveWeapon():GetClass()[/lua] And it return the name of the weapon, not the entity [editline]8th April 2012[/editline] Create a entity froma a command D:
[QUOTE=comet1337;35482291]-managed to make a workaround-[/QUOTE] You shouldn't snip out your original problem/answer, someone might have the same problem and not know the workaround.
I was trying to make a explosion, I decided to use env_explosion but I had a problem, the explosion wasn't making damage. I hadn't set the keyvalues, so I set the magnitude and radius, still didn't work. A friend told me to set them before I fired the explosion, still didn't work. [lua] function ENT:Explosion( pos ) local explo = ents.Create( "env_explosion" ) explo:SetKeyValue( "Magnitude", "100" ) explo:SetKeyValue( "Radius Override", "20" ) explo:SetPos( pos ) explo:Spawn( ) explo:Fire( "explode", "", 0 ) self:Remove( ) end [/lua] That's the ENT: Function that has the code, everything works, except the explosion that doesn't makes any damage.
I am working on an admin mod and I am in the making of the mute function. Since I cannot test with bots, I need to ask for help here. Will this mute the talker if talker.mute == true? [lua]function GM:PlayerCanHearPlayersVoice( listener, talker ) if #player.GetAll() < 2 then return false end if talker.mute then talker:ConCommand("-voicerecord") return false end end[/lua]
I just use the built in Mute system for my admin mod
[QUOTE=Banana Lord.;35487716]I just use the built in Mute system for my admin mod[/QUOTE] I don't want to rely on the client for it.
okay, how the hell can i restrict a player to have only 2 weapons at a time? ive been fiddling around this for hours!
Do DTVars conflict with NetworkedStrings or something? I can't figure out what the hell is going on here. [lua]print( "body.GetName", rag:GetNWString( "playerName", "WHAT THE FUCK IS GOING ON" ) )[/lua] This is returning a player object?? [code]body.GetName Player [1][BlackAwps][/code] I do have a DT entity set, that should point to myself, on the ragdoll so I figured that it may be interfering somehow? I really just don't get it.
Sorry, you need to Log In to post a reply to this thread.