• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
-snip- was late
Anyone know of any SNPC tutorials other than the one on maurtis? I'm trying to use gm_navigation as a node/nextbot replacement and need to learn how to make custom movement.
[QUOTE=Pandaman09;47095966]Anyone know of any SNPC tutorials other than the one on maurtis? I'm trying to use gm_navigation as a node/nextbot replacement and need to learn how to make custom movement.[/QUOTE] Why not just use nextbots? [url]http://wiki.garrysmod.com/page/NextBot_NPC_Creation[/url] Your best best though would be searching google for old addons that used snpcs and then using them for reference
[QUOTE=Shinycow;47096610]Why not just use nextbots? [url]http://wiki.garrysmod.com/page/NextBot_NPC_Creation[/url] Your best best though would be searching google for old addons that used snpcs and then using them for reference[/QUOTE] I wanted to use gm_navigation because it allows for faster creation of nodes. It's rather quick and easier than generating a nav mesh and having to manually edit it. Plus you can modify things quickly such as distance between nodes and different hull traces along the path. I do however, have a nextbot version already made. Just trying to learn new things as I go.
Question about shared lua files in autorun I have a shared script but it's not running unless I save it again while a game is running it's located in lua/autorun under the name sh_css_clow What do I have to add? AddCSLuaFile()? Include()?
[QUOTE=ROFLBURGER;47097519]Question about shared lua files in autorun I have a shared script but it's not running unless I save it again while a game is running it's located in lua/autorun under the name sh_css_clow What do I have to add? AddCSLuaFile()? Include()?[/QUOTE] Doesn't need anything. Maybe something is wrong with the code? Make sure it has a lowercase filename too.
[QUOTE=Willox;47097523]Doesn't need anything. Maybe something is wrong with the code? Make sure it has a lowercase filename too.[/QUOTE] It's lowercase, the code doesn't give any errors you can check it out of you want [url]https://github.com/BurgerLUA/CSSWeapons/blob/master/lua/autorun/sh_css_slow.lua[/url]
Using MySQLOO and I'm trying to setup a query function to do 90% of the work instead of re-writing code a bunch of times: [code] function queryDatabase( string ) --Use this string to query the database local q = rpDatabase:query( string ) --What to do once the query is successful function q:onSuccess( data ) return data end --What to do once the query fails function q:onError( err, sql ) --If there's an error, print out the error and the query print( err ) print( "SQL: " .. sql ) end --Start the query q:start() end function ply:getPlayerInfo() return queryDatabase( "SELECT Health, Thirst, Inventory, Backpack, Kills, Deaths FROM players WHERE SteamID = '" .. self:SteamID() .. "' LIMIT 1;" ) end [/code] Trying to print out ply:getPlayerInfo just seems to then give me an error: [img]http://puu.sh/fDNPl/5b862310c6.png[/img] What am I missing here, database is connected, I've specified ply as the metatable for player and queries are working. The only place it'll let me print anything is inside of the onSuccess callback.
You can't use return values like that. You gotta use a callback function as one of the arugments in queryDatabase and call that from within q:OnSuccess. What you are currently doing is you are return a value to onSucess. Also what you are doing is trying to return a value to a function after the function was called.
[QUOTE=Robotboy655;47099252]You can't use return values like that. You gotta use a callback function as one of the arugments in queryDatabase and call that from within q:OnSuccess. What you are currently doing is you are return a value to onSucess. Also what you are doing is trying to return a value to a function after the function was called.[/QUOTE] I see, got it working now, thanks for the help.
Is there a way to make AddCSLuaFile add all of the lua files in a specific folder? For example, instead of doing AddCSLuaFile("folder/one.lua"), AddCSLuaFile("folder/two.lua"), etc. doing something like AddCSLuaFile("folder/".."*"..".lua")
[QUOTE=TheLuaNoob;47100139]Is there a way to make AddCSLuaFile add all of the lua files in a specific folder? For example, instead of doing AddCSLuaFile("folder/one.lua"), AddCSLuaFile("folder/two.lua"), etc. doing something like AddCSLuaFile("folder/".."*"..".lua")[/QUOTE] I don't think you can do it without a loop. Just use recursive looping to get all the files in folders and subfolders.
[QUOTE=TheLuaNoob;47100139]Is there a way to make AddCSLuaFile add all of the lua files in a specific folder? For example, instead of doing AddCSLuaFile("folder/one.lua"), AddCSLuaFile("folder/two.lua"), etc. doing something like AddCSLuaFile("folder/".."*"..".lua")[/QUOTE] [lua] local files, folders = file.Find("lua/autorun/*.lua", "GAME") for k,v in pairs(files)do AddCSLuaFile(v) end [/lua]
-snip-
How would i go about displaying 2 sql rows and all the data within them,in a derma panel?
[QUOTE=quentuz;47104813]How would i go about displaying 2 sql rows and all the data within them,in a derma panel?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Category:DListView]DListView[/url] should get you what you need.
Seriously, is there a way for me to speed up my weapons reload while still using :DefaultReload() ?
How do I restrict the use of a phys gun while keeping it in the players inventory? Plz help C:
[QUOTE=Chai_Latte;47107058]How do I restrict the use of a phys gun while keeping it in the players inventory? Plz help C:[/QUOTE] If the player can't use it then why would you even give it to them? Maybe you should explain what your trying to do first?
[QUOTE=WalkingZombie;47106198]Seriously, is there a way for me to speed up my weapons reload while still using :DefaultReload() ?[/QUOTE] Nope. You get to head into the wild world of handling it yourself if you want to adjust the speed of the reload.
[QUOTE=Kogitsune;47107942]Nope. You get to head into the wild world of handling it yourself if you want to adjust the speed of the reload.[/QUOTE] Wild world? It's not like it's that tough, as long as there's :SequenceDuration() This just means even MORE code for my script, while it's not really a lot to add. Thank you for answering my question!
I'm trying to make a command to restrict the use of the phys gun. Not take it away. Coz if it took it away then it would not save when they changed job (its for darkRP) thanks still need help :/
[QUOTE=Chai_Latte;47107058]How do I restrict the use of a phys gun while keeping it in the players inventory? Plz help C:[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSwitchWeapon]GM/PlayerSwitchWeapon[/url] See the example given
[QUOTE=ROFLBURGER;47097519]Question about shared lua files in autorun I have a shared script but it's not running unless I save it again while a game is running it's located in lua/autorun under the name sh_css_clow What do I have to add? AddCSLuaFile()? Include()?[/QUOTE] Take a look at this: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/includes/file_only_works_on_autorefresh_possible_reasons.lua.html[/url] Also, you don't need AddCSLuaFile or include in any autorun/* files, autorun/client/* files, or autorun/server/* files... Where do you define this convar: sv_css_enable_speedmod ?? You're also way over thinking the problem. You can set up a convar callback so when the value changes, you set the new value ( you may want to set SlowEnable = false; at the top of the file, set the convar at the top ( can restrict it to server too if sharing, and remove some code. Also, ensure the Player is valid before continuing..
Does GetPData take a sec to retrieve and set the data? Whenever I get the data it resets the data to 0. [lua] if ply:GetPData( "HasJoined", 0 ) == 0 then ply:SetPData( "Points", 90000 ) ply:SetPData( "HasJoined", 1 ) end ply.AFrags = ply:GetPData( "AFrags", 0 ) --Gets/Sets the kills ply.ADeaths = ply:GetPData( "ADeaths", 0 ) --Gets/Sets the deaths ply.Wins = ply:GetPData( "Wins", 0 ) --Gets/Sets the wins ply.Loses = ply:GetPData( "Loses", 0 ) --Gets/Sets the loses ply.Points = ply:GetPData( "Points", 0 ) --Gets/Sets the points [/lua]
Okay so I have a class system for example: sniper, soilder, spy etc. And I want to know how to find which class a player is doing ply:GetClass() would just return player because thats the type of class it is, but how would I get a player class?
[QUOTE=mistopportuni;47111160]Okay so I have a class system for example: sniper, soilder, spy etc. And I want to know how to find which class a player is doing ply:GetClass() would just return player because thats the type of class it is, but how would I get a player class?[/QUOTE] If it's your own system, just set a variable to the player. If you're using the built-in class system: [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/player_manager/GetPlayerClass"]player_manager.GetPlayerClass[/URL] Wiki is a powerful tool
[QUOTE=Revenge282;47111263]If it's your own system, just set a variable to the player. If you're using the built-in class system: [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/player_manager/GetPlayerClass"]player_manager.GetPlayerClass[/URL] Wiki is a powerful tool[/QUOTE] Thanks, sorry for my noobness, I've only been doing this a day.
[QUOTE=ROFLBURGER;47095178]What is currently the best way to modify the player's movement speed without using SetWalkSpeed?[/QUOTE] What's wrong with SetWalkSpeed? That's the only one that I know about. I don't really care about the date of the post I'm legitimately trying to help and check up on ya.
[QUOTE=wauterboi;47111551]What's wrong with SetWalkSpeed? That's the only one that I know about. I don't really care about the date of the post I'm legitimately trying to help and check up on ya.[/QUOTE] Yeah I already solved it. I used PlayerCommand or w/e it's called The thing with SetWalkSpeed is that virtually every Addon uses it (DarkRP, Admin Mods, Other Gamemodes, ect) so you're going to have conflicting speeds
Sorry, you need to Log In to post a reply to this thread.