1. Post #6401
    Gold Member
    hemirox's Avatar
    April 2011
    41 Posts
    Does anyone know the formula for converting SteamID64 to SteamID (STEAM_0:0:X:XXXXX). I thought it was like this:

    Code:
    function ConvertSteamId(id)
        local a = id - 76561197960265728
        local b = a / 2
        local d = a % 2 == 0 and 0 or 1
        
        return "STEAM_0:" .. d .. ":" .. math.floor(b)
    end
    But it's not working for all of them.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  2. Post #6402
    Gold Member
    ShoTGuNGuY49's Avatar
    July 2008
    4,298 Posts
    Do you mean something like "<a href="http://imgur.com/XXXXXXX"><img src="http://i.imgur.com/XXXXXXX.png" alt="" title="Hosted by imgur.com" /></a>"?

    Then yeah. Do I replace the direct link in sv_downloadurl "[direct link]" with the HTML code?
    Try using the page source from this site.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 1 (list)

  3. Post #6403

    February 2009
    381 Posts
    Does anyone know the formula for converting SteamID64 to SteamID (STEAM_0:0:X:XXXXX). I thought it was like this:

    Code:
    function ConvertSteamId(id)
        local a = id - 76561197960265728
        local b = a / 2
        local d = a % 2 == 0 and 0 or 1
        
        return "STEAM_0:" .. d .. ":" .. math.floor(b)
    end
    But it's not working for all of them.
    https://developer.valvesoftware.com/...m_Community_ID
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  4. Post #6404

    February 2012
    11 Posts
    What control do you want to disable?
    OK, so right now I have a combo box with "YES" and "NO" in them. If the user selects "YES", then two of the combo boxes above the "YES" and "NO" combo box will be disabled. If the user selects "NO", it will re-enable them. At least that's what I want it to happen.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  5. Post #6405
    Gold Member
    hemirox's Avatar
    April 2011
    41 Posts
    Got it, I was trying to use integers and lua doesn't support 64-bit ints. Converted to string, and removed the first 7 numbers (as it's always the same), now it works perfectly.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  6. Post #6406

    May 2007
    24 Posts
    I'm using DarkRP and trying to make an entity only available to a certain ulx group. Here is what I'm working with;
    return ply:GetUserGroup() == "vip" || ply:IsAdmin()
    end
    I've also tried;
    customCheck = function(ply)return ply:IsUserGroup("vip")
    end

    This gives no shoutouts in the console, yet it is still available to all players.

    I'm putting it at the bottom of the entity settings in addentities.lua

    Any help is much appreciated!
    Reply With Quote Edit / Delete Windows 7 United States Show Events Dumb Dumb x 1 (list)

  7. Post #6407
    Maddog2k62k7's Avatar
    July 2009
    34 Posts
    Debug'z/optimize the code. Lots and lots of optimize.
    The code will force a xml fetch from steam each time someone joins the server. It will basic lag.

    Now this isn't the most optimized .. but I don't feel like writing 50-100 lines:
    Data = ""
    http.Fetch("http://steamcommunity.com/gid/<GroupID>/memberslistxml/?xml=1", function(result, size, headers,httpcode) --Alternatively, use "http://steamcommunity.com/groups/<GroupName>/memberslistxml/?xml=1"
            if size > 0 and httpcode!=200 then //Steam seems to return http 200 each time
    			Data = result 
    			print("Fetched data from steam.")
            else
    			print("Error. Wasn't able to fetch the data from steam. HTTP: "..httpcode)
    			if httpcode==203 then print("Steam have blocked this information.\nYou can try get a steamspi key to fix it, this script dosen't work anymore.") end
    			if httpcode==403 then print("Steam have forbitten this xml.\nYou can try get a steamapi key to fix it, this script don't work anymore.") end
    			if httpcode==418 then print("I'm a Teapot!\nLol .. steam is playing funny today.") end
    		end
        end)
    
    hook.Add("PlayerAuthed", "checkgroup", function(ply)
        local id = ply:SteamID64()
        for w in string.gmatch(Data, "<steamID64>(%d+)</steamID64>") do
            if w == id then
                ULib.ucl.addUser( ply:SteamID(), {}, {}, "vip" )
            end
        end
    end)
    I tried this, to no avail! :<
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  8. Post #6408

    June 2010
    20 Posts
    I have a quick question someone might be able to answer. I recently coded a hud for a DarkRP server (yes its darkrp, but this should be relevant to most game modes), and the hud works fine when I am testing it on a local server, and it works for the most part on the server I have installed it to. However, the custom don't seem to want to show up on the server. I have declared the fonts correctly in the code (otherwise they wouldn't show up locally) and I have put the ttf files in both the fonts folder I made for the game mode and in the fonts folder for gmod.

    Is there anything I need to do server side to make it distribute the fonts out to the clients that connect to the server? Here is a picture of the hud in question ( on the client side; the server side just has the coolvetica as it is the default): http://cloud-2.steampowered.com/ugc/...E934C142256C4/
    Reply With Quote Edit / Delete Windows 7 United States Show Events Dumb Dumb x 1 (list)

  9. Post #6409
    L33T Lau Coder
    Science's Avatar
    April 2011
    1,778 Posts
    Another tip:

    Weapon:GetPrintName() not Weapon:GetClass()
    Reply With Quote Edit / Delete United Kingdom Show Events

  10. Post #6410

    June 2010
    20 Posts
    Another tip:

    Weapon:GetPrintName() not Weapon:GetClass()
    Yeah I haven't gotten around to fixing that yet. Wanted to get the fonts working correctly first. Still works in the meantime. :D

    No idea how to fix the font problem though?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  11. Post #6411
    Luni's Avatar
    July 2012
    164 Posts
    I have a quick question someone might be able to answer. I recently coded a hud for a DarkRP server (yes its darkrp, but this should be relevant to most game modes), and the hud works fine when I am testing it on a local server, and it works for the most part on the server I have installed it to. However, the custom don't seem to want to show up on the server. I have declared the fonts correctly in the code (otherwise they wouldn't show up locally) and I have put the ttf files in both the fonts folder I made for the game mode and in the fonts folder for gmod.

    Is there anything I need to do server side to make it distribute the fonts out to the clients that connect to the server? Here is a picture of the hud in question ( on the client side; the server side just has the coolvetica as it is the default): http://cloud-2.steampowered.com/ugc/...E934C142256C4/
    If the green "current weapon" bar isn't meant for the ammo counter I'll be disappointed

    Make sure you've
    1) copied the truetype files to the server's resource/fonts/
    2) added them with resource.AddFile() serverside

    It probably works fine for you because you have the fonts in your own Garry's Mod install but the script isn't telling anyone else to download them
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua Helper Lua Helper x 1 (list)

  12. Post #6412
    buu342's Avatar
    March 2010
    192 Posts
    Hello. I was trying to get a autorun script to work. Basically it checks if a ragdoll has been damaged, and if so, create an emitter blood effect. The problem is that it gives me an error related to the DamageInfo, and i cant figure out what is wrong.

    Code:
    local NPCsHitEffects = {
    	["npc_citizen"] = "bloodimpact",
    	["npc_combine"] = "bloodimpact",
    	["npc_antlion"] = "AntlionGib",
    	["npc_crow"] = "Sparks",
    	Default = "bloodimpact",
    }
    
    function RagdollEffect( Entity, Inflictor, Attacker, Amount, DamageInfo)
    	if (!string.find(Entity:GetClass(), "npc_") && !Entity:IsNPC() ) then return false; end
    	local Effect = EffectData()  
    	local Origin = DamageInfo:GetDamagePosition()
    	Effect:SetOrigin( Origin )
    	Effect:SetScale( 1 )
    	if (NPCsHitEffects[Entity:GetClass()]) then
    		util.Effect( NPCsHitEffects[Entity:GetClass()], Effect )
    	else
    		util.Effect( NPCsHitEffects.Default, Effect )
    	end
    end
    
    hook.Add("EntityTakeDamage", "Ragdoll Effect", RagdollEffect)
    Thanks!
    Reply With Quote Edit / Delete Windows 7 Portugal Show Events

  13. Post #6413
    Gold Member
    jmazouri's Avatar
    May 2005
    1,424 Posts
    Can anyone help me out with some custom vgui painting? I'm trying to override the paint function on a DFrame in order to give it a background image, but the background image only draws when certain other ui elements are present - tips, the main menu, etc. Otherwise, the DFrame is transparent. Here's the pertinent code:

    MainPanel = vgui.Create("DFrame") -- Create the frame
     
    		MainPanel:SetPos(ScrW() / 2 - 512, ScrH() / 2 - 310) -- set the frame's position on the screen
    
    		MainPanel:SetSize(1024, 620) -- set the frame size
    		MainPanel:SetTitle( "" ) -- set the frame title
    
    		MainPanel.Paint = function()
    			
    			surface.DrawTexturedRect(0,20,1024,600)
    
    		end
    
    		MainPanel:SetVisible( true ) -- Make the frame visible
    		MainPanel:MakePopup() -- make the frame popup
    
    Reply With Quote Edit / Delete Windows 8 United States Show Events