• 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!

Kekox Free VIpdays

Lightonia

Lightonia.servegame.com
Joined
Jun 4, 2007
Messages
492
Reaction score
9
Hey, i need the script for Kekox VIP system, that you get 2 days of free VIP when you create a new account. Thank you
 
data\creaturescripts\scripts

make file freevip.lua

Lua:
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


then put this line in data\creaturescripts.xml

Lua:
<event type="login" name="freevip" event="script" value="freevip.lua"/>


than open file login.lua put this line

Lua:
registerCreatureEvent(cid, "freevip")


:)
 
Last edited:
Code:
 [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>
 
Hey that free VIP thing u fixed for me, when your VIP is done, u just make a new player and u get 2 new free vip days, please how to fix that?
 
Execute this in the database
SQL:
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 in lib, 050-function.lua
Lua:
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

The use getAccountStorageValue and setAccountStorageValue instead of getPlayerStorageValue and doPlayerSetStorageValue.
 
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
 
Last edited:
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
Can someone help?
 
Back
Top