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

TFS 1.X+ Changing the prize at a globalevents event

luciano01

New Member
Joined
Aug 6, 2017
Messages
33
Reaction score
1
Could someone help me change the prize for this event? You are earning premium points and I would like you to win 2 items.

globalevents/lms.lua
Lua:
local centeroffight = {x = 32323, y = 32022, z = 12}
local waitingplace = {x = 32300, y = 32026, z = 12}
local depotcenter = {x = 32369, y = 32241, z = 7}
local MinimumPlayers = 2
local rewardpoints = 2
local area_increase = 10



local function lmsclosed1()
    broadcastMessage("LMS event will start in 5 minutes. Portal is opened in north of depot Thais. Hurry!!", MESSAGE_EVENT_ADVANCe)
end


local function lmsclosed()

count = 0
        local spectators = getSpectators(waitingplace, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then   
                         count = count + 1
                      
                        end
                end
        end
      
              
if (count >= MinimumPlayers) then

broadcastMessage("Last Man Standing event portal closed and event started!", MESSAGE_EVENT_ADVANCE)

for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
doTeleportThing(playerids,centeroffight)
doSendMagicEffect(center, CONST_ME_TELEPORT)
    end
      
end

else

broadcastMessage("Not enough players to start Last man Standing event! Minimum: "..MinimumPlayers.." players.", MESSAGE_EVENT_ADVANCE)
setGlobalStorageValue(25002, 0)

for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
doTeleportThing(playerids,depotcenter)
doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
setPlayerStorageValue(pid, 25001, 0)

    end
end

end


return true
end



local function lmscheck()


count = 0
        local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then   
                         count = count + 1
                      
                        end
                end
        end

if count == 1 then


for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
setPlayerStorageValue(playerids, 25001, 0)
    end
end

        local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then

          
          
doTeleportThing(spectator,depotcenter)
doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
broadcastMessage("LMS ended winner is: "..getPlayerName(spectator)..", reward is 2 premium points.", MESSAGE_EVENT_ADVANCE)
 
local accid = Player(spectator):getAccountId()
local points = rewardpoints
db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. accid)
                     end
                end
        end
      


for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
setPlayerStorageValue(pid, 25001, 0)
end
end

stopEvent(lmscheck)

else
addEvent(lmscheck, 10*1000)
end
end



local function lms()
    broadcastMessage("LMS event will start in 9 minutes. Portal is opened in Event Room [Temple of Thais]. The reward is 2 PREMIUM POINTS, Hurry!!", MESSAGE_EVENT_ADVANCE)

    portalwhere = {x = 32374, y = 32498, z = 6}
    local portal = doCreateItem(11796,1,portalwhere)
  doSetItemActionId(portal, 25001)
  doSendMagicEffect(portalwhere, CONST_ME_TELEPORT)


 
addEvent(function() doRemoveItem(getTileItemById(portalwhere, 11796).uid) end, 600 * 1000)
addEvent(function() doSendMagicEffect(portalwhere, CONST_ME_TELEPORT) end, 600 * 1000)

addEvent(lmsclosed, 10*60*1000)
addEvent(lmsclosed1, 5*60*1000)
addEvent(lmscheck, 130*1000)

return true
end



function onTime()

    broadcastMessage("Last Man Standing event will start in 10 minutes.", MESSAGE_EVENT_ADVANCE)
    addEvent(lms, 60*1000)



for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
--doTeleportThing(playerids,depotcenter)
--doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
setPlayerStorageValue(pid, 25001, 0)

    end
end


return true
end
 
I tried to change, but it gave an "unknow" error in line 102

Lua:
local centeroffight = {x = 32323, y = 32022, z = 12}
local waitingplace = {x = 32300, y = 32026, z = 12}
local depotcenter = {x = 32369, y = 32241, z = 7}
local MinimumPlayers = 2
local rewards = {
            -- {itemid, quantity}
            {15515, 10}}
local area_increase = 10



local function lmsclosed1()
    broadcastMessage("LMS event will start in 5 minutes. Portal is opened in north of depot Thais. Hurry!!", MESSAGE_EVENT_ADVANCe)
end


local function lmsclosed()

count = 0
        local spectators = getSpectators(waitingplace, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then  
                         count = count + 1
                     
                        end
                end
        end
     
             
if (count >= MinimumPlayers) then

broadcastMessage("Last Man Standing event portal closed and event started!", MESSAGE_EVENT_ADVANCE)

for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
doTeleportThing(playerids,centeroffight)
doSendMagicEffect(center, CONST_ME_TELEPORT)
    end
     
end

else

broadcastMessage("Not enough players to start Last man Standing event! Minimum: "..MinimumPlayers.." players.", MESSAGE_EVENT_ADVANCE)
setGlobalStorageValue(25002, 0)

for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
doTeleportThing(playerids,depotcenter)
doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
setPlayerStorageValue(pid, 25001, 0)

    end
end

end


return true
end



local function lmscheck()


count = 0
        local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then  
                         count = count + 1
                     
                        end
                end
        end

if count == 1 then


for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
setPlayerStorageValue(playerids, 25001, 0)
    end
end

        local spectators = getSpectators(centeroffight, area_increase, area_increase, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then

         
         
doTeleportThing(spectator,depotcenter)
doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
broadcastMessage("LMS ended winner is: "..getPlayerName(spectator)..", reward is 2 premium points.", MESSAGE_EVENT_ADVANCE)

                        for _, item in ipairs(self.rewards) do
                            player:addItem(item[1], item[2])
                         end
                     end
                end
        end
     


for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
setPlayerStorageValue(pid, 25001, 0)
end
end

stopEvent(lmscheck)

else
addEvent(lmscheck, 10*1000)
end
end



local function lms()
    broadcastMessage("LMS event will start in 9 minutes. Portal is opened in Event Room [Temple of Thais]. The reward is 2 PREMIUM POINTS, Hurry!!", MESSAGE_EVENT_ADVANCE)

    portalwhere = {x = 32374, y = 32498, z = 6}
    local portal = doCreateItem(11796,1,portalwhere)
  doSetItemActionId(portal, 25001)
  doSendMagicEffect(portalwhere, CONST_ME_TELEPORT)



addEvent(function() doRemoveItem(getTileItemById(portalwhere, 11796).uid) end, 600 * 1000)
addEvent(function() doSendMagicEffect(portalwhere, CONST_ME_TELEPORT) end, 600 * 1000)

addEvent(lmsclosed, 10*60*1000)
addEvent(lmsclosed1, 5*60*1000)
addEvent(lmscheck, 130*1000)

return true
end



function onTime()

    broadcastMessage("Last Man Standing event will start in 10 minutes.", MESSAGE_EVENT_ADVANCE)
    addEvent(lms, 60*1000)



for _, pid in ipairs(getOnlinePlayers()) do
    if getPlayerStorageValue(pid, 25001) == 1 then
local playerids = getPlayerByName(pid)
--doTeleportThing(playerids,depotcenter)
--doSendMagicEffect(depotcenter, CONST_ME_TELEPORT)
setPlayerStorageValue(pid, 25001, 0)

    end
end


return true
end

could someone tell me how do i fix my mistake?
 
Back
Top