Ghost Knight
New Member
- Joined
- Nov 12, 2012
- Messages
- 25
- Reaction score
- 0
Error during getDataInt(vipdays).
that sayme the console y use cryingdamson 0.3.6
that sayme the console y use cryingdamson 0.3.6
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
if getPlayerStorageValue(cid,19551) < 1 then
if getPlayerLevel(cid) > 1 then
getPlayerStorageValue(cid, 19551)
doSendAnimatedText(getPlayerPosition(cid), "+15 Vip Days", TEXTCOLOR_YELLOW)
doSendMagicEffect(getPlayerPosition(cid),27)
doCreatureSay(cid, "CONGRATULATIONS " .. name .. "! Now you are a member of the VIP City!!Now you can enter VIP and use unique features!", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 19551, (getPlayerStorageValue(cid,19551) + 15))
doSendMagicEffect(getPlayerPosition(cid),27)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
end
else
doPlayerSendCancel(cid,"You already used this.")
end
return TRUE
end
ALTER TABLE `accounts` ADD
`vipdays` int(11) NOT NULL DEFAULT 0;
function getPlayerVipDays(cid)
local Info = db.getResult("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.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
function doRemoveVipDays(cid, days)
db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
if getPlayerVipDays(cid) > 365 then
if getPlayerLevel(cid) > 1 then
doSendAnimatedText(getPlayerPosition(cid), "+15 Vip Days", TEXTCOLOR_YELLOW)
doSendMagicEffect(getPlayerPosition(cid),27)
doAddVipDays(cid, 15)
doCreatureSay(cid, "CONGRATULATIONS " .. name .. "! Now you are a member of the VIP City!!Now you can enter VIP and use unique features!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid),27)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
end
else
doPlayerSendCancel(cid,"You already used this.")
end
return TRUE
end
local days = 15
function onUse(cid, item, fromPosition, itemEx, toPosition)
vip.addVipByAccount(getPlayerAccount(cid), vip.getDays(days))
getPlayerStorageValue(cid, 19551)
doSendAnimatedText(getPlayerPosition(cid), "+15 Vip Days", TEXTCOLOR_YELLOW)
doCreatureSay(cid, "CONGRATULATIONS " .. getCreatureName(cid) .. "! Now you are a member of the VIP City!!Now you can enter VIP and use unique features!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid),27)
doRemoveItem(item.uid)
return true
end