-- TJG_PlayerBounties by ThatJoshGuy a.k.a. TJGMan ModulesLoad = function() Events:Fire( "HelpAddItem", { name = "Bounties", text = "Player Bounties allow you to set rewards for you enemies.\n \n" .. "When someone kills one of your bonties, they get the reward!\n \n" .. "Type /setbounty (reward) (name) to set the bounty.\n \n" .. "The reward is deducted form your money immediately.\n \n" .. "Type /delbounty (name) to cancel the bounty and get your money back.\n \n" .. "You can set multiple bounties, and you can have several bounties on your head!\n \n".. "Bounties are persistant, but a player must be online to set a bounty on them." } ) end ModuleUnload = function() Events:Fire( "HelpRemoveItem", { name = "Bounties" } ) end function DrawShadowedText( pos, text, colour, size, scale ) if scale == nil then scale = 1.0 end if size == nil then size = TextSize.Default end local shadow_colour = Color( 0, 0, 0, colour.a ) shadow_colour = shadow_colour * 0.4 Render:DrawText( pos + Vector3( 1, 1, 0 ), text, shadow_colour, size, scale ) Render:DrawText( pos, text, colour, size, scale ) end function DrawTag( playerPos, dist , text) local pos = playerPos + Vector3( 0, 2, 0 ) local angle = Angle( Camera:GetAngle().yaw, 0, math.pi ) * Angle( math.pi, 0, 0 ) local text_size = Render:GetTextSize( text, TextSize.Default ) local t = Transform3() t:Translate( pos ) t:Scale( 0.007 ) t:Rotate( angle ) t:Translate( -Vector3( text_size.x, text_size.y, 0 )/2 ) Render:SetTransform( t ) local alpha_factor = 255 --if dist <= 1024 then -- alpha_factor = ((math.clamp( dist, 512, 1024 ) - 512)/512) * 255 --elseif dist >= 3072 then -- alpha_factor = (1 - (math.clamp( dist, 3072, 3584 ) - 512)/512) * 255 --end DrawShadowedText( Vector3( 0, 0, 0 ), text, Color( 0, 255, 0, alpha_factor ), TextSize.Default ) end function RenderTag() if Game:GetState() ~= GUIState.Game then return end if LocalPlayer:GetWorld() ~= DefaultWorld then return end local qry = SQL:Query( "select target,sum(bounty) as totalbounty from playerBounties group by target") local result = qry:Execute() if #result > 0 then for row in pairs(result) do if result[row] ~= nil then local playerPos = result[row].target:GetPosition() if playerPos ~= nil then local dist = playerPos:Distance2D( Camera:GetPosition() ) if dist < 1000 then DrawPassiveTag( playerPos, dist , "" .. result[row].totalbounty) end end end end end end Events:Subscribe( "Render", RenderTag) Events:Subscribe( "ModuleLoad", ModulesLoad ) Events:Subscribe( "ModulesLoad", ModulesLoad ) Events:Subscribe( "ModuleUnload", ModuleUnload )