• 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 Check] help

elking

Swev-v2.sytes.net Comming Soon !<>!
Joined
Aug 20, 2012
Messages
445
Reaction score
28
Location
Egypt
Hello people of Otland.

I need help with vip check

I use this for Vip.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid,11551) < 1 then
if getPlayerLevel(cid) > 1 then
getPlayerStorageValue(cid, 11551)
doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 12 days! You can now enter the VIP!. ", TALKTYPE_MONSTER)
setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 12))
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You need to be at least level 1 to use this.")
end
else
doPlayerSendCancel(cid,"You are already a VIP.")
end
return TRUE
end

and this for Vip door.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cidPosition = getCreaturePosition(cid)
if (item.actionid == 5788 and getPlayerStorageValue(cid,11551) >= 1) then
if cidPosition.x < toPosition.x then
doTeleportThing(cid, {x=toPosition.x,y=toPosition.y,z=toPosition.z}, TRUE)
doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
else
doTeleportThing(cid, {x=toPosition.x -1,y=toPosition.y,z=toPosition.z}, TRUE)
doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
end
return TRUE
else
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You Are Not Vip ! Donate And Buy It to Enjoy .")
return TRUE
end
return FALSE
end

help I test @Kekox system but it give all character on your account vip days

anyone can help me with vip check or make kekox vip for 1 character
 
Last edited by a moderator:
Go to your phpmyadmin and execute:
Code:
ALTER TABLE `accounts` ADD
`vipdays` int(11) NOT NULL DEFAULT 0;

creaturescripts.xml
Code:
<event type="login" name="VipCheck" event="script" value="vipcheck.lua"/>

creaturescripts/scripts/
login.lua
Code:
registerCreatureEvent(cid, "VipCheck")

LIB open 050-function.luaadded this function:
Code:
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

create
data/creaturescripts/scripts
vipcheck.lua
Code:
function onLogin(cid)
        if getPlayerVipDays(cid) >= 1 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have ".. getPlayerVipDays(cid) .." vip days left.")
        end
        return true
end

Now, go to data/globalevents/scripts/, create a new file and name it daysremover.lua
Code:
--- Script by Kekox
function onTimer()
db.executeQuery("UPDATE accounts SET vipdays = vipdays - 1 WHERE vipdays > 0;")
return true
end

data/globalevents/globanevents.xml
Code:
    <globalevent name="VipDaysRemover" time="00:01" event="script" value="daysremover.lua"/>

Medal:
Code:
-- Script by Cronox

function doAddVipDays(cid, points)
  db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

function onUse(cid, item, frompos, item2, topos)
local vipitem = 1 -- item ID medal  (Edit 1)

  if getPlayerItemCount(cid, vipitem) >= 1 then
  doPlayerRemoveItem(cid, vipitem, 1)
  setPlayerStorageValue(cid, 11551, 1)
  doAddVipDays(cid, 12)
  doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 12 days! You can now enter the VIP!. ", TALKTYPE_MONSTER)
  else
  doPlayerSendCancel(cid,"You are already a VIP.")
  end
  return TRUE
end


and door
Code:
function onUse(cid, item, frompos, item2, topos)
local vipstorage = 11551

if item.actionid == 5788 then
if getPlayerStorageValue(cid, vipstorage) == TRUE then
pos = getPlayerPosition(cid)

if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Inside door please.')
return 1
end

doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
end
return 1
end
return TRUE
end
 
Last edited:
Go to your phpmyadmin and execute:
Code:
ALTER TABLE `accounts` ADD
`vipdays` int(11) NOT NULL DEFAULT 0;

creaturescripts.xml
Code:
<event type="login" name="VipCheck" event="script" value="vipcheck.lua"/>

creaturescripts/scripts/
login.lua
Code:
registerCreatureEvent(cid, "VipCheck")

LIB open 050-function.luaadded this function:
Code:
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

create
data/creaturescripts/scripts
vipcheck.lua
Code:
function onLogin(cid)
        if getPlayerVipDays(cid) >= 1 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have ".. getPlayerVipDays(cid) .." vip days left.")
        end
        return true
end

Now, go to data/globalevents/scripts/, create a new file and name it daysremover.lua
Code:
--- Script by Kekox
function onTimer()
db.executeQuery("UPDATE accounts SET vipdays = vipdays - 1 WHERE vipdays > 0;")
return true
end

data/globalevents/globanevents.xml
Code:
    <globalevent name="VipDaysRemover" time="00:01" event="script" value="daysremover.lua"/>

Medal:
Code:
-- Script by Cronox

function doAddVipDays(cid, points)
  db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

function onUse(cid, item, frompos, item2, topos)
local vipitem = 1 -- item ID medal  (Edit 1)

  if getPlayerItemCount(cid, vipitem) >= 1 then
  doPlayerRemoveItem(cid, vipitem, 1)
  setPlayerStorageValue(cid, 11551, 1)
  doAddVipDays(cid, 12)
  doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 12 days! You can now enter the VIP!. ", TALKTYPE_MONSTER)
  else
  doPlayerSendCancel(cid,"You are already a VIP.")
  end
  return TRUE
end


and door
Code:
function onUse(cid, item, frompos, item2, topos)
local vipstorage = 11551

if item.actionid == 5788 then
if getPlayerStorageValue(cid, vipstorage) == TRUE then
pos = getPlayerPosition(cid)

if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Inside door please.')
return 1
end

doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
end
return 1
end
return TRUE
end

you misunderstand :p

