Autor głównego system to: **Mock** [[http://otland.net/f163/mock-vip-system-vip-account-51512/|link]] licencja: ~brak opisu~\\ Autorem dodatkowego mebla i drzwi: **Moqill** Licencja: Rób co chcesz byle by nie zmieniać autora Testowane na: tfs 0.4_ Najpierw uaktualniamy baze danych o linijke ALTER TABLE `accounts` ADD `vip_time` INT( 15 ) NOT NULL Dodajem w data/lib/ plik o naziw vip_system.lua. Wklejamy w niego vip = { name = "Vip system"; author = "Mock"; version = "1.0.0.0"; query="ALTER TABLE `accounts` ADD `vip_time` INT( 15 ) NOT NULL" } function vip.setTable() db.executeQuery(vip.query) end function vip.getVip(cid) assert(tonumber(cid),'Parameter must be a number') if isPlayer(cid) == FALSE then error('Player don\'t find') end; ae = db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = "..getPlayerAccount(cid)..";") if ae:getID() == -1 then return 0 end return ae:getDataInt("vip_time") or 0 end function vip.getVipByAcc(acc) assert(acc,'Account is nil') local a = db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = "..acc..";") if a:getID() ~= -1 then return a:getDataInt("vip_time") or 0 else error('Account don\'t find.') end end function vip.setVip(cid,time) dofile("config.lua") assert(tonumber(cid),'Parameter must be a number') assert(tonumber(time),'Parameter must be a number') if isPlayer(cid) == FALSE then error('Player don\'t find') end; db.executeQuery("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` =".. getPlayerAccount(cid).." LIMIT 1 ;") end function vip.getVipByAccount(acc) assert(acc,'Account is nil') return db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = "..acc..";"):getDataInt("vip_time") or 0 end function vip.hasVip(cid) assert(tonumber(cid),'Parameter must be a number') if isPlayer(cid) == FALSE then error('Player don\'t find') end; local t = vip.getVip(cid) or 0 if os.time(day) < t then return TRUE else return FALSE end end function vip.accountHasVip(acc) assert(acc,'Account is nil') if os.time() < vip.getVipByAccount(acc) then return TRUE else return FALSE end end function vip.getDays(days) return (3600 * 24 * days) end function vip.addVipByAccount(acc,time) assert(acc,'Account is nil') assert(tonumber(time),'Parameter must be a number') local a = vip.getVipByAcc(acc) a = os.difftime(a,os.time()) if a < 0 then a = 0 end; a = a+time return vip.setVipByAccount(acc,a) end function vip.setVipByAccount(acc,time) dofile("config.lua") assert(acc,'Account is nil') assert(tonumber(time),'Parameter must be a number') db.executeQuery("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ="..acc.." LIMIT 1 ;") return TRUE end function vip.returnVipString(cid) assert(tonumber(cid),'Parameter must be a number') if isPlayer(cid) == TRUE then return os.date("%d %B %Y %X ", vip.getVip(cid)) end end Dodajemy do talkactions.xml linijke najlepiej gdzies pod Dodajemy do data/talkaction/script/ pliczek o nazwie vip.lua z treścią: function onSay(cid, words, param) if param == "" then return doPlayerPopupFYI(cid,"Are you confused?\n Lear the commands!\n---------------\nADD vip:\n/vip add days player\n/vip add 30 mock\n---------------\nDel vip:\n/vip del player\n/vip del mock\n---------------\ncheck vip:\n/vip see player\n/vip see mock\n---------------\n") end if param:lower():find('add') == 1 and 3 then local ret = string.explode(param,' ',3) if #ret < 3 or tonumber(ret[2]) == nil or getPlayerByName(ret[3]) == false then return doPlayerSendTextMessage(cid,25,"Add vip:\n/vip add days player\n/vip add 30 mock\n") end vip.addVipByAccount( getPlayerAccount(getPlayerByName(ret[3])) ,vip.getDays(ret[2])) doPlayerSendTextMessage(cid,25,"Has benn added "..tonumber(ret[2]).." days to "..ret[3]..".") doPlayerSendTextMessage(getPlayerByName(ret[3]),25,"You recivied "..tonumber(ret[2]).." vip days!") elseif param:lower():find('del') == 1 and 3 then local ret = string.explode(param,' ',2) if #ret < 2 or getPlayerByName(ret[2]) == false then return doPlayerSendTextMessage(cid,25,"Del vip:\n/vip del player\n/vip del mock\n") end vip.setVipByAccount(getPlayerAccount(getPlayerByName(ret[2])),-os.time()) doPlayerSendTextMessage(cid,25,ret[2].."'s vip has been deleted.") elseif param:lower():find('see') == 1 and 3 then local ret = string.explode(param,' ',2) if #ret < 2 or getPlayerByName(ret[2]) == false then return doPlayerSendTextMessage(cid,25,"check vip:\n/vip see player\n/vip see mock\n") end local ret_ = vip.getVip(getPlayerByName(ret[2])) if ret_ == 0 then return doPlayerSendTextMessage(cid, 25,ret[2].." Dont have any vip") else return doPlayerSendTextMessage(cid, 25, "Vip from "..ret[2].." end in "..os.date("%d %B %Y %X ",ret_)) end end return TRUE end Do actions.xml dodajemy: Tworzymy pliczek o nazwie vip.lua w data/actions/script/other z zawartością: function onUse(cid, item, fromPosition, itemEx, toPosition) local days = 30 doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for "..days.." days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1) vip.addVipByAccount(getPlayerAccount(cid), vip.getDays(days)) doRemoveItem(item.uid, 1) doSendAnimatedText(getCreaturePosition(cid), "+"..days.." days", 30) return TRUE end Tworzymy pliczek o nazwie vip_door.lua w data/actions/script/other/ z zawartością: function onUse(cid, item, fromPosition, itemEx, toPosition) if vip.getVip(cid) > 0 then if getCreaturePosition(cid).y < toPosition.y then doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE) else doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE) end doCreatureSay(cid, "Thank you for purchasing a VIP!", TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), 10) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, only VIP Players can pass here!.") end return TRUE end Gotowe :)