Hi all, I'm Peaverin.
I've just started to create my own server with the help of otland. I've already created one server that got more than 50 players online back in summer, but today i'm starting again with 10.31, and tfs 1.0 .
I've just set up my page with znote and a nice layout (Design by Naxtie@OtLand), and i managed to follow the simple tutorial to make the shop system work.
But then I realized that the script znoteshop.lua works only for tfs 0.3, so it just does nothing when i put it on my serv. Can someone modify this to make it work for tfs 1.0? I'd appreciate it, and if I have profit(when the server starts) i'll donate him a part of profit.
Here's the script:
This in talkactions:
And this (znoteshop.lua) in talkactions/scripts:
Also wanted to know how to donate, because I tried with http://otland.net/payments.php , but that doesn't work. I won't donate a lot but maybe a part of the profit i got with the serv.
Thanks in advance, and please understand that im not from england, i'm from spain, so maybe i didn't explain 100% correctly.
I've just started to create my own server with the help of otland. I've already created one server that got more than 50 players online back in summer, but today i'm starting again with 10.31, and tfs 1.0 .
I've just set up my page with znote and a nice layout (Design by Naxtie@OtLand), and i managed to follow the simple tutorial to make the shop system work.
But then I realized that the script znoteshop.lua works only for tfs 0.3, so it just does nothing when i put it on my serv. Can someone modify this to make it work for tfs 1.0? I'd appreciate it, and if I have profit(when the server starts) i'll donate him a part of profit.
Here's the script:
This in talkactions:
Code:
<talkaction words="!shop" script="znoteshop.lua"/>
Code:
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
function onSay(cid, words, param)
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
local cooldown = 15 -- in seconds.
if getPlayerStorageValue(cid, storage) <= os.time() then
setPlayerStorageValue(cid, storage, os.time() + cooldown)
local accid = getAccountNumberByPlayerName(getCreatureName(cid))
-- Create the query
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. ";")
-- Detect if we got any results
if orderQuery ~= false then
-- Fetch order values
local q_id = result.getDataInt(orderQuery, "id")
local q_type = result.getDataInt(orderQuery, "type")
local q_itemid = result.getDataInt(orderQuery, "itemid")
local q_count = result.getDataInt(orderQuery, "count")
result.free(orderQuery)
-- ORDER TYPE 1 (Regular item shop products)
if q_type == 1 then
-- Get wheight
local playerCap = getPlayerFreeCap(cid)
local itemweight = getItemWeightById(q_itemid, q_count)
if playerCap >= itemweight then
local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
result.free(delete)
doPlayerAddItem(cid, q_itemid, q_count)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
end
end
-- Add custom order types here
-- Type 2 is reserved for premium days and is handled on website, not needed here.
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
-- So use type 4+ for custom stuff, like etc packages.
-- if q_type == 4 then
-- end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
end
return false
end
Also wanted to know how to donate, because I tried with http://otland.net/payments.php , but that doesn't work. I won't donate a lot but maybe a part of the profit i got with the serv.
Thanks in advance, and please understand that im not from england, i'm from spain, so maybe i didn't explain 100% correctly.