• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
If you need it clientside, use GetConVarNumber( "example_test_variable" ), if serverside, use Player:GetInfoNumer(""example_test_variable"") ( or GetInfo for strings ) Edit: Clocks
So...After all this time...GetConVarNumber was right? So the code above works? (I wanted the client var anyway)
The console command above uses serverside functions to manipulate entities, how do you expect the clientside function GetConVarNumber to work?
Whatever admin presses the button, it will just apply HIS individual settings to all props, and if another admin presses a button, HIS settings will be applied. How am I meant to do that? Wait, ignore the above. [editline]13th March 2015[/editline] Do I just do Player:GetInfoNum("example_test_variable") instead, then? That gets the client's number on a server, right? [editline]13th March 2015[/editline] My last statement WAS actually a question. Okay, I'll take that silence as a 'yes'.
[QUOTE=Neat-Nit;47317622]Somewhere in the gamemode, serverside.[/QUOTE] I am doing this for DarkRP and we cant/are not meant to edit the base gamemdoe, all mods are done through DarkRPModification, is there a folder/file in there that I can put it in? Thanks! =)
Hey guys. I am using the funcion ply:GetWeapons, and getting thier weapons as a userdata. Later on i would like to re-give them those weapons, how would i do that? My code: [CODE] ply.OldWeapons = ply:GetWeapons() for k,v in pairs (ply.OldWeapons) do ply:Give(v) end [/CODE] Error: [CODE] bad argument #1 to 'Give' (string expected, got userdata) [/CODE]
GetWeapons contains the actual weapon entities. Use ply:Give(v:GetClass()).
[QUOTE=G4MB!T;47320102]GetWeapons contains the actual weapon entities. Use ply:Give(v:GetClass()).[/QUOTE] Thanks! :D [editline]14th March 2015[/editline] Another question. I have a timer which is inside a hook, and it uses the ply from that hook. The timer runs for 40 seconds, then stops, but after thoes 40 seconds, he doesn't know who is ply, since the variable changes all the time, anyone has any idea how to keep the ply in the timer? Remember that if its a hook, the ply, will change all the time.
I'm guessing you have some code like the following: [lua] hook.Add("hookName", "myHook", function(ply) timer.Simple(40, function() // use player here end); end); [/lua] In which case you really shouldnt have any issues. If you would like to tell us what you are doing we might be able to provide you with a more reliable alternative. [editline]14th March 2015[/editline] If you trade me your usp-s blood tiger I'll let you add me on Steam :v:.
Never mind fixed that :P But one more question (hopfully last one).. Is there anyway to convert UniqueID back to SteamID?
[QUOTE=tzahush;47320298]Never mind fixed that :P But one more question (hopfully last one).. Is there anyway to convert UniqueID back to SteamID?[/QUOTE] Not unless the player is on the server. (player.GetByUniqueID():SteamID())
Guess I'm not getting a black tiger :'(. To the point, UniqueID is not related to SteamID I think, so a conversion is not possible. Is there any reason why you cant use the 64 bit SteamID instead? If you really must use UniqueID, you can loop through all the players, compare UniqueID then return the SteamID. -snip: shit code and ninja'd - [editline]14th March 2015[/editline] Boxes me...
[QUOTE=G4MB!T;47320321]To the point, UniqueID is not related to SteamID I think[/QUOTE] UniqueID is just a hash function of a SteamID, CRC if I remember correctly. But like any hash function, a reversal isn't really possible. Maybe when quantum computers become commonplace :v:
Ye I dont use the player library a whole let, and when I do its usually GetAll or GetHumans and I forgot that there was more functions.
I want to [B]completely[/B] remove all tools and tool categories from the Q menu in my [I]sandbox derived gamemode. [/I]How do I do that?
[QUOTE=Neat-Nit;47320348]UniqueID is just a hash function of a SteamID, CRC if I remember correctly. But like any hash function, a reversal isn't really possible. Maybe when quantum computers become commonplace :v:[/QUOTE] [code] local meta = FindMetaTable("Player") function meta:UniqueID() return util.CRC("gm_" .. self:SteamID() .. "_gm") end [/code] That's what it does, iirc edit:fixed
Hey guys, just wondering if anyone knows a way to clear all the weapon entities from a map using either Lua or a console command? Thanks! edit: I've found this, [CODE]ents.FindByClass( "prop_physics" )[1]:Remove()[/CODE] Does anyone know the entity classes for weapons and ammo? edit#2: I've found out that it seems to be the weapon folder's name
[QUOTE=Leystryku;47320687][code] local meta = FindMetaTable("Player") function meta:UniqueID() return util.CRC("gm_" .. util.CRC(self:SteamID()) .. "_gm") end [/code] That's what it does, iirc[/QUOTE] It's actually [code] util.CRC("gm_" .. ply:SteamID() .. "_gm") [/code]
To expand on my last question that I figured out how to do, is there a way of obtaining all the filenames in a directory using Lua? For example if I wanted to obtain a substring of each file name in the directory "C:\GMOD\garrysmod\gamemodes\terrortown\entities\weapons\" using a for loop?
[QUOTE=r0uge;47320803]Hey guys, just wondering if anyone knows a way to clear all the weapon entities from a map using either Lua or a console command? Thanks! edit: I've found this, [CODE]ents.FindByClass( "prop_physics" )[1]:Remove()[/CODE] Does anyone know the entity classes for weapons and ammo? edit#2: I've found out that it seems to be the weapon folder's name[/QUOTE] [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/ents/GetAll"]ents.GetAll[/URL] [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Entity/IsWeapon"]Entity:IsWeapon[/URL] You'll need to check for weapon ownership too, or this will remove all weapons.
[QUOTE=r0uge;47321008]To expand on my last question that I figured out how to do, is there a way of obtaining all the filenames in a directory using Lua? For example if I wanted to obtain a substring of each file name in the directory "C:\GMOD\garrysmod\gamemodes\terrortown\entities\weapons\" using a for loop?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/file/Find]file.Find[/url] [editline]14th March 2015[/editline] Although for what you're doing I would use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/weapons/GetList]weapons.GetList[/url]
[QUOTE=mijyuoon;47320912]It's actually [code] util.CRC("gm_" .. ply:SteamID() .. "_gm") [/code][/QUOTE] that's the exact same thing, besides the fact that you aren't creating an function. edit: oops, im a retard, I just noticed I wrote a second util.CRC for the steamid, fixed :v:
[QUOTE=thefreeman193;47321014][IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/ents/GetAll"]ents.GetAll[/URL] [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Entity/IsWeapon"]Entity:IsWeapon[/URL] You'll need to check for weapon ownership too, or this will remove all weapons.[/QUOTE] Worked great! Thanks for the help. :) P.S. I wanted it to remove all weapons anyway so it was fine. [editline]14th March 2015[/editline] Another quick one: is there a way to disable the traitor menu being opened by traitors?
[IMG]http://i.imgur.com/loFXnmm.png[/IMG] How do I remove/edit these? (As in how do I remove/edit tool categories, not the UI itself)
Ive been trying to fix my darkrp server after the update (It broke a lot of my addons) and one error I keep getting is "SWEP:SetWeaponHoldType - ActIndex[ "" ] isn't set! (defaulting to normal)" when more than 1 person is on and all of the weapon's models disappear. Does anyone know what is going on?
Is it possible to choose what workshop addons are mounted based on gamemode for example? Don't really want TTT weapon packs erroring when I switch to PropHunt.
[QUOTE=MattJeanes;47322019]Is it possible to choose what workshop addons are mounted based on gamemode for example? Don't really want TTT weapon packs erroring when I switch to PropHunt.[/QUOTE] [url=http://wiki.garrysmod.com/page/steamworks/SetShouldMountAddon]This?[/url]
Cyrillic fonts are still not fixed?
[QUOTE=VIoxtar;47321895][IMG]http://i.imgur.com/loFXnmm.png[/IMG] How do I remove/edit these? (As in how do I remove/edit tool categories, not the UI itself)[/QUOTE] I've always found the best way to deal with the spawnmenu is to look at the source code and work it out from there. None of the official documentation really supports major modifications to it.
[QUOTE=G4MB!T;47322105][url=http://wiki.garrysmod.com/page/steamworks/SetShouldMountAddon]This?[/url][/QUOTE] That only works from menu state doesn't it? I'm thinking more dedicated server
Sorry, you need to Log In to post a reply to this thread.