-
Notifications
You must be signed in to change notification settings - Fork 5
Examples
Rusketh edited this page Apr 28, 2014
·
2 revisions
This is a holographic clock, that displays the time above the LemonGate entity. Thanks to XX for this example code.
number[] HMS = numberArray( )
string H, M, S, B
color Color = color(80,80,80)
vector Size = vec(5,5,5)
// Create holos for hour //
hologram H1 = hologram()
H1:setScale(Size)
H1:parent(self())
H1:setPos( self():pos() + vec(130,0,60))
H1:setColor(Color)
H1:setMaterial("models/debug/debugwhite")
hologram H2 = hologram()
H2:setScale(Size)
H2:parent(self())
H2:setPos( self():pos() + vec(80,0,60))
H2:setColor(Color)
H2:setMaterial("models/debug/debugwhite")
// Create holos for minutes //
hologram M1 = hologram()
M1:setScale(Size)
M1:parent(self())
M1:setPos( self():pos() + vec(20,0,60))
M1:setColor(Color)
M1:setMaterial("models/debug/debugwhite")
hologram M2 = hologram()
M2:setScale(Size)
M2:parent(self())
M2:setPos( self():pos() + vec(-30,0,60))
M2:setColor(Color)
M2:setMaterial("models/debug/debugwhite")
// Create holos for seconds //
hologram S1 = hologram()
S1:setScale(Size)
S1:parent(self())
S1:setPos( self():pos() + vec(-90,0,60))
S1:setColor(Color)
S1:setMaterial("models/debug/debugwhite")
hologram S2 = hologram()
S2:setScale(Size)
S2:parent(self())
S2:setPos( self():pos() + vec(-140,0,60))
S2:setColor(Color)
S2:setMaterial("models/debug/debugwhite")
// Create holos for colon //
hologram Colon1 = hologram()
Colon1:setScale(Size)
Colon1:parent(self())
Colon1:setPos( self():pos() + vec(50,0,65))
Colon1:setColor(Color)
Colon1:setModel("models/sprops/misc/alphanum/alphanum_colon.mdl")
Colon1:setMaterial("models/debug/debugwhite")
hologram Colon2 = hologram()
Colon2:setScale(Size)
Colon2:parent(self())
Colon2:setPos( self():pos() + vec(-60,0,65))
Colon2:setColor(Color)
Colon2:setModel("models/sprops/misc/alphanum/alphanum_colon.mdl")
Colon2:setMaterial("models/debug/debugwhite")
timerCreate("time",1,0,function()
{
H = time("hour")
M = time("min")
S = time("sec")
if((H:length()==2 && ~H))
{
H1:setModel("models/sprops/misc/alphanum/alphanum_"+H:sub(1,1)+".mdl")
H2:setModel("models/sprops/misc/alphanum/alphanum_"+H:sub(2,2)+".mdl")
}
elseif((H:length()==1 && ~H))
{
H1:setModel("models/sprops/misc/alphanum/alphanum_0.mdl")
H2:setModel("models/sprops/misc/alphanum/alphanum_"+H:sub(1,1)+".mdl")
}
if((M:length()==2 && ~M))
{
M1:setModel("models/sprops/misc/alphanum/alphanum_"+M:sub(1,1)+".mdl")
M2:setModel("models/sprops/misc/alphanum/alphanum_"+M:sub(2,2)+".mdl")
}
elseif((M:length()==1 && ~M))
{
M1:setModel("models/sprops/misc/alphanum/alphanum_0.mdl")
M2:setModel("models/sprops/misc/alphanum/alphanum_"+M:sub(1,1)+".mdl")
}
if((S:length()==2 && ~S))
{
S1:setModel("models/sprops/misc/alphanum/alphanum_"+S:sub(1,1)+".mdl")
S2:setModel("models/sprops/misc/alphanum/alphanum_"+S:sub(2,2)+".mdl")
}
elseif((S:length()==1 && ~S))
{
S1:setModel("models/sprops/misc/alphanum/alphanum_0.mdl")
S2:setModel("models/sprops/misc/alphanum/alphanum_"+S:sub(1,1)+".mdl")
}
},false)
Orzlar made a holographic clock that is simpler then the above example.
timerCreate("1",1,0,function(){
HH = time("hour")
MM = time("min")
SS = time("sec")
if(HH < 10){ H = "0"+HH }else{ H = (string)HH }
if(MM < 10){ M = "0"+MM }else{ M = (string)MM }
if(SS < 10){ S = "0"+SS }else{ S = (string)SS }
Time = H+":"+M+":"+S
table T = Time:explode("")
foreach(number X;string S:T){
if(S == ":"){ Holos[X,hologram]:setModel("models/sprops/misc/alphanum/alphanum_colon.mdl") }else{ Holos[X,hologram]:setModel("models/sprops/misc/alphanum/alphanum_"+T[X,string]+".mdl") }
Holos[X,hologram]:setPos(self():pos() + self():forward()*65 - vec(X*15,0,-50)) Holos[X,hologram]:setScale(vec(1.5,1.5,1.5)) Holos[X,hologram]:setColor(color(131,103,72)) Holos[X,hologram]:setMaterial("effects/flashlight/gradient")
}
})