Hi.
Can someone rewrite this script to globalevent?
I tried to add it as function to my other script but i have error in console
Can someone help me?
Can someone rewrite this script to globalevent?
PHP:
local reward = {x = 1015, y = 1000, z = 7}
local temple = {x = 1000, y = 1000, z = 7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getGlobalStorageValue(13375) > 1 and getPlayerStorageValue(cid,13375) > 0 then
doTeleportThing(cid, reward)
setPlayerStorageValue(13375, getPlayerStorageValue(cid,13375)-1)
end
if getGlobalStorageValue(13376) > 1 and getPlayerStorageValue(cid,13375) > 0 then
doTeleportThing(cid, temple)
setPlayerStorageValue(13375, getPlayerStorageValue(cid,13375)-1)
end
if getGlobalStorageValue(13376) > 1 and getPlayerStorageValue(cid,13376) > 0 then
doTeleportThing(cid, reward)
setPlayerStorageValue(13376, getPlayerStorageValue(cid,13376)-1)
end
if getGlobalStorageValue(13375) > 1 and getPlayerStorageValue(cid,13376) > 0 then
doTeleportThing(cid, temple)
setPlayerStorageValue(13376, getPlayerStorageValue(cid,13376)-1)
end
return true
end
I tried to add it as function to my other script but i have error in console
PHP:
local reward = {x = 1015, y = 1000, z = 7}
local temple = {x = 1000, y = 1000, z = 7}
local function ArenaEND(cid)
if getGlobalStorageValue(13375) > 1 and getPlayerStorageValue(cid,13375) > 0 then
doTeleportThing(cid, reward)
setPlayerStorageValue(13375, getPlayerStorageValue(cid,13375)-1)
end
if getGlobalStorageValue(13376) > 1 and getPlayerStorageValue(cid,13375) > 0 then
doTeleportThing(cid, temple)
setPlayerStorageValue(13375, getPlayerStorageValue(cid,13375)-1)
end
if getGlobalStorageValue(13376) > 1 and getPlayerStorageValue(cid,13376) > 0 then
doTeleportThing(cid, reward)
setPlayerStorageValue(13376, getPlayerStorageValue(cid,13376)-1)
end
if getGlobalStorageValue(13375) > 1 and getPlayerStorageValue(cid,13376) > 0 then
doTeleportThing(cid, temple)
setPlayerStorageValue(13376, getPlayerStorageValue(cid,13376)-1)
end
return true
end
local corpse_ids = {
[0] = 3065, -- female
[1] = 3058 -- male
}
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(cid) and type == STATSCHANGE_HEALTHLOSS then
if value >= getCreatureHealth(cid) and getCreatureHealth(cid) > 1 then
doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".\n[Arena kill]")
doTeleportThing(cid, {x=1016,y=1006,z=7}, TRUE)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
addEvent(ArenaEND, 100)
if getPlayerStorageValue(cid,13375) == 1 then
setGlobalStorageValue(13376, getGlobalStorageValue(cid,13376)+1)
doBroadcastMessage("1pkt dla teamu 1.")
end
if getPlayerStorageValue(cid,13376) == 1 then
setGlobalStorageValue(13375, getGlobalStorageValue(cid,13375)+1)
doBroadcastMessage("1pkt dla teamu 2.")
end
return false
end
end
return true
end
Can someone help me?