• 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!

addEvent tfs 1x

theduck

Member
Joined
Dec 6, 2018
Messages
246
Reaction score
20
I'm managing to create the npc Game.create pc () but I would like that after some time it disappears
 
Solution
Here is a small example.
Lua:
local function removeNpc(name)
    local guy = Npc(name)
    -- Check if we found a valid NPC
    if guy and guy:isNpc() then
        -- Bye bye
        guy:remove()
    end
end

-- Create NPC
local cipfried = Game.createNpc("Cipfried", Position(100, 100, 7))

-- Remove NPC after 5 minutes
addEvent(removeNpc, 5 * 60 * 1000, cipfried:getName())
Here is a small example.
Lua:
local function removeNpc(name)
    local guy = Npc(name)
    -- Check if we found a valid NPC
    if guy and guy:isNpc() then
        -- Bye bye
        guy:remove()
    end
end

-- Create NPC
local cipfried = Game.createNpc("Cipfried", Position(100, 100, 7))

-- Remove NPC after 5 minutes
addEvent(removeNpc, 5 * 60 * 1000, cipfried:getName())
 
Solution
Back
Top