Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name rp_chat_log
- @inputs Egp:wirelink User:entity
- @outputs Scroll Con Draw Linebreaks
- @persist [Log Names Ents Times]:array
- @trigger User
- if(first()|dupefinished()|duped()){
- runOnChat(1)
- function number egpClick(Ply:entity,ID){
- return inrange(Egp:egpCursor(Ply),Egp:egpPos(ID)-(Egp:egpSize(ID)/2),Egp:egpPos(ID)+(Egp:egpSize(ID)/2))
- }
- }
- if(changed(Egp:entity())&Egp:entity()){
- Egp:egpClear()
- }
- if(~User&User){
- if(egpClick(User,81)){
- Scroll++,Draw=1,Con=1
- }elseif(egpClick(User,83)){
- if(Scroll>=1){
- Scroll--,Draw=1,Con=1
- if(Scroll==0){
- Egp:egpRemove(82)
- Egp:egpRemove(83)
- }
- }
- }
- }
- if(chatClk()){
- local Ply = lastSpoke()
- Log:insertString(1,Ply:lastSaid())
- Names:insertString(1,Ply:name())
- Times:insertNumber(1,curtime())
- Ents:insertEntity(1,Ply)
- if(!Scroll){Draw=1,Con=1}
- }
- if(Draw){
- for(A=Con,clamp(34,1,Log:count())){
- if( maxquota()-opcounter() < 50 ){
- Con=A
- interval(50)
- exit()
- }
- B = A+Scroll
- if(Names:exists(B)){
- local Sec=int(curtime()-Times[B,number])
- local Min=int(Sec/60)
- local TIME = Min+"m "+(Sec-Min*60)+"s ago "
- local Length = Names[B,string]:length()
- if(A>=29){
- Egp:egpBox(A+34,vec2(204,(Linebreaks+A)*15-3.75),vec2(408,15))
- Egp:egpTextLayout(A,TIME+Names[B,string]+": "+Log[B,string]:left(30)+"...",vec2(1,(Linebreaks+A)*15-15),vec2(512,40)),Egp:egpFont(A,"Times New Roman")
- }else{
- Egp:egpBox(A+34,vec2(256,(Linebreaks+A)*15-3.75),vec2(512,15))
- Egp:egpTextLayout(A,TIME+Names[B,string]+": "+Log[B,string],vec2(1,(Linebreaks+A)*15-15),vec2(512,40)),Egp:egpFont(A,"Times New Roman")
- }
- Egp:egpColor(A+34,teamColor(Ents[B,entity]:team())/2)
- Linebreaks+=int(Log[B,string]:length()/33)
- }else{
- Egp:egpRemove(A),Egp:egpRemove(A+34)
- }
- }
- if(Scroll){
- Egp:egpRoundedBox(82,vec2(490,450),vec2(50,50)),Egp:egpColor(82,vec(0,30,150))
- Egp:egpBox(83,vec2(490,452),vec2(50,50)),Egp:egpAngle(83,-90),Egp:egpMaterial(83,"gui/HTML/back")
- Egp:egpText(84,"Scroll",vec2(424,485)),Egp:egpColor(84,vec(0,200,0))
- Egp:egpRoundedBox(80,vec2(470,495),vec2(100,50)),Egp:egpColor(80,vec(0,30,150))
- Egp:egpBox(81,vec2(490,492),vec2(50,50)),Egp:egpAngle(81,90)
- Egp:egpMaterial(81,"gui/HTML/back")
- }else{
- Egp:egpRoundedBox(80,vec2(470,495),vec2(100,50)),Egp:egpColor(80,vec(0,30,150))
- Egp:egpBox(81,vec2(490,492),vec2(50,50)),Egp:egpAngle(81,90),Egp:egpMaterial(81,"gui/HTML/back")
- Egp:egpText(84,"Live",vec2(424,485)),Egp:egpColor(84,vec(255,0,0))
- }
- Linebreaks=0
- Draw=0,Con=0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement