gmod racer gamemode use info_scoreboard_face and ent_scoreboard to display some information ingame
how to use that way to display information in another gamemode?
anyone know about that?
give me some information or code please
gmod racer gamemode use info_scoreboard_face and ent_scoreboard to display some information ingame
how to use that way to display information in another gamemode?
anyone know about that?
give me some information or code please
Not sure if this is what you’re asking, but if you want a GUI scoreboard like that used in GMRacer, then here is something I wrote up for a gamemode of my own (Deathrace).
This is a shared entity. It’s made and placed serverside.
Clientside:
[lua]include(“shared.lua”)
function ENT:Initialize()
self.DrawAngle = Angle(0,0,90)
self.Scale = 0.5
self.Wide = 256
self.Tall = 128
self.SizeMult = 1 / self.Scale
end
function ENT:Draw()
self.Entity:DrawModel()
if not ScoreboardEnts then ScoreboardEnts = {} end
if not table.HasValue(ScoreboardEnts,self) then
table.insert(ScoreboardEnts,self)
end
if self:GetNWFloat("DrawAngle",0) ~= self.DrawAngle.y then
self.DrawAngle.y = self:GetNWFloat("DrawAngle",0)
end
if self:GetNWFloat("Wide",self.Wide) ~= self.Wide then
self.Wide = self:GetNWFloat("Wide",self.Wide)
end
if self:GetNWFloat("Tall",self.Tall) ~= self.Tall then
self.Wide = self:GetNWFloat("Tall",self.Tall)
end
if self:GetNWFloat("TextSize",self.Scale) ~= self.Scale then
self.Scale = self:GetNWFloat("TextSize",self.Scale)
self.SizeMult = 1 / self.Scale
end
if not self.SizeCorrect then
self.SizeCorrect = true
self.Wide = self.Wide * self.SizeMult
self.Tall = self.Tall * self.SizeMult
end
cam.Start3D2D( self.Entity:GetPos(),self.DrawAngle, self.Scale )
DrawItems(self)
cam.End3D2D()
cam.Start3D2D( self.Entity:GetPos(),self.DrawAngle + Angle(0,180,0), self.Scale )
DrawItems(self)
cam.End3D2D()
end
function DrawItems(self)
–[[
State description:
0 - Showing people that are queued for the race
]]
local zerox = -(self.Wide/2)
local zeroy = -(self.Tall/2)
if not self.DrawState then self.DrawState = 0 end
draw.RoundedBox(0,-(self.Wide/2),-(self.Tall/2),self.Wide,self.Tall,Color(255,255,255,255))
surface.SetDrawColor(0,0,0,255)
surface.DrawOutlinedRect(-(self.Wide/2),-(self.Tall/2),self.Wide,self.Tall)
draw.DrawText("DEATHRACE","LCD_HUGE",0,zeroy,Color(255,0,0,255),1,1)
draw.DrawText("By Gmod4ever","DefaultSmall",0,zeroy + FontHeight("LCD_HUGE"),Color(0,255,255,255),1,1)
draw.RoundedBox(0,zerox,zeroy + FontHeight("LCD_HUGE") + FontHeight("DefaultSmall"),self.Wide,2,Color(0,0,0,255))
local starty = zeroy + FontHeight("LCD_HUGE") + FontHeight("DefaultSmall") + 4
local cury = starty
if self.DrawState == 0 then
if not SB_NextRace then SB_NextRace = 0 end
local rem = SB_NextRace - CurTime()
local str = "QUEUED RACERS"
if rem > 0 then
str = str.." - Race begins in: "..string.ToMinutesSecondsMilliseconds(rem)
end
draw.DrawText(str,"LCD_LARGE",0,starty,Color(0,0,0,255),1,1)
cury = starty + FontHeight("LCD_LARGE")
local curx = zerox
if not _QueuedRacers then _QueuedRacers = {} end
local c = 0
for k,v in pairs(_QueuedRacers) do
c = c + 1
local str = c..".) "..v:Nick()
draw.DrawText(str,"ScoreboardText",curx,cury,Color(0,0,0,255))
cury = cury + FontHeight("ScoreboardText")
if cury >= (self.Tall - 16) then
cury = starty + FontHeight("LCD_LARGE")
curx = 0
end
end
end
end[/lua]
Serverside:
[lua]AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include(“shared.lua”)
function ENT:Initialize()
self.Entity:SetModel(“models/items/healthkit.mdl”)
self.Entity:PhysicsInit( SOLID_NONE )
self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_NONE )
self.Entity:SetColor(255,255,255,1)
–self:SetNoDraw(true)
–self:DrawShadow(false)
self:SetCollisionGroup(COLLISION_GROUP_WORLD)
–self:SetTrigger(true)
end
function ENT:KeyValue(key,value)
self:SetNWFloat(key,tonumber(value))
end[/lua]
Change shit around as you need. I hope you can figure out what goes where. It’s been so long I can’t remember how you use it, off the top of my head.