lua: clean up, script now loads properly

This commit is contained in:
Rafał Pawlak 2016-10-31 23:42:17 +01:00
parent fd4321de62
commit f2a0708fe1

View file

@ -1,7 +1,8 @@
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
banner = "..."
@ -11,30 +12,15 @@ banner3 = "..."
banner4 = "..."
banner5 = "..."
-- Set time in miliseconds when banners string has to be executed
timer = 0
timer1 = 0
timer2 = 0
timer3 = 0
timer4 = 0
timer5 = 0
-- Set time in seconds when banners string has to be executed
timer = 10
timer1 = 15
timer2 = 20
timer3 = 25
timer4 = 30
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 )
local milliseconds = et.trap_Milliseconds() -- is this right way ?
local a = (milliseconds*1000)/60
local a = (milliseconds*1000)%60
if(a == timer)
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner .."^7\n") -- not better to announce it globally instead only to clientnum ?
if(a == timer)
then et.trap_SendServerCommand(-1, "cp \"" .. banner .."^7\n") -- not better to announce it globally instead only to clientnum ?
elseif(a == timer1)
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner1 .."^7\n")
then et.trap_SendServerCommand(-1, "cp \"" .. banner1 .."^7\n")
elseif(a == timer2)
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner2 .."^7\n")
then et.trap_SendServerCommand(-1, "cp \"" .. banner2 .."^7\n")
elseif(a == timer3)
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner3 .."^7\n")
then et.trap_SendServerCommand(-1, "cp \"" .. banner3 .."^7\n")
elseif(a == timer4)
et.trap_SendServerCommand(clientNum, "cpm \"" .. banner4 .."^7\n")
then et.trap_SendServerCommand(-1, "cp \"" .. banner4 .."^7\n")
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
et.trap_SendServerCommand(clientNum, "cpm \"" .. "NO BANNERS" .."^7\n")
et.trap_SendServerCommand(-1, "cp \"" .. "NO BANNERS" .."^7\n")
return milliseconds
end
end
function et_ClientConnect( clientNum, firstTime, isBot )
et.trap_SendServerCommand(clientNum, "cpm \"" .. welcome .."^7\n")
et.trap_SendServerCommand(clientNum, "cp \"" .. welcome .."^7\n")
end
function et_ShutdownGame( restart )