All pastes #191176 Raw Edit

Mine

public text v1 · immutable
·published 2006-10-04 18:57 UTC
rendered paste body
-- Framework for custom HUD chat drawing.
-- By teh catdaemonz0rs
-- Call this like so:
-- chat_send(red value,green value,blue value,text as string,userid(do not spesify to send to all))
-- K, you may begin.


ctext={}
ctext.red={}
ctext.green={}
ctext.blue={}
ctext.text={}
ctext.user={}
CHAT_X=0.02 -- This is the x position for the chat box
CHAT_Y=0.1 -- This is the Y position of the chat box
CHAT_WIDTH=0.5 -- This is the width of the chat box, and it is added to the CHAT_X variable.
CHAT_HEIGHT=0 -- This is the height of the chat box, and it is added to the CHAT_Y variable.

for i=1,255 do
ctext[i]={}
ctext[i].red=0
ctext[i].green=0
ctext[i].blue=0
ctext[i].text="x"
ctext[i].user=nil
end

function eventPlayerSay(userid,strText,bTeam)
chat_send(0,255,0,strText)
return false
end

function chat_send(red,green,blue,xtext,userid)
	local i=255
	while i>2 do
	local f=i-1
	ctext[i].text=ctext[f].text
	ctext[i].red=ctext[f].red
	ctext[i].green=ctext[f].green
	ctext[i].blue=ctext[f].blue
	ctext[i].user=ctext[f].user
	i=i-1
	end
	
	ctext[1].text=xtext
	ctext[1].red=red
	ctext[1].green=green
	ctext[1].blue=blue
	ctext[1].user=userid
	
	chat_redrawhud()
end

function chat_redrawhud()
	for i=1, _MaxPlayers() do
	
	 _GModRect_Start("vgui/hud/icon_commentary")
	 _GModRect_SetColor(0,0,0,100)
	 _GModRect_SetPos(CHAT_X,CHAT_Y,0.1,0.1)
	 _GModRect_SetTime(9999,0,0)
	 _GModRect_Send(i, 740)
	 
	 	local numdrawn=0

		local t=255
	 while t>2 do
		t=t-1
		  if ctext[t].user==i or ctext[t].user==nil then
		   if numdrawn~=5 then
		 _GModText_Start("ChatFont")
		 _GModText_SetColor(ctext[t].red,ctext[t].green,ctext[t].blue,255)
		 _GModText_SetTime(5,0,5)
		 _GModText_SetText(ctext[t].text)
		 _GModText_SetPos(CHAT_X,CHAT_Y+numdrawn/40)
		 _GModText_Send(i,741+numdrawn)
		 numdrawn=numdrawn+1
		  end
		   else
		   break
	 	   end
	 end
	end
end