mirror of
https://github.com/etlegacy/etlegacy-lua-scripts.git
synced 2024-11-29 15:41:52 +00:00
lua: clean up, script now loads properly
This commit is contained in:
parent
fd4321de62
commit
f2a0708fe1
1 changed files with 24 additions and 34 deletions
|
@ -1,7 +1,8 @@
|
||||||
modname = "Banners"
|
modname = "Banners"
|
||||||
version = "0.3"
|
version = "0.5"
|
||||||
|
|
||||||
welcome = "^WELCOME MESSAGE" -- Welcome message here when client finished connecting to the server
|
-- Welcome message when client finished connecting to the server
|
||||||
|
welcome = "^3WELCOME MESSAGE"
|
||||||
|
|
||||||
-- Set Banners of you desire
|
-- Set Banners of you desire
|
||||||
banner = "..."
|
banner = "..."
|
||||||
|
@ -11,30 +12,15 @@ banner3 = "..."
|
||||||
banner4 = "..."
|
banner4 = "..."
|
||||||
banner5 = "..."
|
banner5 = "..."
|
||||||
|
|
||||||
-- Set time in miliseconds when banners string has to be executed
|
-- Set time in seconds when banners string has to be executed
|
||||||
timer = 0
|
timer = 10
|
||||||
timer1 = 0
|
timer1 = 15
|
||||||
timer2 = 0
|
timer2 = 20
|
||||||
timer3 = 0
|
timer3 = 25
|
||||||
timer4 = 0
|
timer4 = 30
|
||||||
timer5 = 0
|
timer5 = 35
|
||||||
|
|
||||||
|
|
||||||
-------------------- SAMPLE -----------------------------------------------------------------------------------
|
|
||||||
-- timer = 100000
|
|
||||||
-- timer1 = 105000
|
|
||||||
-- timer2 = 106000 ARE THOSE VALUES CORRECT AND MAKE SENSE HERE
|
|
||||||
-- timer3 = 107000 OR ALL THEY SHOULD BE REPLACED BY 1000 ? (BUT THIS WAY MIGHT GET MESSY)
|
|
||||||
-- timer4 = 108000
|
|
||||||
-- timer5 = 109000
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------
|
|
||||||
------------------ TODO! ------------------------------------------------------------------------------------------
|
|
||||||
-------------------------------------------------------------------------------------------------------------------
|
|
||||||
-- print welcome message to connected client to show gratitude for client
|
|
||||||
-- Get millisec value
|
|
||||||
-- FIND OUT HOW TO MAKE IT INTO LOOP!! OR JUST MILISECONDS (a) = NULL ?
|
|
||||||
-- Do a conditional statement if/elseif/else comparing
|
|
||||||
-------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -44,28 +30,32 @@ function et_InitGame( levelTime, randomSeed, restart )
|
||||||
et.RegisterModname( modname .. " " .. version )
|
et.RegisterModname( modname .. " " .. version )
|
||||||
|
|
||||||
local milliseconds = et.trap_Milliseconds() -- is this right way ?
|
local milliseconds = et.trap_Milliseconds() -- is this right way ?
|
||||||
local a = (milliseconds*1000)/60
|
local a = (milliseconds*1000)%60
|
||||||
|
|
||||||
if(a == timer)
|
if(a == timer)
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner .."^7\n") -- not better to announce it globally instead only to clientnum ?
|
then et.trap_SendServerCommand(-1, "cp \"" .. banner .."^7\n") -- not better to announce it globally instead only to clientnum ?
|
||||||
elseif(a == timer1)
|
elseif(a == timer1)
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner1 .."^7\n")
|
then et.trap_SendServerCommand(-1, "cp \"" .. banner1 .."^7\n")
|
||||||
elseif(a == timer2)
|
elseif(a == timer2)
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner2 .."^7\n")
|
then et.trap_SendServerCommand(-1, "cp \"" .. banner2 .."^7\n")
|
||||||
elseif(a == timer3)
|
elseif(a == timer3)
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner3 .."^7\n")
|
then et.trap_SendServerCommand(-1, "cp \"" .. banner3 .."^7\n")
|
||||||
elseif(a == timer4)
|
elseif(a == timer4)
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner4 .."^7\n")
|
then et.trap_SendServerCommand(-1, "cp \"" .. banner4 .."^7\n")
|
||||||
elseif(a == timer5)
|
elseif(a == timer5)
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner5 .."^7\n")
|
then et.trap_SendServerCommand(-1, "cp \"" .. banner5 .."^7\n")
|
||||||
|
local milliseconds = 0 -- we reset it here
|
||||||
else
|
else
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. "NO BANNERS" .."^7\n")
|
et.trap_SendServerCommand(-1, "cp \"" .. "NO BANNERS" .."^7\n")
|
||||||
|
|
||||||
|
return milliseconds
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function et_ClientConnect( clientNum, firstTime, isBot )
|
function et_ClientConnect( clientNum, firstTime, isBot )
|
||||||
et.trap_SendServerCommand(clientNum, "cpm \"" .. welcome .."^7\n")
|
et.trap_SendServerCommand(clientNum, "cp \"" .. welcome .."^7\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function et_ShutdownGame( restart )
|
function et_ShutdownGame( restart )
|
||||||
|
|
Loading…
Reference in a new issue