i meant i need [funcation,daysremove,vipcheck] work on my script

i didn't use kokex system because it give your account [all character] .

i used vip give 1 character vipdays
 
Code:
ALTER TABLE `players` ADD
`vipdays` int(11) NOT NULL DEFAULT 0;

050-functions
Code:
function getPlayerVipDays(cid)
    local Info = db.getResult("SELECT `vipdays` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        local days= Info:getDataInt("vipdays")
        Info:free()
        return days
    end
    return LUA_ERROR
end

Code:
function doAddVipDays(cid, days)
    db.executeQuery("UPDATE `players` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
end

function doRemoveVipDays(cid, days)
    db.executeQuery("UPDATE `players` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
end

----
Medal:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local vipitem = 1 -- item ID medal  (Edit 1)

if getPlayerItemCount(cid, vipitem) >= 1 and getPlayerLevel(cid) > 1 then
doPlayerRemoveItem(cid, vipitem, 1)
setPlayerStorageValue(cid, 11551, 1)
doAddVipDays(cid, 12)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You need to be at least level 1 to use this.")
end
else
doPlayerSendCancel(cid,"You are already a VIP.")
end
return TRUE
end
 
Second part:
vipcheck.lua
Code:
function onLogin(cid)
        if getPlayerVipDays(cid) >= 1 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have ".. getPlayerVipDays(cid) .." vip days left.")
        end
        return true
end

vipdaysremover.lua
Code:
function onTime()
    db.executeQuery("UPDATE players SET vipdays = vipdays - 1 WHERE vipdays > 0;")
    return TRUE
end
 
Code:
[28/02/2014 16:11:16] Admin has logged in.
[28/02/2014 16:11:16] Error during getDataInt(vipdays).

:(
 
Why would you store vips day in a new database field when it is individual for each player?
 
get same error this?

Code:
function getPlayerVipDays(cid)
  local Info = db.getResult("SELECT `vipdays` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
  if Info:getID() ~= LUA_ERROR then
  local days= Info:getDataInt("vipdays")
  Info:free()
  return days
  end
  return LUA_ERROR
end


Code:
function onLogin(cid)
  if getPlayerVipDays(cid) >= 1 then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have ".. getPlayerVipDays(cid) .." vip days left.")
  end
  return true
end
 
get same error this?

Code:
function getPlayerVipDays(cid)
  local Info = db.getResult("SELECT `vipdays` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
  if Info:getID() ~= LUA_ERROR then
  local days= Info:getDataInt("vipdays")
  Info:free()
  return days
  end
  return LUA_ERROR
end


Code:
function onLogin(cid)
  if getPlayerVipDays(cid) >= 1 then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have ".. getPlayerVipDays(cid) .." vip days left.")
  end
  return true
end

yes same error :(

Code:
[01/03/2014 01:30:08] Admin has logged in.
[01/03/2014 01:30:08] Error during getDataInt(vipdays).

I remember Vip medal has bug so i replace it with my one

this is wrong

Code:
[01/03/2014 01:32:25] [Error - LuaScriptInterface::loadFile] data/actions/scripts/vip.lua:11: 'end' expected (to close 'function' at line 1) near 'else'
[01/03/2014 01:32:25] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/vip.lua)
[01/03/2014 01:32:25] data/actions/scripts/vip.lua:11: 'end' expected (to close 'function' at line 1) near 'else'
 
Last edited:
Put your script.
vip.lua
or try in line 11
added one

Code:
end
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local vipitem = 1 -- item ID medal  (Edit 1)

if getPlayerItemCount(cid, vipitem) >= 1 and getPlayerLevel(cid) > 1 then
doPlayerRemoveItem(cid, vipitem, 1)
setPlayerStorageValue(cid, 11551, 1)
doAddVipDays(cid, 12)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You need to be at least level 1 to use this.") 
end
else
doPlayerSendCancel(cid,"You are already a VIP.")
end
return TRUE
end

give me this error
Code:
[01/03/2014 14:49:17] [Error - LuaScriptInterface::loadFile] data/actions/scripts/vip.lua:13: 'end' expected (to close 'function' at line 1) near 'else'
[01/03/2014 14:49:17] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/vip.lua)
[01/03/2014 14:49:17] data/actions/scripts/vip.lua:13: 'end' expected (to close 'function' at line 1) near 'else'
 
hmm try
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local vipitem = 1 -- item ID medal  (Edit 1)

if getPlayerItemCount(cid, vipitem) >= 1 then
doPlayerRemoveItem(cid, vipitem, 1)
setPlayerStorageValue(cid, 11551, 1)
doAddVipDays(cid, 12)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You are already a VIP.")
end
return TRUE
end
 
hmm try
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local vipitem = 1 -- item ID medal  (Edit 1)

if getPlayerItemCount(cid, vipitem) >= 1 then
doPlayerRemoveItem(cid, vipitem, 1)
setPlayerStorageValue(cid, 11551, 1)
doAddVipDays(cid, 12)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"You are already a VIP.")
end
return TRUE
end

Sorry for
clear.png
delay
Thanks @Cronox you is the Best :)
vip medal and vip check now work prefect but daysremove give me this wrong


Code:
[03/03/2014 01:24:25] [Warning - Event::loadScript] Event onTimer not found (data/globalevents/scripts/daysremover.lua)
 
Last edited:
Just changed in
data/globalevents/scripts/daysremover.lua
Code:
function onTimer()
for
Code:
function onTime()
 
Last edited:

Similar threads

Back
Top