• 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 Same IP no Gain Item to all character

_Aion_

Nothing Else
Joined
Jan 19, 2010
Messages
400
Solutions
4
Reaction score
10
Location
Jequie,Bahia,Brazil
Hello, I have a small doubt, I want to put this script below, give item for only 1 character per IP, as many open MC and invite the guild to win the prize for all characters and this is causing me problems.

This is scripts

Code:
dofile("./_woe.lua")

local config = woe_config

local reward = 200000 -- 200k

local function EndWoe()
	Woe.getInfo()
		
	setGlobalStorageValue(stor.Started, 0)
	setGlobalStorageValue(stor.WoeTime, 0)
	
	Woe.expulsar(infoLua[2], Castle.salas.a.fromx, Castle.salas.a.tox, Castle.salas.a.fromy, Castle.salas.a.toy, Castle.salas.a.z, Castle._exit)
	Woe.expulsar(infoLua[2], Castle.salas.b.fromx, Castle.salas.b.tox, Castle.salas.b.fromy, Castle.salas.b.toy, Castle.salas.b.z, Castle._exit)
	Woe.expulsar(infoLua[2], Castle.salas.c.fromx, Castle.salas.c.tox, Castle.salas.c.fromy, Castle.salas.c.toy, Castle.salas.c.z, Castle._exit)
	
	doBroadcastMessage("WoK acabou", config.bcType)
	doBroadcastMessage("O castelo de " .. Castle.name .. " é da ".. Woe.guildName() ..".", config.bcType)
	
	if isCreature(getThingFromPos(Castle.empePos).uid) then
		doRemoveCreature(getThingFromPos(Castle.empePos).uid)
	end
	
	Woe.removePre()
	Woe.removePortals()
	
	doRemoveItem(getThingFromPos(Castle.desde).uid)
	
	Woe.save()
	
	for _, cid in ipairs(getPlayersOnline()) do
		if infoLua[2] == getPlayerGuildId(cid) then
			doPlayerAddItem(cid,6527,1) -- Here is the line that give item to all winers
		end
	end
	
	Woe.remove()
	setGlobalStorageValue(24503, -1)
	
end

function onThink(interval, lastExecution)
	Woe.getInfo()
	if Woe.isTime() then
		if not Woe.isStarted() then
			doSummonCreature("empe", Castle.empePos)
			doSummonCreature("pre1", Castle.PreEmpes[1])
			doSummonCreature("pre2", Castle.PreEmpes[2])
			doBroadcastMessage("A Wok começou", config.bcType)
			setGlobalStorageValue(stor.Started, 1)
			Woe.updateInfo({os.time(), infoLua[2], infoLua[3], infoLua[4]})
			doCreateTeleport(1387, Castle.pos, Castle.desde)
			addEvent(EndWoe, config.timeToEnd * 60 * 1000)
		end
	end
	return true
end

Thanks and sorry my bad english :X
 
Lua:
dofile("./_woe.lua")

local config = woe_config

local reward = 200000 -- 200k

local function EndWoe()
	Woe.getInfo()
		
	setGlobalStorageValue(stor.Started, 0)
	setGlobalStorageValue(stor.WoeTime, 0)
	
	Woe.expulsar(infoLua[2], Castle.salas.a.fromx, Castle.salas.a.tox, Castle.salas.a.fromy, Castle.salas.a.toy, Castle.salas.a.z, Castle._exit)
	Woe.expulsar(infoLua[2], Castle.salas.b.fromx, Castle.salas.b.tox, Castle.salas.b.fromy, Castle.salas.b.toy, Castle.salas.b.z, Castle._exit)
	Woe.expulsar(infoLua[2], Castle.salas.c.fromx, Castle.salas.c.tox, Castle.salas.c.fromy, Castle.salas.c.toy, Castle.salas.c.z, Castle._exit)
	
	doBroadcastMessage("WoK acabou", config.bcType)
	doBroadcastMessage("O castelo de " .. Castle.name .. " é da ".. Woe.guildName() ..".", config.bcType)
	
	if isCreature(getThingFromPos(Castle.empePos).uid) then
		doRemoveCreature(getThingFromPos(Castle.empePos).uid)
	end
	
	Woe.removePre()
	Woe.removePortals()
	
	doRemoveItem(getThingFromPos(Castle.desde).uid)
	
	Woe.save()
	
	for _, cid in ipairs(getPlayersOnline()) do
		if infoLua[2] == getPlayerGuildId(cid) then
			if #getPlayersByIp(getPlayerIp(pid)) == 1 then
				doPlayerAddItem(cid,6527,1) -- Here is the line that give item to all winers
			end
		end
	end
	
	Woe.remove()
	setGlobalStorageValue(24503, -1)
	
end

function onThink(interval, lastExecution)
	Woe.getInfo()
	if Woe.isTime() then
		if not Woe.isStarted() then
			doSummonCreature("empe", Castle.empePos)
			doSummonCreature("pre1", Castle.PreEmpes[1])
			doSummonCreature("pre2", Castle.PreEmpes[2])
			doBroadcastMessage("A Wok começou", config.bcType)
			setGlobalStorageValue(stor.Started, 1)
			Woe.updateInfo({os.time(), infoLua[2], infoLua[3], infoLua[4]})
			doCreateTeleport(1387, Castle.pos, Castle.desde)
			addEvent(EndWoe, config.timeToEnd * 60 * 1000)
		end
	end
	return true
end
 
I accidentally wrote pid instead of cid.
Lua:
dofile("./_woe.lua")
 
local config = woe_config
 
local reward = 200000 -- 200k
 
local function EndWoe()
	Woe.getInfo()
 
	setGlobalStorageValue(stor.Started, 0)
	setGlobalStorageValue(stor.WoeTime, 0)
 
	Woe.expulsar(infoLua[2], Castle.salas.a.fromx, Castle.salas.a.tox, Castle.salas.a.fromy, Castle.salas.a.toy, Castle.salas.a.z, Castle._exit)
	Woe.expulsar(infoLua[2], Castle.salas.b.fromx, Castle.salas.b.tox, Castle.salas.b.fromy, Castle.salas.b.toy, Castle.salas.b.z, Castle._exit)
	Woe.expulsar(infoLua[2], Castle.salas.c.fromx, Castle.salas.c.tox, Castle.salas.c.fromy, Castle.salas.c.toy, Castle.salas.c.z, Castle._exit)
 
	doBroadcastMessage("WoK acabou", config.bcType)
	doBroadcastMessage("O castelo de " .. Castle.name .. " é da ".. Woe.guildName() ..".", config.bcType)
 
	if isCreature(getThingFromPos(Castle.empePos).uid) then
		doRemoveCreature(getThingFromPos(Castle.empePos).uid)
	end 
 
	Woe.removePre()
	Woe.removePortals()
 
	doRemoveItem(getThingFromPos(Castle.desde).uid)
 
	Woe.save()
	for _, cid in ipairs(getPlayersOnline()) do
		if infoLua[2] == getPlayerGuildId(cid) then
			if #getPlayersByIp(getPlayerIp(cid)) == 1 then
				doPlayerAddItem(cid,6527,1) -- Here is the line that give item to all winers
			end
		end
	end
 
	Woe.remove()
	setGlobalStorageValue(24503, -1)
 
end
 
Back
Top