function onLogin(cid)
if getPlayerStorageValue(cid, 5017) <= 0 and getPlayerVipDays(cid) <= 0 then
doAddVipDays(cid, 2)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome 2 Free VIP Days. Enjoy !")
doPlayerSetStorageValue(cid, 5017, 1)
end
return true
end
<event type="login" name="freevip" event="script" value="freevip.lua"/>
registerCreatureEvent(cid, "freevip")
[Error - CreatureScript Interface]
data/creaturescripts/scripts/freevip.lua:onLogin
Description:
data/creaturescripts/scripts/freevip.lua:2: attempt to compare function with number
stack traceback:
data/creaturescripts/scripts/freevip.lua:2: in function <data/creaturescripts/scripts/freevip.lua:1>
CREATE TABLE IF NOT EXISTS `accounts_storage` (
`id` int(11) NOT NULL DEFAULT '0',
`key` int(10) NOT NULL DEFAULT '0',
`value` varchar(255) NOT NULL DEFAULT '0',
UNIQUE KEY `id_key` (`id`,`key`),
KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
function setAcccountStorageValue(cid, key, value)
local result = db.getResult("SELECT `key` FROM `accounts_storage` WHERE (`id` = '" .. getPlayerAccountId(cid) .. "' and `key` = '" .. key .. "');")
if result:getDataInt("key") == nil then
return db.executeQuery("INSERT INTO `accounts_storage` (`id`, `key`, `value`) VALUES (" .. getPlayerAccountId(cid) .. ", " .. key .. ", " .. value .. ")"), result:free()
else
return db.executeQuery("UPDATE `accounts_storage` SET `value` = " .. value .. " WHERE (`id` = '" .. getPlayerAccountId(cid) .. "' and `key` = '" .. key .. "');"), result:free()
end
end
function getAccountStorageValue(cid, key)
local value = db.getResult("SELECT `value` FROM `accounts_storage` WHERE (`id` = '" .. getPlayerAccountId(cid) .. "' and `key` = '" .. key .. "');")
return value:getDataInt("value"), value:free()
end
[Error - CreatureScript Interface]
data/creaturescripts/scripts/freevip.lua:onLogin
Description:
data/lib/004-database.lua:60: [Result:getDataInt] Result not set!
stack traceback:
[C]: in function 'error'
data/lib/004-database.lua:60: in function 'getDataInt'
data/lib/050-function.lua:720: in function 'getAccountStorageValue'
data/creaturescripts/scripts/freevip.lua:2: in function <data/creaturescripts/scripts/freevip.lua:1>
function onLogin(cid)
if getAccountStorageValue(cid, 5017) <= 0 and getAccountVipDays(cid) <= 0 then
doAddVipDays(cid, 2)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "All new players recieve 2 days of free vip just to try out the functions of it")
SetAccountStorageValue(cid, 5017, 1)
end
return true
end
Can someone help?getting this error code
Code:[Error - CreatureScript Interface] data/creaturescripts/scripts/freevip.lua:onLogin Description: data/lib/004-database.lua:60: [Result:getDataInt] Result not set! stack traceback: [C]: in function 'error' data/lib/004-database.lua:60: in function 'getDataInt' data/lib/050-function.lua:720: in function 'getAccountStorageValue' data/creaturescripts/scripts/freevip.lua:2: in function <data/creaturescripts/scripts/freevip.lua:1>
this is the script, that i tried to do
Lua:function onLogin(cid) if getAccountStorageValue(cid, 5017) <= 0 and getAccountVipDays(cid) <= 0 then doAddVipDays(cid, 2) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "All new players recieve 2 days of free vip just to try out the functions of it") SetAccountStorageValue(cid, 5017, 1) end return true end