• 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 system error

-Mohamed Shipl-

Well-Known Member #!@!$!$@%%&*& Online Helpful
Joined
Jun 19, 2014
Messages
42
Reaction score
0
i need fix this script for vip effects :D

Code:
function onThink(interval, lastExecution)
for _, name in ipairs(getOnlinePlayers() do
local cid = getPlayerByName(name)
if getPlayerVipDays(cid) >= 1 then
doSendMagicEffect(getPlayerPosition(cid), 27)
doSendAnimatedText(getPlayerPosition(cid), "VIP!", TEXTCOLOR_RED)
end
end
return true
end

i got this error
10429394_1506539759579602_2148400587029616078_n.jpg

 
Code:
function onThink(interval, lastExecution)
     for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
         if getPlayerVipDays(cid) >= 1 then
             doSendMagicEffect(getPlayerPosition(cid), 27)
             doSendAnimatedText(getPlayerPosition(cid), "VIP!", TEXTCOLOR_RED)
         end
     end
     return true
end
 
Can you upload the Lua file on speedyshare?
It's not possible to get such an error from the script I just posted.
 
i god error when i add it man can u give me ur function and add this to it

edit the functions and give me it can u

?
 
Last edited by a moderator:
All functions:
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
Add this to data/lib/050-function.lua.
If you have errors, post them.
 
No, just add this, don't remove anything there. Or if you already added getPlayerVipDays, just the other 2 functions.
 
Just select the functions I posted, click copy and paste in your 050-function.lua.
If you get errors after that, post your 050-function.lua with the functions you added.
 

Similar threads

Back
Top