- Initiateur de la discussion
Dynastix
Geek
- Messages
- 103
- Score réaction
- 2
- Points
- 55
[ERROR] lua/includes/modules/usermessage.lua:87: attempt to call field 'Function' (a nil value)
1. unknown - lua/includes/modules/usermessage.lua:87
1. unknown - lua/includes/modules/usermessage.lua:87
Code:
include('shared.lua')
if CLIENT then
local function HealNPCM()
local pmoney = LocalPlayer():getDarkRPVar("money")
local frame = vgui.Create( "DFrame" )
frame:AlphaTo(255, 4, 1)
frame:SetSize( 300, 320 )
frame:SetBackgroundBlur(50)
frame:Center()
frame:MakePopup()
frame:SetDraggable(false)
frame:ShowCloseButton(false)
frame:SetTitle("Vendeur d'objets - Page 1")
DermaImageButton2 = vgui.Create( "DImage", frame )
DermaImageButton2:SetPos( 180-48, 4 ) -- Set position
--DermaImageButton:SetSize( 16, 16 ) // OPTIONAL: Use instead of SizeToContents() if you know/want to fix the size
DermaImageButton2:SetImage( "icon16/script.png" ) -- Set the material - relative to /materials/ directory
DermaImageButton2:SizeToContents() -- OPTIONAL: Use instead of SetSize if you want to resize automatically ( without stretching )
local Close = vgui.Create("DButton", frame) Close:SetSize(40, 15) Close:SetPos(300-48, 8) Close:SetText("X") Close:SetTooltip("Fermer") Close:SetTextColor(Color(0,0,0,255)) Close.Paint = function(self,w,h) draw.RoundedBox(3, 0, 0, w, h, Color(230, 92, 78) ) end Close.DoClick = function() frame:Close() end Close.OnCursorEntered = function(self) surface.PlaySound("UI/buttonrollover.wav") self.hover = true end Close.OnCursorExited = function(self) self.hover = false end
local lbl3 = vgui.Create( "DLabel", frame )
lbl3:SetPos( 80, 200 )
lbl3:SetSize( 200, 200 )
lbl3:SetText( "Vous avez : €" .. pmoney )
lbl3:SetFont( "Trebuchet24" )
lbl3:SetWrap( true )
lbl3:SetParent(frame)
frame.Paint = function( self, w, h ) Derma_DrawBackgroundBlur(self,3,3) draw.RoundedBox( 5, 0, 0, w, h, Color( 0, 0, 0, 200 ) )
end
local DermaButton = vgui.Create( "DButton", frame ) -- Create the button and parent it to the frame
DermaButton:SetText( "Acheter une hache 200€" ) -- Set the text on the button
DermaButton:SetPos( 25, 50 ) -- Set the position on the frame
DermaButton:SetSize( 250, 30 )
DermaButton.Paint = function (btn) surface.SetDrawColor( 44, 62, 80 ) surface.DrawRect( 0, 0, DermaButton:GetWide(), DermaButton:GetTall() ) DermaButton:SetTextColor(Color(255,255,255)) DermaButton:SetIcon("icon16/star.png") end -- Set the size
DermaButton.DoClick = function() net.Start("fermier.hache") net.SendToServer() LocalPlayer():EmitSound("buttons/button24.wav")
end
local DermaButton2 = vgui.Create( "DButton", frame )
DermaButton2:SetText( "Acheter une pelle 200€" ) -- Set the text on the button
DermaButton2:SetPos( 25, 100 ) -- Set the position on the frame
DermaButton2:SetSize( 250, 30 ) -- Set the size
DermaButton2.DoClick = function() net.Start("pelle") net.SendToServer()
end
DermaButton2.Paint = function (btn) surface.SetDrawColor( 44, 62, 80 ) surface.DrawRect( 0, 0, DermaButton2:GetWide(), DermaButton2:GetTall() ) DermaButton2:SetTextColor(Color(255,255,255)) DermaButton2:SetIcon("icon16/star.png") end
local DermaButton3 = vgui.Create( "DButton", frame ) -- Create the button and parent it to the frame
DermaButton3:SetText( "Acheter une canne a peche 200€" ) -- Set the text on the button
DermaButton3:SetPos( 25, 150 ) -- Set the position on the frame
DermaButton3:SetSize( 250, 30 ) -- Set the size
DermaButton3.DoClick = function()
LocalPlayer():EmitSound("buttons/button24.wav") net.Start("poisson") net.SendToServer()
end
DermaButton3.Paint = function (btn) surface.SetDrawColor( 44, 62, 80 ) surface.DrawRect( 0, 0, DermaButton3:GetWide(), DermaButton3:GetTall() ) DermaButton3:SetTextColor(Color(255,255,255)) DermaButton3:SetImage("icon16/star.png") end
local DermaButton4 = vgui.Create( "DButton", frame ) -- Create the button and parent it to the frame
DermaButton4:SetText( "Acheter une pioche 200€" ) -- Set the text on the button
DermaButton4:SetPos( 25, 200 ) -- Set the position on the frame
DermaButton4:SetSize( 250, 30 ) -- Set the size
DermaButton4.DoClick = function() net.Start("mineur") net.SendToServer() LocalPlayer():EmitSound("buttons/button24.wav")
end
DermaButton4.Paint = function (btn) surface.SetDrawColor( 44, 62, 80 ) surface.DrawRect( 0, 0, DermaButton4:GetWide(), DermaButton4:GetTall() ) DermaButton4:SetTextColor(Color(255,255,255)) DermaButton4:SetIcon("icon16/star.png") end
local DermaButton5 = vgui.Create( "DButton", frame ) -- Create the button and parent it to the frame
DermaButton5:SetText( "Page suivante" ) -- Set the text on the button
DermaButton5:SetPos( 70, 250 ) -- Set the position on the frame
DermaButton5:SetSize( 150, 30 ) -- Set the size
DermaButton5.DoClick = function() frame:Close()
local frame2 = vgui.Create( "DFrame" )
frame2:SetSize( 300, 290 )
frame2:Center()
frame2:MakePopup()
frame2:SetDraggable(false)
frame2:ShowCloseButton(false)
local Close2 = vgui.Create("DButton", frame2) Close2:SetSize(40, 15) Close2:SetPos(300-48, 8) Close2:SetText("X") Close2:SetTooltip("Fermer") Close2:SetTextColor(Color(0,0,0,255)) Close2.Paint = function(self,w,h) draw.RoundedBox(3, 0, 0, w, h, Color(230, 92, 78) ) end Close2.DoClick = function() frame2:Close() end Close2.OnCursorEntered = function(self) surface.PlaySound("UI/buttonrollover.wav") self.hover = true end Close2.OnCursorExited = function(self) self.hover = false end end
local lbl = vgui.Create( "DLabel", frame2 )
lbl:SetPos( 80, 170 )
lbl:SetSize( 200, 200 )
lbl:SetText( "Vous avez : €" .. pmoney )
lbl:SetFont( "Trebuchet24" )
lbl:SetWrap( true )
lbl:SetParent(frame2)
frame2:SetTitle("Vendeur d'objets - Page 2")
frame2.Paint = function( self, w, h ) Derma_DrawBackgroundBlur(self,3,3) draw.RoundedBox( 5, 0, 0, w, h, Color( 0, 0, 0, 200 ) )
end
local Button1 = vgui.Create( "DButton", frame2 ) -- Create the button and parent it to the frame
Button1:SetText( "Acheter un lockpick 500€" ) -- Set the text on the button
Button1:SetPos( 25, 50 ) -- Set the position on the frame
Button1:SetSize( 250, 30 ) -- Set the size
Button1.DoClick = function() LocalPlayer():EmitSound("buttons/button24.wav") net.Start("lockpick") net.SendToServer()
end
Button1.Paint = function (btn) surface.SetDrawColor( 44, 62, 80 ) surface.DrawRect( 0, 0, Button1:GetWide(), Button1:GetTall() ) Button1:SetTextColor(Color(255,255,255))
Button1:SetIcon("icon16/star.png") end
local Button2 = vgui.Create( "DButton", frame2 ) -- Create the button and parent it to the frame
Button2:SetText( "Acheter de l'armure" ) -- Set the text on the button
Button2:SetPos( 25, 100 ) -- Set the position on the frame
Button2:SetSize( 250, 30 )
Button2.Paint = function (btn) surface.SetDrawColor( 44, 62, 80 ) surface.DrawRect( 0, 0, Button2:GetWide(), Button2:GetTall() ) Button2:SetTextColor(Color(255,255,255)) Button2:SetIcon("icon16/star.png") end -- Set the size
Button2.DoClick = function() net.Start("armor") net.SendToServer()
LocalPlayer():EmitSound("buttons/button24.wav")
end
end
DermaImageButton = vgui.Create( "DImage", frame2 )
DermaImageButton:SetPos( 180-48, 4 ) -- Set position
--DermaImageButton:SetSize( 16, 16 ) // OPTIONAL: Use instead of SizeToContents() if you know/want to fix the size
DermaImageButton:SetImage( "icon16/script.png" ) -- Set the material - relative to /materials/ directory
DermaImageButton:SizeToContents()
end
usermessage.Hook("fermier",HealNPCM)
surface.CreateFont( "Large", { font = "Trebuchet24", size = 30, weight = 300, antialias = true,
} )
SNPC = SNPC or {}
function SNPC.DrawText() for _, ent in pairs (ents.FindByClass("vendeurdivers")) do if ent:GetPos():Distance(LocalPlayer():GetPos()) < 500 then local Ang = LocalPlayer():GetAngles() Ang:RotateAroundAxis( Ang:Forward(), 90) Ang:RotateAroundAxis( Ang:Right(), -90) Ang:RotateAroundAxis( Ang:Right(), -180) cam.Start3D2D(ent:GetPos()+ent:GetUp()*80, Ang, 0.20) draw.SimpleTextOutlined( "Vendeur d'objets", "Large", 0, 0, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0, 0, 0, 255)) cam.End3D2D() end
end
hook.Add("PostDrawOpaqueRenderables", "NPC_TEXT", SNPC.DrawText)
end