how to create a hud agenda ?

Hello,
I wanted to know how to create a agenda hud, in short display the text of the agenda, if a person could give me the code, thanks in advance.

GM:HUDPaint

draw.SimpleText

thanks, I know how to make a box but I do not know how to display the text of the agenda, if you could give me the code

I have no clue what you mean by agenda. Which addon or gamemode is this for? All I can say at the moment is that

draw.SimpleText can draw whatever text you want.

Assuming he means DarkRP ply:getAgendaTable()

an agenda like the one for the police, the mafia ect
https://s3.scriptfodder.com/script_media/39d7b9b954bdfe09a631efa566f6025a.png
look the police agenda

[editline]22nd September 2017[/editline]

yes in darkrp

[editline]22nd September 2017[/editline]

its me mark an error how to display the text of the agenda? :
[lua]
local agenda = LocalPlayer:getAgenda()
draw.SimpleText(agenda, “Default”, 160, ScrH() -158, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER )[/lua]

This is the whole agenda code for DarkRP that is relevant to this topic. I would recommend you use some of it. I wouldn’t use all of it though.

[lua]local agendaText
local function DrawAgenda()

local agenda = LocalPlayer():getAgendaTable()
if not agenda then return end

agendaText = agendaText or DarkRP.textWrap( ( LocalPlayer():getDarkRPVar( "agenda" ) or "" ):gsub( "//", "

" ):gsub( "
", "
" ), “valfunde_hud_26”, 440 )

draw.RoundedBox( 0, 10, 10, 465, 115, Color(0, 0, 0, 190))
draw.RoundedBox(0, 14, 44, 457, 77, Color(0, 0, 0, 150))
draw.RoundedBox( 0, 10, 10, 465, 30, Color(0, 0, 0, 205))

draw.DrawText( agenda.Title, "valfunde_hud_24", 240, 15, Color( 225, 225, 225, 255 ), 1 )
draw.DrawText( agendaText, "valfunde_hud_24", 20, 44, Color( 225, 225, 225, 255 ) )

end
hook.Add( “HUDPaint”, “DrawAgenda”, DrawAgenda )

hook.Add( “DarkRPVarChanged”, “AgendaUpdate”, function( ply, var, _, new )

if ply != LocalPlayer() then return end

if var == "agenda" and new then

	agendaText = DarkRP.textWrap( new:gsub( "//", "

" ):gsub( "
", "
" ), “valfunde_hud_26”, 440 )
else

	agendaText = nil

end[/lua]

eror
[lua]
[ERROR] addons/bunkero/lua/autorun/hud_replacement.lua:80: ‘}’ expected (to close ‘{’ at line 62) near ‘=’

  1. unknown - addons/bunkero/lua/autorun/hud_replacement.lua:0
    [/lua]

That error is not relevant to what the code you have supplied us.

You need to add an


end

after


	if var == "agenda" and new then

		agendaText = DarkRP.textWrap( new:gsub( "//", "
" ):gsub( "\
", "
" ), "valfunde_hud_26", 440 )
	else

		agendaText = nil

And you need to add a


)

where you end the hook.

EDIT: As Txike said as well, that error that you got earlier will still happen, but this fixes errors that will happen after the original one is fixed.

Though that would error, it is not related to the error we were supplied.

Thank’s

You were already told how to fix it. Stop expecting us to spoonfeed you.

I still have eror, full code :
[lua]include(“config_replacement.lua”)
resource.AddFile( “material/bunkero/phona_tout.png” )
local icone = false
local b_base = Material( “material/bunkero/phona_tout.png” ) – Calling Material() every frame is quite expensive

---------------------------------------police------------------------------------------------------

--------------------------------------------------vie-----------------------------------------------------------------------------
hook.Add( “HUDPaint”, “HUDHealth”, function()
– Background
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial(b_base) – If you use Material, cache it!
surface.DrawTexturedRect( 0, 634, 260, 440 )

-- Foreground
local health = LocalPlayer():Health() or 0
if health < 0 then health = 0 elseif health > 100 then health = 100 end
draw.RoundedBox( 0, 69, ScrH() -164, health *2 -72, 13, Color(192, 57, 43, 255)) -- box de vie

local agendaText
local function DrawAgenda()

local agenda = LocalPlayer():getAgendaTable()
if not agenda then return end

agendaText = agendaText or DarkRP.textWrap( ( LocalPlayer():getDarkRPVar( "agenda" ) or "" ):gsub( "//", "

" ):gsub( "
", "
" ), “valfunde_hud_26”, 440 )

draw.RoundedBox( 0, 10, 10, 465, 115, Color(0, 0, 0, 190))
draw.RoundedBox(0, 14, 44, 457, 77, Color(0, 0, 0, 150))
draw.RoundedBox( 0, 10, 10, 465, 30, Color(0, 0, 0, 205))

draw.DrawText( agenda.Title, "valfunde_hud_24", 240, 15, Color( 225, 225, 225, 255 ), 1 )
draw.DrawText( agendaText, "valfunde_hud_24", 20, 44, Color( 225, 225, 225, 255 ) )

end
hook.Add( “HUDPaint”, “DrawAgenda”, DrawAgenda )

hook.Add( “DarkRPVarChanged”, “AgendaUpdate”, function( ply, var, _, new )

if ply != LocalPlayer() then return end

if var == "agenda" and new then

	agendaText = DarkRP.textWrap( new:gsub( "//", "

" ):gsub( "
", "
" ), “valfunde_hud_26”, 440 )
else

	agendaText = nil

end)

end )----------------------------------------Désactiver les hud de base----------------------------------------------------------------------
------------------------------Darkrp
local hideHUDElements = {
– if you DarkRP_HUD this to true, ALL of DarkRP’s HUD will be disabled. That is the health bar and stuff,
– but also the agenda, the voice chat icons, lockdown text, player arrested text and the names above players’ heads
[“DarkRP_HUD”] = false,

-- DarkRP_EntityDisplay is the text that is drawn above a player when you look at them.
-- This also draws the information on doors and vehicles
["DarkRP_EntityDisplay"] = false,

-- DarkRP_ZombieInfo draws information about zombies for admins who use /showzombie.
["DarkRP_ZombieInfo"] = false,

-- This is the one you're most likely to replace first
-- DarkRP_LocalPlayerHUD is the default HUD you see on the bottom left of the screen
-- It shows your health, job, salary and wallet
["DarkRP_LocalPlayerHUD"] = true,S

-- Drawing the DarkRP agenda
["DarkRP_Agenda"] = true

}

– this is the code that actually disables the drawing.
hook.Add(“HUDShouldDraw”, “HideDefaultDarkRPHud”, function(name)
if hideHUDElements[name] then return false end
end)
-------------------------------------- Sandbox
hook.Add( “HUDShouldDraw”, “DefautHUD”, function( name ) if ( name == “CHudHealth” or name == “CHudBattery” ) then return false end
end )
------------------------------------- Créateur text, s’il vous plait ne pas suprimer et ne pas modifier----------------------------------------------
print(“L’hud de se serveur est : Bunkera HUD”)
print(“Par: Séméron”)[/lua]

the eror
[lua]
[ERROR] addons/bunkero/lua/autorun/hud_replacement.lua:76: ‘}’ expected (to close ‘{’ at line 58) near ‘=’

  1. unknown - addons/bunkero/lua/autorun/hud_replacement.lua:0
    [/lua]

?! It literally says the EXACT thing wrong in your code. Just fix it…

edit: holy shit did you actually take a huge piece of code from DarkRP github and paste it into your addon? Why?

how to do?

Get rid of the trailing “S” at


["DarkRP_LocalPlayerHUD"] = true,S

and you never added the ‘end’ after the if statement I told you to in the above post.

Also please learn lua by going to https://www.lua.org/pil/1.html then learn Garry’s Mod specific hooks and functions at the Garry’s Mod Wiki

it is an error to copy paste, error is still there
[lua]include(“config_replacement.lua”)
resource.AddFile( “material/bunkero/phona_tout.png” )
local icone = false
local b_base = Material( “material/bunkero/phona_tout.png” ) – Calling Material() every frame is quite expensive

---------------------------------------police------------------------------------------------------

--------------------------------------------------vie-----------------------------------------------------------------------------
hook.Add( “HUDPaint”, “HUDHealth”, function()
– Background
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial(b_base) – If you use Material, cache it!
surface.DrawTexturedRect( 0, 634, 260, 440 )

-- Foreground
local health = LocalPlayer():Health() or 0
if health < 0 then health = 0 elseif health > 100 then health = 100 end
draw.RoundedBox( 0, 69, ScrH() -164, health *2 -72, 13, Color(192, 57, 43, 255)) -- box de vie

local agendaText
local function DrawAgenda()

local agenda = LocalPlayer():getAgendaTable()
if not agenda then return end

agendaText = agendaText or DarkRP.textWrap( ( LocalPlayer():getDarkRPVar( "agenda" ) or "" ):gsub( "//", "

" ):gsub( "
", "
" ), “valfunde_hud_26”, 440 )

draw.RoundedBox( 0, 10, 10, 465, 115, Color(0, 0, 0, 190))
draw.RoundedBox(0, 14, 44, 457, 77, Color(0, 0, 0, 150))
draw.RoundedBox( 0, 10, 10, 465, 30, Color(0, 0, 0, 205))

draw.DrawText( agenda.Title, "valfunde_hud_24", 240, 15, Color( 225, 225, 225, 255 ), 1 )
draw.DrawText( agendaText, "valfunde_hud_24", 20, 44, Color( 225, 225, 225, 255 ) )

end
hook.Add( “HUDPaint”, “DrawAgenda”, DrawAgenda )

hook.Add( “DarkRPVarChanged”, “AgendaUpdate”, function( ply, var, _, new )

if ply != LocalPlayer() then return end

if var == "agenda" and new then

	agendaText = DarkRP.textWrap( new:gsub( "//", "

" ):gsub( "
", "
" ), “valfunde_hud_26”, 440 )
else

	agendaText = nil

end)

end )----------------------------------------Désactiver les hud de base----------------------------------------------------------------------
------------------------------Darkrp
local hideHUDElements = {
– if you DarkRP_HUD this to true, ALL of DarkRP’s HUD will be disabled. That is the health bar and stuff,
– but also the agenda, the voice chat icons, lockdown text, player arrested text and the names above players’ heads
[“DarkRP_HUD”] = false,

-- DarkRP_EntityDisplay is the text that is drawn above a player when you look at them.
-- This also draws the information on doors and vehicles
["DarkRP_EntityDisplay"] = false,

-- DarkRP_ZombieInfo draws information about zombies for admins who use /showzombie.
["DarkRP_ZombieInfo"] = false,

-- This is the one you're most likely to replace first
-- DarkRP_LocalPlayerHUD is the default HUD you see on the bottom left of the screen
-- It shows your health, job, salary and wallet
["DarkRP_LocalPlayerHUD"] = true

-- Drawing the DarkRP agenda
["DarkRP_Agenda"] = true

}

– this is the code that actually disables the drawing.
hook.Add(“HUDShouldDraw”, “HideDefaultDarkRPHud”, function(name)
if hideHUDElements[name] then return false end
end)
-------------------------------------- Sandbox
hook.Add( “HUDShouldDraw”, “DefautHUD”, function( name ) if ( name == “CHudHealth” or name == “CHudBattery” ) then return false end
end )
------------------------------------- Créateur text, s’il vous plait ne pas suprimer et ne pas modifier----------------------------------------------
print(“L’hud de se serveur est : Bunkera HUD”)
print(“Par: Séméron”) [/lua]

… I’m truly amazed. This will be the third time I’m saying this. YOU NEED AN END TO THE IF STATEMENT!!! I have no idea how I can possibly rephrase this.

could you give me the correct code then? thank’s