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

Please rewrite my script

Scooty

Enemia.EU
Joined
Jul 24, 2010
Messages
564
Reaction score
14
Location
Kraków
Hi.

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?
 
Back
Top