• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Make server spawn an item at xyz for x amount of time on random intervals

Silba

is stephany, the josh wife
Joined
Aug 22, 2013
Messages
456
Solutions
9
Reaction score
384
Hey guys..

How would i go about adding a script to my server (tfs 0.3.6) which would automatically and preferably randomly spawn an item at a certain position on the map?

I've got a cool new idea and it would be great to be able to spawn the item in automatically instead of manually! Help will be appreciated !
 
Code:
local cfg = {
itempos = {x = 1010,y= 1212,z=7}, -- pos of the wall
timetospawn = 60 -- seconds to spawn this creature(s)
summoneditemid = {"firstid"} -- Change this to the id of the summoned item
}

local timetospawn = {675 * 1000, 10000 * 1000, 1000 * 1000, 150 * 1000}
local function k()
doCreateItem(cfg.summoneditemid, 1, cfg.itempos)
end

function onThink(cid, interval)
addEvent(k, timetospawn[math.random(#timetospawn)])
return true
end

Never used onThink I am not sure if this will work
 
Back
Top