• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Vip Account

Execute this query
Code:
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;
Then add this to your data/lib/050-function.lua
Code:
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
(@Teckman's script https://otland.net/threads/account-storage.93908/)

Now go to data/creaturescripts/scripts/login.lua and find this:
Code:
    local lastLogin = getPlayerLastLoginSaved(cid)
    if(lastLogin > 0) then
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, text)
    else
        doPlayerSendOutfitWindow(cid)
    end
replace it with:
Code:
    local lastLogin = getPlayerLastLoginSaved(cid)
    if(lastLogin > 0) then
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, text)
    else
        doPlayerSendOutfitWindow(cid)
        if getAccountStorageValue(cid, 1000) < 1 then
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 3))    
            setAccountStorageValue(cid, 1000, 1)
            doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You've received 3 free VIP days.")
        end
    end
 
my login
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)

fly.login(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end


local lastLogin = getPlayerLastLoginSaved(cid)
if(lastLogin > 0) then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, text)
else
doPlayerSendOutfitWindow(cid)
if getAccountStorageValue(cid, 1000) < 1 then
setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 3))
setAccountStorageValue(cid, 1000, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You've received 3 free VIP days.")
end
end
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "ZombieAttack")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")

registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "getmoney")
registerCreatureEvent(cid, "getmoney2")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
registerCreatureEvent(cid, "playerd")
registerCreatureEvent(cid, "logoout")
registerCreatureEvent(cid, "BlessLogin")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "forever amulet")
registerCreatureEvent(cid, "skull amulet")
registerCreatureEvent(cid, "charge amulet")
return true
end

something wrong ??
 
Try using [.CODE] tags
Code:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)

fly.login(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end



local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
if getAccountStorageValue(cid, 1000) < 1 then
setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 3))
setAccountStorageValue(cid, 1000, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You've received 3 free VIP days.")
end
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "ZombieAttack")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")

registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "getmoney")
registerCreatureEvent(cid, "getmoney2")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
registerCreatureEvent(cid, "playerd")
registerCreatureEvent(cid, "logoout")
registerCreatureEvent(cid, "BlessLogin")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "forever amulet")
registerCreatureEvent(cid, "skull amulet")
registerCreatureEvent(cid, "charge amulet")
return true
end
 
[26/07/2015 19:49:10] [Error - CreatureScript Interface]
[26/07/2015 19:49:10] data/creaturescripts/scripts/login.lua:eek:nLogin
[26/07/2015 19:49:11] Description:
[26/07/2015 19:49:11] data/lib/004-database.lua:60: [Result:getDataInt] Result not set!
[26/07/2015 19:49:11] stack traceback:
[26/07/2015 19:49:11] [C]: in function 'error'
[26/07/2015 19:49:11] data/lib/004-database.lua:60: in function 'getDataInt'
[26/07/2015 19:49:11] data/lib/050-function.lua:74: in function 'getAccountStorageValue'
[26/07/2015 19:49:11] data/creaturescripts/scripts/login.lua:25: in function <data/creaturescripts/scripts/login.lua:6>
 
replace the code in 050-function.lua
Code:
function setAcccountStorageValue(cid, key, value)
   local result = db.getResult("SELECT `key` FROM `accounts_storage` WHERE (`id` = '" .. getPlayerGUID(cid) .. "' and `key` = '" .. key .. "');")
   if result:getDataInt("key") == nil then
     return db.executeQuery("INSERT INTO `accounts_storage` (`id`, `key`, `value`) VALUES (" .. getPlayerGUID(cid) .. ", " .. key .. ", " .. value .. ")"), result:free()
   else
     return db.executeQuery("UPDATE `accounts_storage` SET `value` = " .. value .. " WHERE (`id` = '" .. getPlayerGUID(cid) .. "' and `key` = '" .. key .. "');"), result:free()
   end
end

function getAccountStorageValue(cid, key)
   local value = db.getResult("SELECT `value` FROM `accounts_storage` WHERE (`id` = '" .. getPlayerGUID(cid) .. "' and `key` = '" .. key .. "');")
   return value:getDataInt("value"), value:free()
end
 
:/ when i log in


[26/07/2015 20:08:01] [Error - CreatureScript Interface]
[26/07/2015 20:08:01] data/creaturescripts/scripts/login.lua:eek:nLogin
[26/07/2015 20:08:01] Description:
[26/07/2015 20:08:01] data/lib/004-database.lua:60: [Result:getDataInt] Result not set!
[26/07/2015 20:08:01] stack traceback:
[26/07/2015 20:08:02] [C]: in function 'error'
[26/07/2015 20:08:02] data/lib/004-database.lua:60: in function 'getDataInt'
[26/07/2015 20:08:02] data/lib/050-function.lua:79: in function 'getAccountStorageValue'
[26/07/2015 20:08:02] data/creaturescripts/scripts/login.lua:25: in function <data/creaturescripts/scripts/login.lua:6>
 
050-function.lua
Code:
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
login.lua
Code:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)

fly.login(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end



local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
if getAccountStorageValue(getPlayerGUID(cid), 1000) < 1 then
setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 3))
setAccountStorageValue(getPlayerGUID(cid), 1000, 1)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You've received 3 free VIP days.")
end
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "ZombieAttack")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")

registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "getmoney")
registerCreatureEvent(cid, "getmoney2")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
registerCreatureEvent(cid, "playerd")
registerCreatureEvent(cid, "logoout")
registerCreatureEvent(cid, "BlessLogin")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "forever amulet")
registerCreatureEvent(cid, "skull amulet")
registerCreatureEvent(cid, "charge amulet")
return true
end
 
Back
Top