• What do you need help with? V3
    6,419 replies, posted
[QUOTE=zerothefallen;39159016]are you incasing it in [lua]if SERVER then[/lua][/QUOTE] Yeah it is in those tags. As I said, it works 100% fine on my dev server.
Is there any way to get the addon files from within a .gma file?
Has anyone ever seen the error "vgui: adding child in layout". It spams when you talk to a npc and their are items in the shop, I narrowed it down to this code where the error appears. [CODE] if (!self.ModelPanel) then print("before") -- See if the error appears before this code self.ModelPanel = vgui.Create('perp2_trade_inv_item', self:GetParent()); - Error here print(self:GetParent()) -- This is here to see is self:GetParent() is null which it is not print("after") -- Prints after the error self.ModelPanel.trueParent = self; end [/CODE]
Hello I am still curious about the 1024 byte limit for strings in Garrys Mod Lua. I see that there is a net library that allows much larger strings to be held. Lets say that instead of using a string to hold the data (it is only for serverside to serverside communication) I would like to use the net value as a string that will be used to hold a large SQL statement. I'm using mysqloo, and so I am attempting to run the sql through a function as so [PHP] function installSchema(schema) local q = db:query(getSchemaSql(schema)) function q:onSuccess( data ) print( "Query successful!" ) PrintTable( data ) end function q:onError( err, sql ) print( "Query errored!" ) print( "Query:", sql ) print( "Error:", err ) end q:start() end [/PHP] Does the net library allow me to get around this limitation in this way? I see functions for sending the data to a connected player, as well as some options for reading and writing the data. Please help - I've posted about this a couple times now and haven't got much feedback.
[QUOTE=HarryMudd;39161833]Hello I am still curious about the 1024 byte limit for strings in Garrys Mod Lua. I see that there is a net library that allows much larger strings to be held. Lets say that instead of using a string to hold the data (it is only for serverside to serverside communication) I would like to use the net value as a string that will be used to hold a large SQL statement. I'm using mysqloo, and so I am attempting to run the sql through a function as so [PHP] function installSchema(schema) local q = db:query(getSchemaSql(schema)) function q:onSuccess( data ) print( "Query successful!" ) PrintTable( data ) end function q:onError( err, sql ) print( "Query errored!" ) print( "Query:", sql ) print( "Error:", err ) end q:start() end [/PHP] Does the net library allow me to get around this limitation in this way? I see functions for sending the data to a connected player, as well as some options for reading and writing the data. Please help - I've posted about this a couple times now and haven't got much feedback.[/QUOTE] Haven't used mysqloo yet, but what from what I'm seeing the data returns as a table. In that case if you needed to send the data to client something like this should work: [lua] if SERVER then util.AddNetworkString("db_connect") net.Start("db_connect") net.WriteTable(data) //if you need to send this data to one player then use this below net.Send(ply) //else, if you need to send to everyone on the server use: net.Broadcast() end if CLIENT then net.Receive("db_connect", function(length, client) local data = net.ReadTable() // code goes here end) end [/lua] but that's just for sending the data to clients. Hope this helps.
How can I go about restricting player/weapon colors?
Hmmm. The problem I am having is that I am trying to send a string of data (the database creation sql) to mysqloo. When I output the text of the string to the console for testing, it is getting cut off at 1024 characters. I don't actually need or want to send the network data to a player, I just want to pass a longer string value to mysqloo so that it can go on and generate the SQL. Is there a way to locally change the maximum string length to be higher than 1024 bytes? It says here [url]http://wiki.garrysmod.com/page/Networking_Entities[/url] "Note that the String type is up to 1024 chars. If you have common strings that are repeated you should add them to the string table and network the integer ID instead. " It is very easy to generate a string for creating the SQL tables that is much longer than 1024 characters, so I hope to find a way around this limitation that isn't as messy as writing something that handles examining the string length every time I want to add something to it and determining if it needs to be put into a table or not.
So I'm attempting to make the growing effect that weed plants have in perp, Where the leaves grow slowly, but I don't know how to I keep getting these two errors. [ERROR] gamemodes/darkrp/entities/entities/plant_coca/init.lua:70: attempt to call method 'SetScale' (a nil value) 1. Grown - gamemodes/darkrp/entities/entities/plant_coca/init.lua:70 2. unknown - gamemodes/darkrp/entities/entities/plant_coca/init.lua:78 Timer Failed! [Simple][@gamemodes/darkrp/entities/entities/plant_coca/init.lua (line 79)] [lua]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/props_c17/pottery06a.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) local phys = self:GetPhysicsObject() if phys and phys:IsValid() then phys:Wake() end Usable = false Plantable = true self.damage = 25 end function ENT:OnTakeDamage(dmg) self.damage = (self.damage or 25) - dmg:GetDamage() if self.damage <= 0 then local rnd = math.random(1, 10) if rnd < 2 then self:DropSeed() self:Remove() self:Destruct() else self:Remove() self:Destruct() end end end function ENT:Destruct() local vPoint = self:GetPos() local effectdata = EffectData() effectdata:SetStart(vPoint) effectdata:SetOrigin(vPoint) effectdata:SetScale(1) util.Effect("pickup", effectdata) GAMEMODE:Notify(self.dt.owning_ent, 1, 4, "Your Coca Plant has been destroyed!") end function ENT:DropSeed() local SeedSpawn = ents.Create("seed_coca") local Spawnpos = self:GetPos() SeedSpawn:SetPos(Spawnpos) SeedSpawn:Spawn() end function ENT:Use( activator ) if Usable == true then Usable = false Plantable = true if(activator:IsPlayer()) then activator:AddMoney(self:GetDrugWorth()); GAMEMODE:Notify(self.dt.owning_ent, 1, 4, "You sold your Cocaine for $"..self:GetDrugWorth().."!") self:SetDrugWorth(0) end local rnd = math.random(1, 10) if rnd < 3 then self:DropSeed() end end end function ENT:Grown() leaf:SetScale( 100 ) self:SetDrugWorth(2500) end function ENT:Touch(hitEnt) if hitEnt:GetClass() == "seed_coca" then if Plantable == true then Plantable = false timer.Simple(300, self:Grown()) local LeafPos = self:GetPos() leaf = ents.Create( "prop_physics" ) leaf:SetModel( "models/props_foliage/bush2.mdl" ) leaf:SetScale( CurTime()/3 ) leaf:SetPos( Vector(LeafPos.x, LeafPos.y + 26, LeafPos.z) ) leaf:SetParent( "plant_coca" ) hitEnt:Remove() Usable = true self:SetPhase(1) self:FindAge() end end end --[[function ENT:Touch(hitEnt) if hitEnt:GetClass() == "seed_coca" then if Plantable == true then Plantable = false self:StartGrow = CurTime() timer.Simple(300, function() self:Grown() end ) local LeafPos = self:GetPos() leaf = ents.Create( "prop_physics" ) leaf:SetModel( "models/props_foliage/bush2.mdl" ) leaf:SetScale( StarGrow/3 ) leaf:SetPos( Vector(LeafPos.x, LeafPos.y + 26, LeafPos.z) ) leaf:SetParent( "plant_coca" ) timer.Simple(300, function() self:Grown() end ) hitEnt:Remove() Usable = true end end end]] function ENT:Think() end [/lua] Can I get some help?
[QUOTE=HarryMudd;39162372]Hmmm. The problem I am having is that I am trying to send a string of data (the database creation sql) to mysqloo. When I output the text of the string to the console for testing, it is getting cut off at 1024 characters. I don't actually need or want to send the network data to a player, I just want to pass a longer string value to mysqloo so that it can go on and generate the SQL. Is there a way to locally change the maximum string length to be higher than 1024 bytes? It says here [url]http://wiki.garrysmod.com/page/Networking_Entities[/url] "Note that the String type is up to 1024 chars. If you have common strings that are repeated you should add them to the string table and network the integer ID instead. " It is very easy to generate a string for creating the SQL tables that is much longer than 1024 characters, so I hope to find a way around this limitation that isn't as messy as writing something that handles examining the string length every time I want to add something to it and determining if it needs to be put into a table or not.[/QUOTE] The net library is strictly for sending data from the server to the client or vice versa. It won't help you here. It seems the string size limit is either a limitation of Lua itself (unlikely) or a limitation of the mysqloo module (more likely). All I can suggest is use smaller queries, use stored procedures or try a different mysql module.
[QUOTE=thomasfn;39162842]The net library is strictly for sending data from the server to the client or vice versa. It won't help you here. It seems the string size limit is either a limitation of Lua itself (unlikely) or a limitation of the mysqloo module (more likely). All I can suggest is use smaller queries, use stored procedures or try a different mysql module.[/QUOTE] It works in regular Lua actually. However I am hitting the string size limit in Gmod Lua. I tried turning the string in to a table and using table.insert to append each value, and then using table.concat to produce the output - again it cut short at 1024 characters. However if I do an iterator over the table, it shows that everything is there. [editline]9th January 2013[/editline] I think that I might have found an addon that provides working strings. [url]http://code.google.com/p/cakesaddons/source/browse/#svn%2Ftrunk%2Fglib[/url] I've installed it to my addons folder and now I am trying to figure out how to access these buffer functions
Does any one know how to populate a DListView from the server side i trying to make a market system for items and need to findinsphere and add them to the list [PHP] local selllist = vgui.Create("DListView") selllist:SetParent(sellframe) selllist:SetPos(5, 30) selllist:SetSize( sellframe:GetWide()/2, sellframe:GetTall() - 35 ) selllist:SetMultiSelect(false) selllist:AddColumn("Item") -- Add column selllist:AddColumn("Amount") selllist:AddColumn("ID"):SetWidth(0) --for k, v in pairs(ents.FindInSphere( LocalPlayer():GetPos(), 1000 )) do -- if v:IsValid() then -- if(v:GetClass() == "oil_barrel") then -- local Oil = RD_GetResourceAmount(v, "Oil") -- selllist:AddLine("Oil Barrel",Oil,v:EntIndex()) -- Add lines -- print(v:GetClass()) -- end -- end --end [/PHP] is what i am trying populate the list with and i cant use RD_GetResourceAmount client side
I had an odd thought: might it be possible to implement some kind of color pippete using lua for GM? The pippete which returns the color of what you're looking at. e.g. I'm looking at the blue can and getting ~(0,145,255) RGB, instead of (255,255,255).
Does anyone have any recommendations of gamemode code to look through for good examples to learn off, I want to learn but the available tuts on the wiki are pretty limited, so I think just reading some examples would be best.
i think for the most part the old gamemode tuts still work other then the info file i followed the old one for the game mode i am working on
[QUOTE=HarryMudd;39163281]It works in regular Lua actually. However I am hitting the string size limit in Gmod Lua. I tried turning the string in to a table and using table.insert to append each value, and then using table.concat to produce the output - again it cut short at 1024 characters. However if I do an iterator over the table, it shows that everything is there. [editline]9th January 2013[/editline] I think that I might have found an addon that provides working strings. [url]http://code.google.com/p/cakesaddons/source/browse/#svn%2Ftrunk%2Fglib[/url] I've installed it to my addons folder and now I am trying to figure out how to access these buffer functions[/QUOTE] Gmod lua strings aren't the problem: [code] > local s = string.rep('a', 2048) MsgN(string.len(s))... 2048 > local s = string.rep('a', 1024) .. string.rep('b', 1024) MsgN(string.len(s))... 2048 > local s = string.rep('a', 1024) .. string.rep('b', 1024) MsgN(string.len(s)) MsgN(s)... 2048 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb [/code]
Is there a way to detect if a player only has partial footing? Like, say they walk up to a ledge and half their player model is just suspended in the air.
[QUOTE=HarryMudd;39163281]It works in regular Lua actually. However I am hitting the string size limit in Gmod Lua. I tried turning the string in to a table and using table.insert to append each value, and then using table.concat to produce the output - again it cut short at 1024 characters. However if I do an iterator over the table, it shows that everything is there. [editline]9th January 2013[/editline] I think that I might have found an addon that provides working strings. [url]http://code.google.com/p/cakesaddons/source/browse/#svn%2Ftrunk%2Fglib[/url] I've installed it to my addons folder and now I am trying to figure out how to access these buffer functions[/QUOTE] I checked and there's nothing I can see in the module that's limiting it, are you sure it isn't just the print function that's cutting it off? [editline]10th January 2013[/editline] Try printing the length of the string as well
[QUOTE=_Undefined;39164996]Gmod lua strings aren't the problem: [code] > local s = string.rep('a', 2048) MsgN(string.len(s))... 2048 > local s = string.rep('a', 1024) .. string.rep('b', 1024) MsgN(string.len(s))... 2048 > local s = string.rep('a', 1024) .. string.rep('b', 1024) MsgN(string.len(s)) MsgN(s)... 2048 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb [/code][/QUOTE] That is interesting. I see that it is 2048 - so that makes sense as something I wasn't understanding. However, I put this in my init.lua and it shows [code]2048 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaConVarRef room_type doesn't point to an existing ConVar Executing dedicated server config file server.cfg Initializing Steam libraries for secure Internet server Logging into anonymous gameserver account. Database has connected! Connection to Steam servers successful. [/code] Also how did you get a Lua console in Gmod to run those commands? [editline]10th January 2013[/editline] [QUOTE=Drakehawke;39165105]I checked and there's nothing I can see in the module that's limiting it, are you sure it isn't just the print function that's cutting it off? [editline]10th January 2013[/editline] Try printing the length of the string as well[/QUOTE] It could be just the print function that is cutting it off! I tried printing and using msgN to debug the string to see why what was wrong with it as part of my debugging. I didn't realize that print or msg would have a limit. Ok, if I check the length of the string it is showing that all of the data that is in it - is in it. (facepalm) It only prints 1024 characters..so my attempt to use printing or msg's to debug was fail :-/ Now I've got to go back and figure out what the issue was with mysqloo and passing the variable onto it. I thought that the string being cut off was the issue. :-( Finally, the documentation says for Print: The difference between this and Msg() is that this doesn't require an \n at the end of the message and supports longer strings. - it returns the same thing no matter which I use. My string has 4104 characters but either with print or msg it only displays 1024 to the console.
Have you actually tried running the query? Printing it out is the issue, which could be a problem with srcds or something else, but if your string is complete and the correct length then running it shouldn't be an issue. lua_run or lua_run_cl is the console command to run lua.
Hey guys!! I have the following issue: My fastDL server is running and working well but, when i join the server he try to download the files but when i seek for the folder the files are not downloaded on client side and when i join the server again he tries to download it again. I also tried with a forcing lua file in the following folder path: C:\server\orangebox\garrysmod\lua\autorun\server and created a file so he force download it: [QUOTE]if SERVER then AddCSLuaFile( "test.lua" ) -- The name of this lua. resource.AddFile("sound/jailbreak/guard_win.wav") resource.AddFile("sound/jailbreak/prisoner_win.wav") resource.AddFile("sound/jailbreak/knifefight.wav") end[/QUOTE] But he doesn't download the music files what can i try? Let me know guys
[QUOTE=fawakabrother;39165433]Hey guys!! I have the following issue: My fastDL server is running and working well but, when i join the server he try to download the files but when i seek for the folder the files are not downloaded on client side and when i join the server again he tries to download it again. I also tried with a forcing lua file in the following folder path: C:\server\orangebox\garrysmod\lua\autorun\server and created a file so he force download it: But he doesn't download the music files what can i try? Let me know guys[/QUOTE] [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index70e8.html"]Here.[/URL] Maybe that : [QUOTE] People have to download files every time they join! This means you forgot something on the FastDL folder. It's trying to download it every time they join. It also tells you what you have to move there. If you have the files already, you will not need to re-download them. There could also be an issue regarding the files name. Case sensitivity matters with sv_downloadurl, so ensure that the filepath and filename are exactly the same on both the webserver and gameserver. [/QUOTE]
[QUOTE=_Undefined;39165383]Have you actually tried running the query? Printing it out is the issue, which could be a problem with srcds or something else, but if your string is complete and the correct length then running it shouldn't be an issue. lua_run or lua_run_cl is the console command to run lua.[/QUOTE] Yes agreed, printing it out was the issue. Thanks for the help - that was a tricky thing to figure out when I was relying on it for debugging. Running the Query: That's what I'm back to looking into. In vanilla Lua I was taking the generated query and cutting and pasting it into mysql through the command line and it was working. I think my problems now might just be with my use of mysqloo and perhaps the libmysql.so.16 that I put in (I'm on debian, not ubuntu)
[CODE][ERROR] gamemodes/darkrp/gamemode/client/showteamtabs.lua:159: bad argument #1 to 'SetText' (string expected, got nil) 1. SetText - [C]:-1 2. CPOptns - gamemodes/darkrp/gamemode/client/showteamtabs.lua:159 3. Update - gamemodes/darkrp/gamemode/client/showteamtabs.lua:334 4. Function - gamemodes/darkrp/gamemode/client/vgui.lua:291 5. unknown - lua/includes/modules/usermessage.lua:87 [/CODE] Thats my error when joining the DarkRP server. Ive gone into the file and looked around for errors but as Im still learning, this type of error is a bit beyond me. Any assistance?
[QUOTE=Blobtastic88;39165600][CODE][ERROR] gamemodes/darkrp/gamemode/client/showteamtabs.lua:159: bad argument #1 to 'SetText' (string expected, got nil) 1. SetText - [C]:-1 2. CPOptns - gamemodes/darkrp/gamemode/client/showteamtabs.lua:159 3. Update - gamemodes/darkrp/gamemode/client/showteamtabs.lua:334 4. Function - gamemodes/darkrp/gamemode/client/vgui.lua:291 5. unknown - lua/includes/modules/usermessage.lua:87 [/CODE] Thats my error when joining the DarkRP server. Ive gone into the file and looked around for errors but as Im still learning, this type of error is a bit beyond me. Any assistance?[/QUOTE] Update your darkrp to the most recent version
[QUOTE=hogofwar;39160601]Is there any way to get the addon files from within a .gma file?[/QUOTE] In case you haven't found it yet, [url]http://www.facepunch.com/showthread.php?t=1173875[/url]. Edit: Also, can anyone tell me where I would put SWEPs and SENTs for my gamemode? According to the wiki, all 'content' goes in a different folder than your gamemode folder, but are SWEPs and SENTs considered content or not?
How do I make my SWEP shoot a laser? Or atleast look like it's firing a laser when it's really just firing bullets. Here is my code so far. [code]SWEP.PrintName = "Phys-Cutter" SWEP.Author = "" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.ViewModelFOV = 62 SWEP.ViewModelFlip = false SWEP.ViewModel = "models/weapons/v_superphyscannon.mdl" SWEP.WorldModel = "models/weapons/w_physcannon.mdl" SWEP.AnimPrefix = "Pistol" SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Primary.ClipSize = 2048 // Size of a clip SWEP.Primary.DefaultClip = 2048 // Default number of bullets in a clip SWEP.Primary.Automatic = true // Automatic/Semi Auto SWEP.Primary.Ammo = "AR2" function SWEP:Initialize() end function SWEP:PrimaryAttack() // Make sure we can shoot first if ( !self:CanPrimaryAttack() ) then return end // Play shoot sound self:EmitSound("") // Shoot 1 bullets, 5 damage, 0.01 aimcone self:ShootBullet( 5, 1, 0.01 ) // Remove 1 bullet from our clip self:TakePrimaryAmmo( 1 ) // Punch the player's view self.Owner:ViewPunch( Angle( 0, 0, 0 ) ) end function SWEP:SecondaryAttack() end [/code]
[QUOTE=Sparky-Z;39167207]In case you haven't found it yet, [url]http://www.facepunch.com/showthread.php?t=1173875[/url]. Edit: Also, can anyone tell me where I would put SWEPs and SENTs for my gamemode? According to the wiki, all 'content' goes in a different folder than your gamemode folder, but are SWEPs and SENTs considered content or not?[/QUOTE] SWEPs go in mygamemode/entities/weapons/ SENTs go in mygamemode/entities/entities/ Normal lua scripts go in mygamemode/gamemode/
I need to overwrite the default functionality of having the cursor on the screen. The problem is the sandbox gamemode does wonky things with where the player is aiming when the cursor is on the screen. By wonky I mean it changes the position you are shooting at, but doesn't change the ply.eyeangles. I confirmed this by deriving my gamemode from base and the problem when away. How can I change it so having the cursor on the screen wont mess with where I'm shooting? Or should I just derive from base, does deriving from sandbox give me anything useful? EDIT: Solved with function GM:OnContextMenuOpen( )end[ How can I cause the player to fire? Like setting +attack would do, just using RunConsoleCommand( "+attack" )?
I'm not sure if this is a bug, and that I should post something about it, or if I am doing something wrong, but for some reason clientside SecondaryAttack is being called three times, but ServerSide it is only being called once, which can cause some syncing issues. Proof: [img]http://img.thed3vine.net/SecondaryAttack.PNG[/img] Code Used For Testing: [CODE]local I = 0 function SWEP:SecondaryAttack() I = I + 1 print(I) end[/CODE] If more information is needed, just ask. I tested this on multiple SWEPs, and the same thing occurred. Edit: Nevermind, found out IsFirstTimePredicted().
Im trying to make the player spectate when he first connects. As of right now, when someone joins they get the weird defualt model of that grey thing, even though I set them to spectate on first join. Here's my initial spawn code: [LUA]function GM:PlayerInitialSpawn( ply ) umsg.Start( "Welcome" , ply ) umsg.End() ply:ConCommand( "change_team" ) //Run the console command when the player first spawns ply:Spectate( 5 ) end [/LUA] [IMG]http://gyazo.com/cd712903a0b4f35d0bdb83d8453c8514.png?1357861650[/IMG]
Sorry, you need to Log In to post a reply to this thread.