Here's (my) our (Random and Raining Mammoths!) 10-second spawn protection script, it works in my computer, i hope it doesn't have conflicts with the server's script.
There's no msg commands like "You have spawn protection" etcetc, just plain script.
Code (fixed)
There's no msg commands like "You have spawn protection" etcetc, just plain script.
Code (fixed)
- Code:
-- 10-second spawn protection script
-- by Random Troll and Raining Mammoths
function getAmount(value)
local amt = {}
for x = 1, value do
amt[x] = 0
end
return amt
end
state = getAmount(32)
protect = getAmount(32)
addhook("spawn","protect_exec")
function protect_exec(id)
protect[id] = 10
if (protect[id] > 0) then
state[id] = 1
end
end
addhook("ms100","protection_check")
function protection_check()
for x = 1,32 do
if (state[x] == 1) then
if (protect[x] == 0) or (protect[x] <= 0) then
state[x] = 0
end
end
end
end
addhook("second","protection_time")
function protection_time(id)
for x = 1,32 do
if (state[x] == 1) and (protect[x] > 0) then
protect[x] = protect[x] - 1
end
end
end
addhook("hit","protection_do")
function protection_do(id,source)
if (state[id] == 1) or (state[source] == 1) then
return 1
else
return 0
end
end
Last edited by Random Troll on Thu Jan 23, 2014 1:55 am; edited 3 times in total