Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Magus Scorebord Example
- @inputs S:wirelink
- @outputs PlayerStatus ServerStatus
- @persist ServerName:string Players:array
- @persist Time Interval SBC:vector
- @trigger
- # Scorebord with Server and Player Status
- # Expression 2 Chip by Magus / Lodkagan
- # Config
- Time = 15000 # Time to switch between Player and Server Status. (in milliseconds)
- Interval = 500 # How fast should this chip run? (lower is faster, Default = 500)
- SBC = vec(255,0,0) # Scorebord Color. (Red,Green,Blue) (Min = 0, Max = 255)
- interval(Interval)
- S:egpText(11,"SCOREBORD",vec2(260/2,5))
- S:egpColor(11,SBC)
- S:egpSize(11,50)
- S:egpLine(12,vec2(0,55),vec2(515,55))
- S:egpColor(12,vec4(255,255,255,255))
- S:egpSize(12,2)
- if(first())
- {
- S:egpClear()
- PlayerStatus = 0
- ServerStatus = 0
- timer("ServerStatus",500)
- }
- if(clk("PlayerStatus"))
- {
- S:egpClear()
- PlayerStatus = 1
- ServerStatus = 0
- timer("ServerStatus",Time)
- }
- if(clk("ServerStatus"))
- {
- S:egpClear()
- PlayerStatus = 0
- ServerStatus = 1
- timer("PlayerStatus",Time)
- }
- if(PlayerStatus == 1)
- {
- I = 0
- Players = players()
- S:egpLine(13,vec2(0,105),vec2(515,105))
- S:egpColor(13,vec4(255,255,255,255))
- S:egpSize(13,2)
- # NAME ROW
- S:egpText(14,"NAME",vec2(15,50))
- S:egpColor(14,vec4(255,255,255,255))
- S:egpSize(14,50)
- S:egpLine(15,vec2(150,55),vec2(150,500))
- S:egpColor(15,vec4(255,255,255,255))
- S:egpSize(15,2)
- # HEALTH ROW
- S:egpText(16,"HP",vec2(150,60))
- S:egpColor(16,vec4(255,255,255,255))
- S:egpSize(16,30)
- S:egpLine(17,vec2(190,55),vec2(190,500))
- S:egpColor(17,vec4(255,255,255,255))
- S:egpSize(17,2)
- # KILLS ROW
- S:egpText(18,"KILL",vec2(190,60))
- S:egpColor(18,vec4(255,255,255,255))
- S:egpSize(18,30)
- S:egpLine(19,vec2(250,55),vec2(250,500))
- S:egpColor(19,vec4(255,255,255,255))
- S:egpSize(19,2)
- # DEATHS ROW
- S:egpText(20,"DEATH",vec2(250,60))
- S:egpColor(20,vec4(255,255,255,255))
- S:egpSize(20,30)
- S:egpLine(21,vec2(336,55),vec2(336,500))
- S:egpColor(21,vec4(255,255,255,255))
- S:egpSize(21,2)
- # PING ROW
- S:egpText(22,"PING",vec2(336,60))
- S:egpColor(22,vec4(255,255,255,255))
- S:egpSize(22,30)
- S:egpLine(24,vec2(403,55),vec2(403,500))
- S:egpColor(24,vec4(255,255,255,255))
- S:egpSize(24,2)
- # Alive ROW
- S:egpText(25,"ALIVE",vec2(410,60))
- S:egpColor(25,vec4(255,255,255,255))
- S:egpSize(25,30)
- # While for the PlayerStats
- while(I < numPlayers())
- {
- S:egpBox(I,vec2(250,140+(I*30)),vec2(550,30))
- S:egpColor(I,vec4(255,255,255,50))
- S:egpText(30+I,Players[I+1,entity]:name(),vec2(5,125+(I*30)))
- S:egpColor(30+I,vec4(255,255,255,255))
- S:egpSize(30+I,30)
- S:egpText(40+I,toString(Players[I+1,entity]:health()),vec2(155,130+(I*30)))
- S:egpColor(40+I,vec4(255,255,255,255))
- S:egpSize(40+I,20)
- S:egpText(50+I,toString(Players[I+1,entity]:frags()),vec2(195,130+(I*30)))
- S:egpColor(50+I,vec4(255,255,255,255))
- S:egpSize(50+I,20)
- S:egpText(60+I,toString(Players[I+1,entity]:deaths()),vec2(255,130+(I*30)))
- S:egpColor(60+I,vec4(255,255,255,255))
- S:egpSize(60+I,20)
- S:egpText(70+I,toString(Players[I+1,entity]:ping()),vec2(341,130+(I*30)))
- S:egpColor(70+I,vec4(255,255,255,255))
- S:egpSize(70+I,20)
- S:egpText(80+I,toString(Players[I+1,entity]:isAlive()),vec2(430,130+(I*30)))
- S:egpColor(80+I,vec4(255,255,255,255))
- S:egpSize(80+I,20)
- I++
- }
- }
- if(ServerStatus == 1)
- {
- S:egpText(14,hostname(),vec2(250/2,75))
- S:egpColor(14,vec4(255,255,255,255))
- S:egpSize(14,50)
- # 1. Row
- S:egpText(15,"GameMode: " + gamemode(),vec2(5,150))
- S:egpColor(15,vec4(255,255,255,255))
- S:egpSize(15,25)
- S:egpText(16,"Map Name: " + map(),vec2(250,150))
- S:egpColor(16,vec4(255,255,255,255))
- S:egpSize(16,25)
- # 2. Row
- S:egpText(17,"Gravity: " + gravity(),vec2(5,175))
- S:egpColor(17,vec4(255,255,255,255))
- S:egpSize(17,25)
- S:egpText(18,"Max. Players: " + maxPlayers(),vec2(250,175))
- S:egpColor(18,vec4(255,255,255,255))
- S:egpSize(18,25)
- # 3. Row
- S:egpText(19,"Lan Server: " + isLan(),vec2(5,200))
- S:egpColor(19,vec4(255,255,255,255))
- S:egpSize(19,25)
- S:egpText(20,"Players: " + numPlayers(),vec2(250,200))
- S:egpColor(20,vec4(255,255,255,255))
- S:egpSize(20,25)
- # 4. Row
- S:egpText(21,"SpeedLimit: " + speedLimit(),vec2(5,225))
- S:egpColor(21,vec4(255,255,255,255))
- S:egpSize(21,25)
- S:egpText(22,"SinglePlayer: " + isSinglePlayer(),vec2(250,225))
- S:egpColor(22,vec4(255,255,255,255))
- S:egpSize(22,25)
- # 5. Row
- S:egpText(23,"Time: " + time("hour")+":"+time("min"),vec2(5,325))
- S:egpColor(23,vec4(255,255,255,255))
- S:egpSize(23,50)
- S:egpText(24,"Date: " + time("year")+":"+time("month")+":"+time("day"),vec2(5,375))
- S:egpColor(24,vec4(255,255,255,255))
- S:egpSize(24,50)
- }
Advertisement
Add Comment
Please, Sign In to add comment