• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
Here's a poly circle: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/poly/simplified_circles_with_poly.lua.html[/url] I'd highly recommend making the circle OUTSIDE of the hook ( and update it when resolution changes ) to avoid needing to create a new poly every frame. Example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_hooks/playerchangedresolution/lua/autorun/client/cl_gm_playerchangedresolution.lua[/url] - [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_hooks/playerchangedresolution/example_usage.lua[/url]
In fact I'm not actually looking to do filled circles, since that sometimes I want the center to be empty, but thanks for the help! :D
Hi... i needed help with a (probably simple) issue. i'm trying to edit an addon to where, instead of the normal "<player> has finished loading!" to have anybody in the rank "Owner" print as: "The Owner <player>, has joined the server!" i keep getting this error when I join: [ERROR] addons/newfolder - copy - copy/lua/autorun/(dis)connect.lua:14: attempt to call method 'IsUserGroup' (a nil value) 1. Function - addons/newfolder - copy - copy/lua/autorun/(dis)connect.lua:14 2. unknown - lua/includes/modules/usermessage.lua:87 (it might be a simple three letter change, i dont know) [LUA] if CLIENT then CreateClientConVar( "cl_connectsound", "1", true, false ) local function DispatchChatJoinMSG( um ) local ply = um:ReadString() local mode = um:ReadString() local id = um:ReadString() if mode == "1" then chat.AddText(Color(72,72,72),"[SERVER] ",Color(145,145,145),ply,Color(235, 235, 235),", is",Color(0, 127, 127)," joining ",Color(235, 235, 235),"the server!") if GetConVarNumber( "cl_connectsound" ) == 1 then surface.PlaySound("buttons/combine_button3.wav") end elseif mode == "2" then if player:IsUserGroup( "Owner" ) then chat.AddText(Color(72,72,72),"[SERVER] ",Color(122,90,165),"The Owner",Color(122,90,165),ply,Color(122,90,165),"has joined the server!") print("("..id..")") else chat.AddText(Color(72,72,72),"[SERVER] ",Color(145,145,145),ply,Color(235, 235, 235),", has",Color(0, 127, 31)," finished loading") end elseif mode == "3" then chat.AddText(Color(72,72,72),"[SERVER] ",Color(145,145,145),ply,Color(235, 235, 235),",",Color(255, 30, 30)," left ",Color(235, 235, 235),"the server!") print("("..id..")") if GetConVarNumber( "cl_connectsound" ) == 1 then surface.PlaySound("buttons/combine_button2.wav") end end end usermessage.Hook("DispatchChatJoin", DispatchChatJoinMSG) end if SERVER then local function PlyConnectMSG( name ) umsg.Start("DispatchChatJoin") umsg.String(name) umsg.String("1") umsg.End() end hook.Add( "PlayerConnect", "PlyConnectMSG", PlyConnectMSG ) local function PlyLoadedMSG( ply ) timer.Simple(5, function() --Let the player load you noodle! if ply:IsValid() then umsg.Start("DispatchChatJoin") umsg.String(ply:GetName()) umsg.String("2") umsg.String(ply:SteamID()) umsg.End() end end) end hook.Add( "PlayerInitialSpawn", "PlyLoadedMSG", PlyLoadedMSG ) local function PlyDisconnectMSG( ply ) umsg.Start("DispatchChatJoin") umsg.String(ply:GetName()) umsg.String("3") umsg.String(ply:SteamID()) umsg.End() end hook.Add( "PlayerDisconnected", "PlyDisconnectMSG", PlyDisconnectMSG ) end [/LUA] I have also tried this too: [LUA] elseif mode == "2" then if ( Player( 2 ):IsUserGroup( "Owner" ) ) then chat.AddText(Color(72,72,72),"[SERVER] ",Color(122,90,165),"The Owner",Color(122,90,165),ply,Color(122,90,165),"has joined the server!") print("("..id..")") else chat.AddText(Color(72,72,72),"[SERVER] ",Color(145,145,145),ply,Color(235, 235, 235),", has",Color(0, 127, 31)," finished loading") [/LUA] ^this also works, just for the first join. if you re-join the error occurs again.
Don't use PlayerConnect, PlayerInitialSpawn, etc... to detect fully-loaded because no one loads in at the exact same speed so a timer won't help either. You can use my PlayerFullyLoaded hook, or you can make one that works similarly but they won't be "fully" in game but the entity will exist which is what you're targeting... Use OnEntityCreated hook, check if the entity is a player and if so grab the rank from there. That'll ensure the function will be set. I'd also recommend using net-messages instead of umsgs; but it honestly doesn't matter for your data because it executes a frame later. Additionally, Instead of sending the player entity to the client, why not send an enumeration for the groups that will change the text on the client side, send the nick-name of the client, and then finish the rest on the clientside networking receiver. What I mean is check the group on the server then if owner ( if you have more than 1 group that will change text ) set up SHARED enumerations such as GROUP_OWNER = 1; GROUP_USER = 0; and send which one the connecting client is. I say don't send the entity because if the client that receives it hasn't yet been near enough the connecting client, the entity may show up as NULL.
Does anyone know of a way to stop the wheels on an entity with a car model from clipping through the world?
[QUOTE=Acecool;47031268]Don't use PlayerConnect, PlayerInitialSpawn, etc... to detect fully-loaded because no one loads in at the exact same speed so a timer won't help either. You can use my PlayerFullyLoaded hook, or you can make one that works similarly but they won't be "fully" in game but the entity will exist which is what you're targeting... Use OnEntityCreated hook, check if the entity is a player and if so grab the rank from there. That'll ensure the function will be set. I'd also recommend using net-messages instead of umsgs; but it honestly doesn't matter for your data because it executes a frame later. Additionally, Instead of sending the player entity to the client, why not send an enumeration for the groups that will change the text on the client side, send the nick-name of the client, and then finish the rest on the clientside networking receiver. What I mean is check the group on the server then if owner ( if you have more than 1 group that will change text ) set up SHARED enumerations such as GROUP_OWNER = 1; GROUP_USER = 0; and send which one the connecting client is. I say don't send the entity because if the client that receives it hasn't yet been near enough the connecting client, the entity may show up as NULL.[/QUOTE] I know this makes it harder for you, but i didn't really make this (well, i made the line that's causing the error...), nor am i that great at lua. i somewhat understood what you said, but could you explain it like you would to newbie?
[QUOTE=TheEmp;47031344]Does anyone know of a way to stop the wheels on an entity with a car model from clipping through the world?[/QUOTE] If it's an actual drivable vehicle with a script, you have to set the wheel radius in the script file to whatever the proper size is.
[QUOTE=Revenge282;47031435]If it's an actual drivable vehicle with a script, you have to set the wheel radius in the script file to whatever the proper size is.[/QUOTE] Its a custom entity that I've set to use a car model, not a driviable entity. Thanks for trying though.
[QUOTE=TheEmp;47031344]Does anyone know of a way to stop the wheels on an entity with a car model from clipping through the world?[/QUOTE] I believe [URL="http://facepunch.com/showthread.php?t=1091613&p=30057873&viewfull=1#post30057873"]this post[/URL] has relevant information (the edited portion + the following few posts). Play around with the settings Falcqn mentions until you find something that works for you. [URL="http://wiki.garrysmod.com/page/physenv/GetPerformanceSettings"]physenv:GetPerformanceSettings()[/URL] [URL="http://wiki.garrysmod.com/page/physenv/SetPerformanceSettings"]physenv:SetPerformanceSettings()[/URL] [URL="http://wiki.garrysmod.com/page/Structures/PhysEnvPerformanceSettings"]Struct:PhysEnvPerformanceSettings[/URL] Woops, totally made the assumption you're the one running the server. If you aren't, you may want to try testing it in single player. Hope that helps!
[QUOTE=GGG KILLER;47031179]In fact I'm not actually looking to do filled circles, since that sometimes I want the center to be empty, but thanks for the help! :D[/QUOTE] Use [URL="https://dl.dropboxusercontent.com/u/104427432/Scripts/drawarc.lua"]this[/URL] to draw circles if you want the center to be empty sometimes. If you want the circle to be one pixel in thickness, use surface.DrawCircle() That script has an example at the bottom if you need help. If you want a full circle, use startangle and endangle 0 and 359
[QUOTE=bobbleheadbob;47031644]Use [URL="https://dl.dropboxusercontent.com/u/104427432/Scripts/drawarc.lua"]this[/URL] to draw circles if you want the center to be empty sometimes. If you want the circle to be one pixel in thickness, use surface.DrawCircle() That script has an example at the bottom if you need help. If you want a full circle, use startangle and endangle 0 and 359[/QUOTE] surface.DrawCircle isn't actually a circle; it is a lot of dots so if the circle needs to be a certain size it'll show only dots. Drawing lines from one point to the next is a good way to do it, I told him to use 64 points or whatever, draw the lines until half of the number then connect the last point with the first point which would create half of a circle using lines.
[QUOTE=Acecool;47031667]surface.DrawCircle isn't actually a circle; it is a lot of dots so if the circle needs to be a certain size it'll show only dots. Drawing lines from one point to the next is a good way to do it, I told him to use 64 points or whatever, draw the lines until half of the number then connect the last point with the first point which would create half of a circle using lines.[/QUOTE] The script I gave him is an arc script which uses polygons. [editline]swag[/editline] Like this: [url]http://steamcommunity.com/sharedfiles/filedetails/?id=214029798[/url]
Hopefully not asking much here. I've been working with some decals lately that use Lua created materials. The decals display onto world and entities, but are not scalable with the util.DecalEx function's arguements, as noted in this [URL="https://github.com/Facepunch/garrysmod-issues/issues/1624"]GitHub Issue Report[/URL]. Does anyone know of a work around to this issue?
I would suggest making an info_projecteddecal entity like this page talks about: [url]https://developer.valvesoftware.com/wiki/Decals[/url] That is, make one of these: [url]https://developer.valvesoftware.com/wiki/Info_projecteddecal[/url] However, the ability to scale its size makes me think util.DecalEx uses [url]https://developer.valvesoftware.com/wiki/Info_overlay[/url] Whichever one suits your needs. I don't know if info_overlay is something that can be created during the game.
I've been needing some help with a thridperson flashlight system, so basically due to the way the flashlight is if you go into thirdperson then the flashlight will emit the shadow of the person using the flashlight, I do not want this so I rigged something up to move the projected texture forward based on how much the camera moves back in thirdperson but sadly it seems to work only somewhat the flashlight will basically move forward 1 frame then return to normal. Here is the function that moves it, this is called by Think on the server [code]function TPF_UpdateLight() for i, ply in pairs( player.GetAll() ) do if TPF_CanUpdate() and IsValid( pjs[ ply ] ) then if SERVER then pjs[ ply ]:SetPos( (ply:EyePos() + ply:GetAimVector() * 2) + -Vector( ply:GetInfoNum("simple_thirdperson_cam_distance",0), 0, 0) ); pjs[ ply ]:SetAngles( ply:EyeAngles() ); end end end end[/code]
I'm trying to make it so that people can buy a hoverboard in the DarkRP F4 menu based on the settings they have in the hoverboard tool with [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=150455514"]this addon[/URL]. I'm doing this to make them costly and discourage people from deleting them if they're stolen by someone else, so they try to get it back instead. As one would expect, given that the hoverboard is made out of three entities (modulus_hoverboard, modulus_hoverboard_avatar, and modulus_hoverboard_hull), I can't just add one as the entity to spawn and expect it to work... In fact, spawning a modulus_hoverboard creates an error with no collisions, the hull is just the physics object, and I didn't even try the avatar. My question is, how can I make this work?
[code]] lua_run string.gmatch( v, '\"[a-zA-Z]+\"\s\"[a-zA-Z]+\"' ) > string.gmatch( v, '\"[a-zA-Z]+\"\s\"[a-zA-Z]+\"' )... [ERROR] "' 1. unknown - lua_run:0 [/code] I am very confused.
Remove the \s; you would only need to escape those double-quotes if you used double-quotes to start the string but you're using single-quotes. [code]lua_run print( string.gmatch( "Testing 1 2 3", '"[a-zA-Z]+"s"[a-zA-Z]+"' ) ) > print( string.gmatch( "Testing 1 2 3", '"[a-zA-Z]+"s"[a-zA-Z]+"' ) )... function: builtin#84 [/code]
-snip-
[QUOTE=meharryp;47034297][code]] lua_run string.gmatch( v, '\"[a-zA-Z]+\"\s\"[a-zA-Z]+\"' ) > string.gmatch( v, '\"[a-zA-Z]+\"\s\"[a-zA-Z]+\"' )... [ERROR] "' 1. unknown - lua_run:0 [/code] I am very confused.[/QUOTE] \s is not a valid escape sequence, no idea why the error is wrong though. Your pattern can be simplified also (assuming your \s is supposed to be a %s wildcard). [code] string.gmatch( v, [["%a+"%s"%a+"]] ) [/code]
I'm working on getting a Naval Warfare gamemode developed, and I'm looking for ways to make the inherent fucky-ness of physics interactions with water less laggy. Some other Naval gamemodes have found ways(that they hold as a closely guarded secret), but aside from collision groups, I need some suggestions. I'll also be hosting a version of the gamemode focusing on air vehicles, where water physics won't be a problem. Status update video if anyone's interested. [video=vimeo;118036910]http://vimeo.com/118036910[/video]
I'm trying to update my icon for my workshop addon but it isn't working I have the right directory and I'm entering this gmpublish.exe update -icon "C:\Users\Matthew\Desktop\Square.jpg" -id "330382441" it returns "Error Opening Addon<does the file exist?> Square.jpg exists, entering in chrome leads to my image The image is 512 x 512
How can I view the amount of memory or whatever that net messages use up? To help optimize my use of them of course
[QUOTE=Exho;47036156]How can I view the amount of memory or whatever that net messages use up? To help optimize my use of them of course[/QUOTE] You could modify the net.Incoming function to log average and total data each message uses.
How can I have auto refresh work with custom main menus? I'm trying to modify Robotboy's to my liking.
[QUOTE=ROFLBURGER;47035761]I'm trying to update my icon for my workshop addon but it isn't working I have the right directory and I'm entering this gmpublish.exe update -icon "C:\Users\Matthew\Desktop\Square.jpg" -id "330382441" it returns "Error Opening Addon<does the file exist?> Square.jpg exists, entering in chrome leads to my image The image is 512 x 512[/QUOTE] [IMG]http://puu.sh/fdOLh.png[/IMG] You forgot of the -addon parameter(not sure if its needed) However I'm not sure if you can change the icon with gmpublish or change the icon at all...
[QUOTE=ROFLBURGER;47035761]I'm trying to update my icon for my workshop addon but it isn't working I have the right directory and I'm entering this gmpublish.exe update -icon "C:\Users\Matthew\Desktop\Square.jpg" -id "330382441" it returns "Error Opening Addon<does the file exist?> Square.jpg exists, entering in chrome leads to my image The image is 512 x 512[/QUOTE] You need to switch to Dev branch in order to update the icon.
[QUOTE=WitheredPyre;47033794]I'm trying to make it so that people can buy a hoverboard in the DarkRP F4 menu based on the settings they have in the hoverboard tool with [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=150455514"]this addon[/URL]. I'm doing this to make them costly and discourage people from deleting them if they're stolen by someone else, so they try to get it back instead. As one would expect, given that the hoverboard is made out of three entities (modulus_hoverboard, modulus_hoverboard_avatar, and modulus_hoverboard_hull), I can't just add one as the entity to spawn and expect it to work... In fact, spawning a modulus_hoverboard creates an error with no collisions, the hull is just the physics object, and I didn't even try the avatar. My question is, how can I make this work?[/QUOTE] Here, it's a bit messy and the settings are hardcoded but maybe you'll find it useful. [url]http://pastebin.com/raw.php?i=G2avpgu9[/url] You can create a hoverboard at your feet using the "hoverboard" console command.
Does anyone know why vehicle Fire "Steer" only works without pressing A/D at speeds >= 30 or 35 MPH? I'm working on controller support ( mouse, etc... ) and I've tried simulating pressing IN_MOVELEFT/RIGHT and IN_LEFT/RIGHT in CreateMove, SetupMove and Move hooks but setting it won't let you steer without A/D keys unless going around 30-35MPH... One kind of cool side-effect is if you are using the mouse to steer, if you press A/D while the wheel is turned slightly then it'll steer just that tiny amount instead of 100% ( but only in the direction the wheel is turned, it ignores the other button ). To reproduce simply set ply:GetVehicle( ):Fire( "Steer", "1" ); in SetupMove while in a vehicle. It won't turn until you reach ~30/35MPH. I am planning on releasing this system in my dev-base and dev-addon ( It'll have plenty of features and be quite useful ).
[QUOTE=Acecool;47039427]Does anyone know why vehicle Fire "Steer" only works without pressing A/D at speeds >= 30 or 35 MPH? I'm working on controller support ( mouse, etc... ) and I've tried simulating pressing IN_MOVELEFT/RIGHT and IN_LEFT/RIGHT in CreateMove, SetupMove and Move hooks but setting it won't let you steer without A/D keys unless going around 30-35MPH... One kind of cool side-effect is if you are using the mouse to steer, if you press A/D while the wheel is turned slightly then it'll steer just that tiny amount instead of 100% ( but only in the direction the wheel is turned, it ignores the other button ). To reproduce simply set ply:GetVehicle( ):Fire( "Steer", "1" ); in SetupMove while in a vehicle. It won't turn until you reach ~30/35MPH. I am planning on releasing this system in my dev-base and dev-addon ( It'll have plenty of features and be quite useful ).[/QUOTE] A year ago I did mouse steering just for fun and ran into the same problem. It works fine when the player is outside the vehicle but once they are driving the wheels refuse to fully turn even if the player doesn't press anything. Ended up combining it with tiny bursts of WASD depending on angle of turn and it works OK but definitely not as good as it could be. Here is the code if anyone wants it: [url]http://pastebin.com/raw.php?i=PmnWEvqt[/url] Hold right click while in a vehicle to activate it.
Sorry, you need to Log In to post a reply to this thread.