• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
After trying to get my audio files to match the exact specifications that surface.PlaySound is picky about, I am still having no luck. *** Invalid sample rate (32000) Even though the file's sample rate is 44100hz, but only after changing it from 32000 to 44100 with Audacity. For some reason Audacity speeds up the sample rate. Whenever I use VLC to convert my file I get an error along the lines of "Unable to create BASS Audio Stream (unsupported file format)
[QUOTE=code_gs;52685282]You have to pass the function object[/QUOTE] But is there anyway to get a function from the functions location? ie 0x4caee048 into the object? I can pass it to the string dump on clientside but then I can't verify if the byte is correct server side without passing the object which could be overwritten
[QUOTE=blackwidowman;52685387]But is there anyway to get a function from the functions location? ie 0x4caee048 into the object? I can pass it to the string dump on clientside but then I can't verify if the byte is correct server side without passing the object which could be overwritten[/QUOTE] At this point you're talking about memory reading Which isn't possible .
[QUOTE=blackwidowman;52685387]But is there anyway to get a function from the functions location? ie 0x4caee048 into the object? I can pass it to the string dump on clientside but then I can't verify if the byte is correct server side without passing the object which could be overwritten[/QUOTE] [b]What is your goal?[/b] are you trying to write an anti-hack? or a hack? attempting to un-obfusticate a file? If you are trying to send a function from the client to the server don't, Never trust the client, find another way this is not safe.
[QUOTE=Fantym420;52685681][b]What is your goal?[/b] are you trying to write an anti-hack? or a hack? attempting to un-obfusticate a file? If you are trying to send a function from the client to the server don't, Never trust the client, find another way this is not safe.[/QUOTE] Just sounds like function/file verification. I don't think he's attempting to network it.
[QUOTE=code_gs;52685693]Just sounds like function/file verification. I don't think he's attempting to network it.[/QUOTE] [QUOTE] I can pass it to the string dump on clientside but then I can't verify if the byte is correct server side without passing the object which could be overwritten [/QUOTE] I thought what is meant here was to dump a function's code on the client and then upload it to the server. Either way I like to spread the message to never trust the client.
[QUOTE=Fantym420;52685713]I thought what is meant here was to dump a function's code on the client and then upload it to the server. Either way I like to spread the message to never trust the client.[/QUOTE] That's a very overarching message that is wrong a lot of the time. A better statement would be you should never believe the client over the server. Using what the client says can be useful in cases of ping and lag compensation, or necessary in relation to user input.
[QUOTE=code_gs;52685022]It's because teams aren't loaded by the time you declare the table. Try updating the table in a timer.[/QUOTE] How to do that?
[QUOTE=HikkaSurito;52686781]How to do that?[/QUOTE] [code]local foo = {} timer.Simple(1, function() foo[1] = TEAM_WHATEVER foo[2] = TEAM_BLAH end)[/code]
Having trouble postioning items on players properly within pointshop. Everytime I position correctly on the CS models, on other models they're always wrong. I know differen't players are different sizes and ect, but just so confused how to get over it?
[QUOTE=code_gs;52687040][code]local foo = {} timer.Simple(1, function() foo[1] = TEAM_WHATEVER foo[2] = TEAM_BLAH end)[/code][/QUOTE] Testing, thanks! And it's not working, WTF..... Updated code: [CODE]local foo = {} timer.Simple(1, function() foo[1] = TEAM_HELIX foo[2] = TEAM_CMD_SEC end) local tbl = { jobs = {}, doors = { ["func_door"] = true, ["prop_door_rotating"] = true, ["prop_dynamic"] = true } } -- Jobs does not exist until the gamemode has loaded, so we're gonna do it in here. hook.Add("InitPostEntity", "insertJobs", function() local jobs = { [TEAM_HELIX] = true, } table.Merge(tbl.jobs, jobs); end); hook.Add("PlayerUse", "openDoors", function(ply, ent) if (not IsValid(ply) or not IsValid(ent)) then return; end local tr = util.TraceLine({ start = ply:GetPos(), endpos = ply:GetShootPos() + ply:GetAimVector() * 100, filter = ply }); if (IsValid(tr.Entity) and tbl.doors[tr.Entity:GetClass()]) then if (tbl.jobs[ply:Team()]) then -- If the door is locked then it won't open, uncomment this to make the doors unlock and open -- tr.Entity:Fire("unlock"); tr.Entity:Fire("open", "", .5); end end end);[/CODE] Maybe I've done something not like needed?
[QUOTE=LemonDevil;52687150]Having trouble postioning items on players properly within pointshop. Everytime I position correctly on the CS models, on other models they're always wrong. I know differen't players are different sizes and ect, but just so confused how to get over it?[/QUOTE] I haven't use pointshop, but I'm fairly sure it uses PAC3, this is an issue you will get, the way I do it is in PAC3 I ensure that they are connected to the right bones and test it out on different models and try and get a solution that looks okay (ish) on most models
[QUOTE=Fantym420;52685681][b]What is your goal?[/b] are you trying to write an anti-hack? or a hack? attempting to un-obfusticate a file? If you are trying to send a function from the client to the server don't, Never trust the client, find another way this is not safe.[/QUOTE] Anti hack. Trying to check if a client side file has been tampered with because I do agree never trust the client!
[QUOTE=blackwidowman;52687988]Anti hack. Trying to check if a client side file has been tampered with because I do agree never trust the client![/QUOTE] If you wanted to be pro about it you could get the function from CompileFile for the files serverside, use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/util.funck]jit.util.funck[/url] to get the functions inside the file, cache the bytecode, then compare the client's bytecode to the server's with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/attach]jit.attach[/url]. iirc !CAC does something similar.
[QUOTE=txike;52687991]If you wanted to be pro about it you could get the function from CompileFile for the files serverside, use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/util.funck]jit.util.funck[/url] to get the functions inside the file, cache the bytecode, then compare the client's bytecode to the server's with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/attach]jit.attach[/url]. iirc this is how !CAC does something similar.[/QUOTE] I will look into it thank you
Is there a way to remove an effect on the client? If so, could someone point me towards the right direction.
I want to disable triggering "numpad" functions with player's keyboard. By disabling, I mean when somebody press a key to trigger a lamp/winch/dynamite it shouldnt work. They should be only activateable with button-keypad etc. Since button and keypad use those functions by theirself, I only have to make some overrides on these functions. does anybody have an idea?
[QUOTE=txike;52687991]If you wanted to be pro about it you could get the function from CompileFile for the files serverside, use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/util.funck]jit.util.funck[/url] to get the functions inside the file, cache the bytecode, then compare the client's bytecode to the server's with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/attach]jit.attach[/url]. iirc this is how !CAC does something similar.[/QUOTE] I'm unsure how to overcome the hurdle. I'm trying to compile file a file to be analysed but I can't, it just errors the location of the file :(. Is there no way to retrieve the contents via compile file? I tried AddCSLuaFile as a last resort but no avail Couldn't include file 'gamemodes/base/gamemode/cl_init.lua' (File not found)
[QUOTE=blackwidowman;52689993]I'm unsure how to overcome the hurdle. I'm trying to compile file a file to be analysed but I can't, it just errors the location of the file :(. Is there no way to retrieve the contents via compile file? I tried AddCSLuaFile as a last resort but no avail Couldn't include file 'gamemodes/base/gamemode/cl_init.lua' (File not found)[/QUOTE] Be sure you're doing it serverside and you don't need to put "gamemodes/" at the start.
-snip- got it working with compilestring instead
I forgot to mention that jit.util.funck and jit.attach will return prototype functions so you have to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/util.funcinfo]jit.util.funcinfo[/url] instead of debug.getinfo.
[QUOTE=txike;52690100]I forgot to mention that jit.util.funck and jit.attach will return prototype functions so you have to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/jit/util.funcinfo]jit.util.funcinfo[/url] instead of debug.getinfo.[/QUOTE] How can I get the function with jit.util.funck it requires a constant i've tried with the garbage constant and nconsts provided by jit
[QUOTE=blackwidowman;52690580]How can I get the function with jit.util.funck it requires a constant i've tried with the garbage constant and nconsts provided by jit[/QUOTE] This code basically just compiles everything in "lua/autorun/", gets all the constants with jit.util.funck, checks if they're a prototype function, then prints where the function was created and on what line in the file. [code]local files = file.Find("lua/autorun/*.lua", "GAME") for i, name in ipairs(files) do files[name] = CompileFile("autorun/" .. name) files[i] = nil end for name, func in next, files do print(name .. ":") -- gcconsts isn't always 100% accurate from what little testing I have done -- but when it was wrong it was only 1 off and was only wrong for 1 file out of 87. for i = 0, -jit.util.funcinfo(func).gcconsts, -1 do local funck = jit.util.funck(func, i) -- get the constant -- it doesn't return normal functions so isfunction wouldn't work here. if (type(funck) == "proto") then local funcinfo = jit.util.funcinfo(funck) -- prototype function so you have to use jit.util.funcinfo. -- verify the function here print("", funcinfo.loc) end end print("") end [/code] Output: [code]base_npcs.lua: base_npcs.lua:5 game_hl2.lua: game_hl2.lua:4 game_hl2.lua:11 properties.lua: base_vehicles.lua: base_vehicles.lua:5 base_vehicles.lua:74 base_vehicles.lua:208 base_vehicles.lua:212 base_vehicles.lua:215 utilities_menu.lua: utilities_menu.lua:8 utilities_menu.lua:14 utilities_menu.lua:20 utilities_menu.lua:64 utilities_menu.lua:114 utilities_menu.lua:139 utilities_menu.lua:166 utilities_menu.lua:180 menubar.lua: menubar.lua:9 menubar.lua:47 developer_functions.lua: developer_functions.lua:2 developer_functions.lua:41 developer_functions.lua:71 [/code] Probably isn't perfect but I don't know any better ways of doing it.
I've been having an issue with mysqloo :( onSuccess and onFailed isn't being called, even tho the query goes through and is successful. heres muh code: [code] require 'mysqloo' local DB_HOST = 'localhost' local DB_USER = 'root' local DB_PASSWORD = 'root' local DB_NAME = 'inventory' local DB_PORT = '3306' local function spam(str) print '\n\n\n' for i = 1, 10 do print(str) end print '\n\n\n' end hook.Add('Initialize', 'sql_test_xd_lmao', function() local sql_obj = mysqloo.connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT) sql_obj.onConnected = function() spam 'Connected to MySQL' local query = sql_obj:query 'create table if not exists testing_rawr (uno varchar(50), dos bigint)' query.onSuccess = function() spam 'Query was successfull' end query.onError = function(_, err) spam('Query error: ' .. err) end query:start() end sql_obj.onConnectionFailed = function(_, err) spam('MySQL connection failed: ' .. err) end sql_obj:connect() end) [/code] onConnected is being called: [t]https://gyazo.com/0ef95d79083edbbfc94e2bcabe26f63d.png[/t] and here's to show that the query is successful: [t]https://gyazo.com/e32aed5633bed99afe1d421dbf0ec44f.png[/t] thanks :D
Getting an interesting issue; [CODE]Couldn't include file 'cl_inventory.lua' (File not found) (@gamemodes/gmbr/gamemode/cl_init.lua (line 6))[/CODE] This only happens for some people, usually rejoining a [I]few[/I] times fixes it This has also happened in the past with cl_init.lua.. Here's all of my includes setup init.lua [CODE]AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "thirdots.lua" ) AddCSLuaFile( "sh_items.lua" ) AddCSLuaFile( "pac3_itemsetup.lua" ) AddCSLuaFile( "cl_scoreboard.lua" ) AddCSLuaFile( "cl_inventory.lua" ) include( 'shared.lua' ) include( 'thirdots.lua' ) include( 'sh_items.lua' ) include( 'pac3_itemsetup.lua' )[/CODE] cl_init.lua [CODE]include( "shared.lua" ) include( "thirdots.lua" ) include( "sh_items.lua" ) include( "pac3_itemsetup.lua" ) include( "cl_scoreboard.lua" ) include( "cl_inventory.lua" )[/CODE] There's no errors to go with this, it just sometimes doesn't like to include the file, can anyone help me out here? would be appreciated :)
Anyone know why networked variables created with `self.Player:NetworkVar` in a player class are not being networked to other clients? I have an RP name string in slot 0 in my citizen class which isnt getting networked to other players on the server. The server reports it being created correctly and its returning the correct name on the server but on the client only I have the getter for it, for other players its nil. I managed to "fix" this by doing [code]hook.Add("NetworkEntityCreated", "", function(e) if (e:IsPlayer()) then player_manager.RunClass(e, "SetupDataTables") end end)[/code]
DTVars on players are a bit wonky. Use NW(2)Vars.
[QUOTE=Tupac;52690751]mysql err[/QUOTE] You're probably testing without a player on the server, at least one player needs to be on before statements are executed. It'll connect without players though, as the statement is blocking. Also I hope your real root password isn't root
[QUOTE=>>oubliette<<;52697921]You're probably testing without a player on the server, at least one player needs to be on before statements are executed. It'll connect without players though, as the statement is blocking. Also I hope your real root password isn't root[/QUOTE] sv_hibernate_think 1 will allow think hooks to run with no players online (which will let the query run) I'd hope no one is using root to log into their SQL server in production.
OK, I see a problem in local timer, I've fixed it, but script still not working. Stop just marking my post with FUNNY and DUMB sections, just help me, i'm realy feel myself stupid... Fixed timer: [CODE]local foo = { timer.Simple(1, function() foo[1] = TEAM_HELIX foo[2] = TEAM_CMD_SEC end)} local tbl = { jobs = ["TEAM_HELIX"] = true, doors = { ["func_door"] = true, ["prop_door_rotating"] = true, ["prop_dynamic"] = true } } -- Jobs does not exist until the gamemode has loaded, so we're gonna do it in here. hook.Add("InitPostEntity", "insertJobs", function() local jobs = { [TEAM_HELIX] = true, } table.Merge(tbl.jobs, jobs); end); hook.Add("PlayerUse", "openDoors", function(ply, ent) if (not IsValid(ply) or not IsValid(ent)) then return; end local tr = util.TraceLine({ start = ply:GetPos(), endpos = ply:GetShootPos() + ply:GetAimVector() * 100, filter = ply }); if (IsValid(tr.Entity) and tbl.doors[tr.Entity:GetClass()]) then if (tbl.jobs[ply:Team()]) then -- If the door is locked then it won't open, uncomment this to make the doors unlock and open -- tr.Entity:Fire("unlock"); tr.Entity:Fire("open", "", .5); end end end);[/CODE]
Sorry, you need to Log In to post a reply to this thread.