Postado Agosto 2, 2017 7 anos Olá pessoal. procurei bastante esse script, ou pelo menos tentei mais não encontrei nada com o vip system que uso. Eu uso o System Vip by Mock, então ele não é por storage, e todos que encontrei é por storage. Gostaria de um script no qual fica saindo do player o Nome Vip quando ele for vip, e quando o vip acabar o efeito sair também. System Vip: Spoiler vip = { name = "VIP System"; author = "Mock"; version = "1.0.0.0"; query="ALTER TABLE `accounts` ADD `vip_time` INTEGER"; query2="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL" } function vip.setTable() dofile('config.lua') if sqlType == "sqlite" then db.query(vip.query) else db.query(vip.query2) end 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 local retee = ae:getDataInt("vip_time") or 0 ae:free() return retee 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, a:free() 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.query("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='".. getPlayerAccount(cid).."';") 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 return end; local t = vip.getVip(cid) or 0 if os.time(day) < t then return TRUE else return FALSE end end function vip.hasVips(cid) assert(tonumber(cid),'Parameter must be a number') if isPlayer(cid) == FALSE then return end; local t = vip.getVip(cid) 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.query("UPDATE `accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';") 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 É isso galera, agradeço desde de já ! Editado Agosto 2, 2017 7 anos por Gabrielk (veja o histórico de edições)
Postado Agosto 2, 2017 7 anos Solução 10 minutos atrás, Gabrielk disse: Olá pessoal. procurei bastante esse script, ou pelo menos tentei mais não encontrei nada com o vip system que uso. Eu uso o System Vip by Mock, então ele não é por storage, e todos que encontrei é por storage. Gostaria de um script no qual fica saindo do player o Nome Vip quando ele for vip, e quando o vip acabar o efeito sair também. System Vip: Mostrar conteúdo oculto vip = { name = "VIP System"; author = "Mock"; version = "1.0.0.0"; query="ALTER TABLE `accounts` ADD `vip_time` INTEGER"; query2="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL" } function vip.setTable() dofile('config.lua') if sqlType == "sqlite" then db.query(vip.query) else db.query(vip.query2) end 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 local retee = ae:getDataInt("vip_time") or 0 ae:free() return retee 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, a:free() 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.query("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='".. getPlayerAccount(cid).."';") 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 return end; local t = vip.getVip(cid) or 0 if os.time(day) < t then return TRUE else return FALSE end end function vip.hasVips(cid) assert(tonumber(cid),'Parameter must be a number') if isPlayer(cid) == FALSE then return end; local t = vip.getVip(cid) 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.query("UPDATE `accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';") 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 É isso galera, agradeço desde de já ! Não sei se vai mas tenta ai... Em data/creaturescripts/scripts cria um arquivo chamado vipeffect.lua e coloca isso dentro: local rnd = {"[VIP]"} function onLogin(cid) sendEffect(cid) registerCreatureEvent(cid, "AdvEffect") return true end function sendEffect(cid) if isCreature(cid) then if vip.hasVip(cid) == true then pos = getThingPos(cid) doSendAnimatedText(pos, rnd[math.random(#rnd)], 180) addEvent(sendEffect, 5200,cid) end end end Em creaturescripts.xml coloca: <event type="login" name="AdvEffect" event="script" value="vipeffect.lua"/> Em login.lua registra: registerCreatureEvent(cid, "AdvEffect") Talvez você queira ver: BestBaiak [FAQ]Remere's Map Editor - Dúvidas e soluções de bugs Contato: Discord:
Postado Agosto 6, 2017 7 anos Em 2017-8-2 ás 16:26, Werner disse: Não sei se vai mas tenta ai... Em data/creaturescripts/scripts cria um arquivo chamado vipeffect.lua e coloca isso dentro: local rnd = {"[VIP]"} function onLogin(cid) sendEffect(cid) registerCreatureEvent(cid, "AdvEffect") return true end function sendEffect(cid) if isCreature(cid) then if vip.hasVip(cid) == true then pos = getThingPos(cid) doSendAnimatedText(pos, rnd[math.random(#rnd)], 180) addEvent(sendEffect, 5200,cid) end end end Em creaturescripts.xml coloca: <event type="login" name="AdvEffect" event="script" value="vipeffect.lua"/> Em login.lua registra: registerCreatureEvent(cid, "AdvEffect") Ola amigo meu esta dando erro quando clico para entrar com personagem aparece este erro [06/08/2017 17:30:33] [Error - CreatureScript Interface] [06/08/2017 17:30:33] data/creaturescripts/scripts/vipeffect.lua:onLogin [06/08/2017 17:30:34] Description: [06/08/2017 17:30:34] data/creaturescripts/scripts/vipeffect.lua:10: attempt to index global 'vip' (a nil value) [06/08/2017 17:30:34] stack traceback: [06/08/2017 17:30:34] data/creaturescripts/scripts/vipeffect.lua:10: in function 'sendEffect' [06/08/2017 17:30:34] data/creaturescripts/scripts/vipeffect.lua:3: in function <data/creaturescripts/scripts/vipeffect.lua:2> PODERIA ME AJUDAR OBRIGADO
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.