• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
SetColor( Color( r,g,b ) )?
[QUOTE=Skere_;49536925]-snip- worked[/QUOTE] If you have an issue that gets resolved please don't snip it. It's useful for others to come back and look at.
[QUOTE=YourStalker;49537130]If you have an issue that gets resolved please don't snip it. It's useful for others to come back and look at.[/QUOTE] The problem was solved below it tho, anyway I had SetColor(r,g,b) instead of SetColor(Color(r,g,b) )
[QUOTE=Skere_;49538456]The problem was solved below it tho, anyway I had SetColor(r,g,b) instead of SetColor(Color(r,g,b) )[/QUOTE] he literally said "if your problem gets solved, please don't snip it"
[I]I've been trying to get this to work for about a week now, god damnit.[/I] What I'm trying to do is simple: when GetGlobalInt("millionaire_pregame_countdowntimer") == 55, play a sound through CSoundPatch (because I may need to stop the sound in the future), simple right? Ha, ha. Let me list the problems that I've encountered. 1) I cannot set a variable equal to CreateSound( LocalPlayer(), "sound/path/file.mp3" ) as I need to reload the cl_init.lua for that to work, so I have to use the entire name when calling it. 2) I cannot use surface.play() because I need to stop the sound in the future (just that sound, not all of the sounds) 3) If I try to play the sound below, it plays for about a second or two until completely shutting off. 4) No errors are being returned. Here's as far as I've gotten with trying to figure this out before giving up (clientside): [CODE] musicStarted = false function Think() if GetGlobalInt("millionaire_pregame_countdowntimer") == 55 then initializeSound() end end hook.Add( "Think", "Countdown Stage Think", Think ) function initializeSound() if musicStarted == false then CreateSound( LocalPlayer(), "millionaire/pregame/music/intro.mp3", 1 ):Play() musicStarted = true end end [/CODE] Thank you very much in advance.
Could someone tell or link me to a tutorial that explains how to set up player classes for the sandbox game mode thanks in advance
:snip: didn't read
One person who is using my addon says that he is being spammed with [NetLog] messages. I have no clue what netlog is and the guy insists it's my addon. Here is the screenshot he gave me [img]http://puu.sh/mxFqT/fc0699837c.jpg[/img] Google returned no results except for this: [url]https://steamcommunity.com/app/4000/discussions/1/598198356162455012/[/url] I'm posting it here because someone in here told him that it was my addon printing those message. Pretty pissed off right now about that because its a problem that isn't exclusive to my addon and there are no print messages or PrintTable messages in my addon. Could be my addon for all I know, I don't know. I just want answers to why this might be happening, or the explanation someone gave this person. [editline]3[/editline] My current lead is that it might be Cake AntiCheat because apparently he has it and it logs net messages. He has to try that tomorrow but if anyone has any ideas please let me know.
If your addon as no prints in it like that (or print in general) and you don't have any sort of RunString or SendLua that may be causing those to print then it isn't really possible that it's caused by your addon directly. If the prints were from the engine or some kind of module they usually aren't as well formatted and I think they print in the color red.
So I'm using Handsome Matt's 3D2D vgui thing and I'm trying to make it so that I can use it in a CalcView hook. So far I've tried normalizing the vector, rotating the vector around the angle and then normalizing it but I'm probably over-complicating it. Any suggestions? [editline]16th January 2016[/editline] Should clarify, I want to be able to interact with the ui while in the calcview hook, I've already got the clicking down.
this prints "added", but yet the results is like this: [url]https://i.gyazo.com/7417134141e898368cea0a849eaf23d0.gif[/url] does anyone know why the item doesn't show up? [url]http://pastebin.com/v4j0WVT9[/url]
Is it possible to retrieve the "Spectrum Analyzer" result from the Media Player addon ? Or anything related to it (like the table/channel) I'm trying to use it on a model to manipulate its bones with the music playing by the Media Player. The code from Media Player: [url]https://github.com/pixeltailgames/gm-mediaplayer/blob/master/lua/mediaplayer/services/audiofile/cl_init.lua[/url]
Just a quick question: Is there a reason why ents.FindByName() only works serverside? It seems pretty weird to me, I mean, clients have loaded up the exact same .BSP as the server, so shouldn't they also have loaded up the names of the map entities?
[QUOTE=jrj996;49529074]Could anyone give me a general idea of how to swap body parts for players? Like to give a combine body a civilian head? I remember seeing this a while back in some RP gamemodes. I'm assuming it would use ClientsideModels, but that's about all I can gather. I appreciate any help :) Basically, if the bone has any of those words then we shrink the original player models head, hands, etc. Now, it shrinks, but it also shrinks the clientside model, I'm assuming it has something to do with EF_BONEMERGE. Anyone have an idea on how to fix this?[/quote] Wondering if you were able to get any help with this outside of this thread, because I'm actually trying to accomplish the same thing. I actually used the same strategy without finding any example code, so I guess I'm on the right track. But, same issue, manipulating the bone scale on the player also affects the scale of the bonemerged entity, even if it gets parented afterwards.
[QUOTE=Silhouhat;49541013] 1) I cannot set a variable equal to CreateSound( LocalPlayer(), "sound/path/file.mp3" ) as I need to reload the cl_init.lua for that to work, so I have to use the entire name when calling it. [/QUOTE] What? Why do you need to reload cl_init.lua for this to work? [QUOTE=Silhouhat;49541013] 3) If I try to play the sound below, it plays for about a second or two until completely shutting off. [/QUOTE] This could be because you are running the first code each game tick. Unless "millionaire_pregame_countdowntimer" changes from 55 the exact gametick, it will execute initializeSound() again. [editline]17th January 2016[/editline] [QUOTE=Mornedil;49544104]Just a quick question: Is there a reason why ents.FindByName() only works serverside? It seems pretty weird to me, I mean, clients have loaded up the exact same .BSP as the server, so shouldn't they also have loaded up the names of the map entities?[/QUOTE] Most likely because these entities' properties can change, and when they do the server won't necessarily send that info to all clients because they might not need it and it may cause lag.
Anyone know why I seem to be getting a "table index is nil" error here? [code]function a_star ( start, goal, nodes ) local closedset = {} local openset = { start } local came_from = {} local g_score, f_score = {}, {} g_score [ start ] = 0 -- this line is causing the error f_score [ start ] = g_score [ start ] + heuristic_cost_estimate ( start, goal ) while #openset > 0 do local current = lowest_f_score ( openset, f_score ) if current == goal then local path = unwind_path ( {}, came_from, goal ) table.insert ( path, goal ) return path end remove_node ( openset, current ) table.insert ( closedset, current ) local neighbors = current.neighbor for _, neighbor in ipairs ( neighbors ) do if not_in ( closedset, neighbor ) then local tentative_g_score = g_score [ current ] + dist_between ( current, neighbor ) if not_in ( openset, neighbor ) or tentative_g_score < g_score [ neighbor ] then came_from [ neighbor ] = current g_score [ neighbor ] = tentative_g_score f_score [ neighbor ] = g_score [ neighbor ] + heuristic_cost_estimate ( neighbor, goal ) if not_in ( openset, neighbor ) then table.insert ( openset, neighbor ) end end end end end return nil -- no valid path end[/code] This seems to happen everytime I call it. I call it like this: [code]astar.a_star( GLOBAL_NODEGRAPH[some number], GLOBAL_NODEGRAPH[some other number], GLOBAL_NODEGRAPH )[/code] GLOBAL_NODEGRAPH contains a ton of tables.
[QUOTE=MaximLaHaxim;49547021]Anyone know why I seem to be getting a "table index is nil" error here? -code- This seems to happen everytime I call it. I call it like this: [code]astar.a_star( GLOBAL_NODEGRAPH[some number], GLOBAL_NODEGRAPH[some other number], GLOBAL_NODEGRAPH )[/code] GLOBAL_NODEGRAPH contains a ton of tables.[/QUOTE] What is GLOBAL_NODEGRAPH[some number]? If lua says that the table index is nil it means that GLOBAL_NODEGRAPH[some number] doesn't exist. Try printing the value of start before g_score [ start ] = 0 and see what it prints.
[QUOTE=roastchicken;49547744]What is GLOBAL_NODEGRAPH[some number]? If lua says that the table index is nil it means that GLOBAL_NODEGRAPH[some number] doesn't exist. Try printing the value of start before g_score [ start ] = 0 and see what it prints.[/QUOTE] Ah shit, I forgot that all my AI nodes were in a table called GLOBAL_NODEGRAPH.nodes, not just GLOBAL_NODEGRAPH itself :v:. Thanks for helping, though!
i'd like some advice on please on how to return more than 1 value from a module to lua file variables... i have this code in my module: [lua] int OVRread(lua_State* state) { LUA->PushNumber(100.00); LUA->PushNumber(200.00); LUA->PushNumber(300.00); return 3; } GMOD_MODULE_OPEN() { LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB); LUA->PushCFunction(OVRread); LUA->SetField(-2, "OVRread"); LUA->Pop(); return 0; } [/lua] In my lua file I have: [lua] require("oculus") print(OVRread()) --prints 100 200 300 to console, confirms my module is returning 3 values myvariable = OVRread() print(myvariable) --prints 100 [/lua] The problem is I need access to the other values in my lua file, the 200 and 300. How would I get these? It'd be great if I could store them in a table, so it would look like: myvariable={} myvariable[1]="100" myvariable[2]="200" myvariable[3]="300"
[QUOTE=arustusername;49550916] -snip- How would I get these? It'd be great if I could store them in a table[/QUOTE] If the function you want to call has multiple return values (such as your OVRread function) you can wrap the call to it in curly braces to store its return values in a table: [lua] myvariable = { OVRread() } print( myvariable[2] ) -- prints 200 [/lua]
Does timer.Simple not run in lua/autorun anymore? I'm trying to include some files a second after this initial one loads but it doesn't seem to run This won't print either [code] if SERVER then timer.Simple(1, function() print("works") end) end [/code]
[QUOTE=npypntz;49551017]If the function you want to call has multiple return values (such as your OVRread function) you can wrap the call to it in curly braces to store its return values in a table: [lua] myvariable = { OVRread() } print( myvariable[2] ) -- prints 200 [/lua][/QUOTE] tested, all good, thanks.
I have a derma menu with the button: [code] BtnOn.DoClick = function() print("Eon sent") net.Start( "Eon" ) net.SendToServer() end [/code] and then in a server side file [code] util.AddNetworkString("Eon") net.Receive("Eon",function() print("Eon recieved") if(GetConVarNumber( "ulx_logEcho") == 1) then print("Echos are already on you silly billy!") end if(GetConVarNumber( "ulx_logEcho") == 0) then RunConsoleCommand("ulx", "logEcho", "1") print("You have turned Echos on") end end ) [/code] But when i click the button it says eon sent but doesnt actually receive anything/run the function, any help ?
[QUOTE=NiandraLades;49551149]Does timer.Simple not run in lua/autorun anymore? I'm trying to include some files a second after this initial one loads but it doesn't seem to run This won't print either [code] if SERVER then timer.Simple(1, function() print("works") end) end [/code][/QUOTE] Has anyone joined the server? Beacouse when the server has started and nobody joined it, it is on some sort of "suspension". A way i know to fix this is to create a bot on server.cfg or autoexec.cfg and then kick it.
[QUOTE=arustusername;49551154]tested, all good, thanks.[/QUOTE] You can also do: [code]a, b, c = OVRread( )[/code] The table is one route, but isn't required.
how would i have text printed in a team chat on TTT if a weapon is purchased?
Is it possible to award pointshop points / T Credits to a Traitor when they hang a corpse ? (TTT) and if so how would i go about doing such a thing ? Looked and i couldnt find any Hooks for hanging a body.
[QUOTE=seabeds;49553348]how would i have text printed in a team chat on TTT if a weapon is purchased?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/ChatPrint]Player:ChatPrint[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/chat/AddText]chat.AddText[/url]
[QUOTE=MPan1;49553576][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/ChatPrint]Player:ChatPrint[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/chat/AddText]chat.AddText[/url][/QUOTE] I did in fact take a look at that before asking (thank you anyways!) but i cannot figure out what hooks/functions i would use for the purchase of a traitor weapon (i am currrenly learning lua right now).
Regarding SWEPs, I'm confused over when to just use variables or use SetupDataTables() and go from there. And also in SetupDataTables(), is it better to use DTVar or NetworkVar? On the wiki it says that NetworkVar should be used, but in default TTT weapons, DTVar is used.
Sorry, you need to Log In to post a reply to this thread.