User Tools

Site Tools


lua:scripting:examples:turninobjects
-- Initializes the tracker variable with empty names if it doesn't exist
tracker = tracker or {
    [18405] = "",
    [18406] = "",
    [18407] = "",
    [18408] = "",
    [18409] = "",
    [18410] = "",
    [18411] = "",
    [18412] = "",
    [18413] = "",
    [18425] = "",
    [18430] = "",
}
 
if tracker[obj1.vnum] == nil then -- We don't want this thing
    say("I don't want that!")
    mdo("drop %s", obj1.name)
    return
end
 
if tracker[obj1.vnum] == ch.name then -- Player was the last one to give it
    say("You were the last one to give me that already!")
    mdo("give '%s' %s", obj1.name, ch.name)
    mdo("drop %s", obj1.name)
    return
end
 
-- If we got here then we need to reward and track the player
say("Thanks %s! Just what I was looking for!", ch.name)
obj1:destroy()
reward(ch, "qp", 5)
tracker[obj1.vnum]=ch.name
lua/scripting/examples/turninobjects.txt · Last modified: 2014/12/24 05:44 by vodur