firstly: Imageshack - ed2by.jpg
Secondly:
Imageshack - erd1.jpg
2:
PHP:
[function onStepIn(cid, item, position, fromPosition)
--Config-->
local queststatus = getPlayerStorageValue(cid, 50001)
--EndConfig-->
if item.actionid == 1974 and queststatus == -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "It seems by defeating Azerus you have stoped this army from entering your world! Better leave this ghastly place forever.")
setPlayerStorageValue(cid, 4765, 1)
return TRUE
end
if item.actionid == 1973 and queststatus == -1 then
-- Here is the code start:
starting={x = 576, y = 560, z = 10, stackpos = 253}
checking={x=starting.x, y=starting.y, z=starting.z, stackpos=starting.stackpos}
ending={x = 586, y = 572, z = 10, stackpos = 253}
players=0
totalmonsters=0
monster = {}
repeat
creature= getThingfromPos(checking)
if creature.itemid > 0 then
if getPlayerAccess(creature.uid) == 0 then
players=players+1
end
if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
totalmonsters=totalmonsters+1
monster[totalmonsters]=creature.uid
end
end
checking.x=checking.x+1
if checking.x>ending.x then
checking.x=starting.x
checking.y=checking.y+1
end
until checking.y>ending.y
if players==0 then
trash= {x=33193, y=31689, z=15}
current=0
repeat
current=current+1
doTeleportThing(monster[current],trash)
until current>=totalmonsters
end
-- Here is the end of it
doTeleportThing(cid, player_pos_entrada)
doSendMagicEffect(player_pos_entrada, 10)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Você jل terminou a quest!')
end
end
Imageshack - erd1.jpg
PHP:
-- Guild does exists
if AccountMode == true then
-- AccountMode
local voted = db.getResult("SELECT * FROM `z_guild_votes` WHERE `account_id` = " .. getPlayerAccountId(cid) .. ";")
if voted:getID() ~= -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You already voted for ".. param .." today. Please wait for a day to vote again.")
else
db.executeQuery("UPDATE `guilds` SET `points`=".. guild:getDataInt("points") + 1 .." WHERE name = " .. db.escapeString(param) .. ";")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Thank you for voting to ".. param ..". Now ".. param .." has ".. guild:getDataInt("points") + 1 .." points.")
db.executeQuery("INSERT INTO `z_guild_votes` (`id` ,`account_id` ,`voted`) VALUES (NULL , " .. getPlayerAccountId(cid) .. " , '1');")
return true
end
voted:free()
elseif AccountMode == false then
-- PlayerMode
if getPlayerStorageValue(cid, VoteStorage) ~= 1 then
db.executeQuery("UPDATE `guilds` SET `points`=".. guild:getDataInt("points") + 1 .." WHERE name = " .. db.escapeString(param) .. ";")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Thank you for voting to ".. param ..". Now ".. param .." has ".. guild:getDataInt("points") + 1 .." points.")
doPlayerSetStorageValue(cid, VoteStorage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You already voted for ".. param .." today. Please wait for a day to vote again.")
return true
end
end
guild:free()
return true
end
2:
PHP:
delete = tonumber(result_plr:getDataInt("delete_it"))
cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) == TRUE then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
container_weight = getItemWeightById(container_id, 1)
if isItemRune(itemtogive_id) == TRUE then
items_weight = container_count * getItemWeightById(itemtogive_id, 1)
else
items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
end
full_weight = items_weight + container_weight
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
if isItemRune(itemtogive_id) == TRUE then
full_weight = getItemWeightById(itemtogive_id, 1)
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
end
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
local iter = 0
while iter ~= container_count do
doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return TRUE
end
Last edited: