doRemoveVipDays(cid, days)Hi, how to remove vip days from user?
Incase you haven't solved this yet, the registerCreatureEvent line must be inside the function like the other registerCreatureEvent lines.[12/02/2014 01:15:18] [Error - CreatureScript Interface]
[12/02/2014 01:15:18] data/creaturescripts/scripts/login.lua
[12/02/2014 01:15:18] Description:
[12/02/2014 01:15:18] (luaRegisterCreatureEvent) Creature not found
_____________________________________________________
[12/02/2014 01:15:18] [Error - CreatureScript Interface]
[12/02/2014 01:15:18] data/creaturescripts/scripts/login.lua
[12/02/2014 01:15:18] Description:
[12/02/2014 01:15:18] (luaRegisterCreatureEvent) Creature not found
_____________________________________________________
Please help !
http://otland.net/threads/bug-with-vip-system-help.201450/#post-1937119i already searched... thats the point why im post that or do you think other? i wouldnt post it if i found any other options
so my problem again
im using 3.6
:
when i use: vip medal
[07/02/2014 00:53:12] [Error - Action Interface]
[07/02/2014 00:53:12] data/actions/scripts/vip/vipmedal.luanUse
[07/02/2014 00:53:12] Description:
[07/02/2014 00:53:12] data/lib/050-function.lua:776: attempt to call field 'executeQuery' (a nil value)
[07/02/2014 00:53:12] stack traceback:
[07/02/2014 00:53:12] data/lib/050-function.lua:776: in function 'doAddVipDays'
[07/02/2014 00:53:12] data/actions/scripts/vip/vipmedal.lua:6: in function <data/actions/scripts/vip/vipmedal.lua:2>
when i make /adddays
[07/02/2014 00:53:23] [Error - TalkAction Interface]
[07/02/2014 00:53:23] data/talkactions/scripts/adddays.luanSay
[07/02/2014 00:53:23] Description:
[07/02/2014 00:53:23] data/lib/050-function.lua:776: attempt to call field 'executeQuery' (a nil value)
[07/02/2014 00:53:23] stack traceback:
[07/02/2014 00:53:23] data/lib/050-function.lua:776: in function 'doAddVipDays'
[07/02/2014 00:53:23] data/talkactions/scripts/adddays.lua:30: in function <data/talkactions/scripts/adddays.lua:1>
doRemoveVipDays(cid, days)
<item id="5785" article="a" name="Vip Medal">
<attribute key="weight" value="1000"/>
<attribute key="writeable" value="1"/>
<attribute key="maxTextLen" value="128"/>
</item>
<attribute key="writeable" value="1"/>
<attribute key="maxTextLen" value="128"/>
function getPlayerVipDays(cid)
local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local days= Info:getDataInt("vipdays")
Info:free()
return days
end
return LUA_ERROR
end
function doAddVipDays(cid, days)
db.query("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
function doRemoveVipDays(cid, days)
db.query("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
addcan someone rewrite this to tfs 1.0?
Code:function getPlayerVipDays(cid) local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1") if Info:getID() ~= LUA_ERROR then local days= Info:getDataInt("vipdays") Info:free() return days end return LUA_ERROR end function doAddVipDays(cid, days) db.query("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") end function doRemoveVipDays(cid, days) db.query("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") end
I have add it to global.lua (tfs 1.0 functions) tried alot but no result it keep saying error line xxx -> local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
after I fixed that it wil give another error for the next line ->if Info:getID() ~= LUA_ERROR then
are you serious -,-add
ALTER TABLE `accounts` ADD
`vipdays` int(11) NOT NULL DEFAULT 0
can someone rewrite this to tfs 1.0?
Code:function getPlayerVipDays(cid) local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1") if Info:getID() ~= LUA_ERROR then local days= Info:getDataInt("vipdays") Info:free() return days end return LUA_ERROR end function doAddVipDays(cid, days) db.query("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") end function doRemoveVipDays(cid, days) db.query("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") end
I have add it to global.lua (tfs 1.0 functions) tried alot but no result it keep saying error line xxx -> local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
after I fixed that it wil give another error for the next line ->if Info:getID() ~= LUA_ERROR then
function getPlayerVipDays(cid)
local Info = db.storeQuery("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. Player(cid):getAccountId() .. " LIMIT 1")
if Info then
local days = result.getDataString(Info, 'vipdays')
result.free(Info)
return days
end
return LUA_ERROR
end
Add to global.lua.I dont have the folder lib, functions in data
-- Vip medal by Kekox
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerVipDays(cid) > 365 then
doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.")
else
doAddVipDays(cid, 7)
doCreatureSay(cid, "VIP")
doPlayerPopupFYI(cid, "We have added 7 vip days to your account!\nEnjoy it!.")
doRemoveItem(item.uid,1)
end
return true
end