Postado Março 21, 2018 7 anos Autor Citar function onLogin(cid) if getPlayerStorageValue(cid, cfg.storage) > os.time() then doPlayerSetVocation(cid,9) end return trueend Não mudou. Percebi que está retirando a vocação e quando o player loga seta vocação para a determinada ao logar (tudo certo, porém n retorna pra antes de pegar a nova). Editado Março 21, 2018 7 anos por yoroshigod (veja o histórico de edições)
Postado Março 21, 2018 7 anos 14 minutos atrás, yoroshigod disse: Não mudou. Percebi que está retirando a vocação e quando o player loga seta vocação para a determinada ao logar (tudo certo, porém n retorna pra antes de pegar a nova). tenta deixando o creaturescripts.xml q eu falei pra criar como comentario(anulando o script de login ai)
Postado Março 23, 2018 7 anos Autor Obrigado amigo, consegui resolver, REP. @edit Como te reputo? xD Editado Março 23, 2018 7 anos por yoroshigod (veja o histórico de edições)
Postado Março 23, 2018 7 anos 53 minutos atrás, yoroshigod disse: Obrigado amigo, consegui resolver, REP. @edit Como te reputo? xD Posta a solução pfv ahahaha Pra reputar é só dar gostei nas respostas hayauaha
Postado Março 23, 2018 7 anos Autor Para checar o tempo eu utilizei o sistema vip do autor "Kydrai", fiz algumas modificações para melhor entendimento(próprio) no script Adicionei isso no data/lib. Citar --[[ Name: Vip System by Account Version: 1.0 Author: Kydrai Forum: forum/topic/136543-vip-system-by-account-v10/ [Functions] -- Install installVip() -- By Account doTeleportPlayersByAccount(acc, topos) getVipTimeByAccount(acc) setVipTimeByAccount(acc, time) getVipDaysByAccount(acc) isVipAccount(acc) addVipDaysByAccount(acc, days) doRemoveVipDaysByAccount(acc, days) getVipDateByAccount(acc) -- By Player doTeleportPlayers(cid, topos) getVipTime(cid) setVipTime(cid, time) getVipDays(cid) isVip(cid) addVipDays(cid, days) doRemoveVipDays(cid, days) getVipDate(cid) ]]-- -- By Account -- Install function installAvatar() if db.executeQuery("ALTER TABLE `accounts` ADD avatartime INT(15) NOT NULL DEFAULT 0;") then print("[Avatar System] Avatar System instalado com sucesso!") return TRUE end print("[Avatar System] Não foi possível instalar o Avatar System!") return FALSE end function doTeleportPlayersByAccount(acc, topos) if db.executeQuery("UPDATE `players` SET `posx` = "..topos.x..", `posy` = "..topos.y..", `posz` = "..topos.z.." WHERE `account_id` = "..acc..";") then return TRUE end return FALSE end function getAvatarTimeByAccount(acc) local avatar = db.getResult("SELECT `avatartime` FROM `accounts` WHERE `id` = "..acc..";") if avatar:getID() == -1 then print("[Avatar System] Account not found!") return FALSE end return avatar:getDataInt("avatartime") end function setAvatarTimeByAccount(acc, time) if db.executeQuery("UPDATE `accounts` SET `avatartime` = "..time.." WHERE `id` = "..acc..";") then return TRUE end return FALSE end function doRemoveAvatarDaysByAccount(acc, days) if days > 0 then local daysValue = days * 24 * 60 * 60 local AvatarTime = getAvatarTimeByAccount(acc) local time = AvatarTime - daysValue setAvatarTimeByAccount(acc, (time <= 0 and 1 or time)) return TRUE end return FALSE end function getAvatarDaysByAccount(acc) local AvatarTime = getAvatarTimeByAccount(acc) local timeNow = os.time() local days = math.ceil((AvatarTime - timeNow)/(24 * 60 * 60)) return days <= 0 and 0 or days end function isAvatarAccount(acc) return getAvatarDaysByAccount(acc) > 0 and TRUE or FALSE end function addAvatarDaysByAccount(acc, days) if days > 0 then local daysValue = days * 24 * 60 * 60 local AvatarTime = getAvatarTimeByAccount(acc) local timeNow = os.time() local time = getAvatarDaysByAccount(acc) == 0 and (timeNow + daysValue) or (AvatarTime + daysValue) setAvatarTimeByAccount(acc, time) return TRUE end return FALSE end function getAvatarDateByAccount(acc) if isAvatarAccount(acc) then local AvatarTime = getAvatarTimeByAccount(acc) return os.date("%d/%m/%y %X", AvatarTime) end return FALSE end -- By Player function doTeleportPlayers(cid, topos) doTeleportPlayersByAccount(getPlayerAccountId(cid), topos) end function getAvatarTime(cid) return getAvatarTimeByAccount(getPlayerAccountId(cid)) end function setAvatarTime(cid, time) return setAvatarTimeByAccount(getPlayerAccountId(cid), time) end function getAvatarDays(cid) return getAvatarDaysByAccount(getPlayerAccountId(cid)) end function isAvatar(cid) return isAvatarAccount(getPlayerAccountId(cid)) end function addAvatarDays(cid, days) return addAvatarDaysByAccount(getPlayerAccountId(cid), days) end function doRemoveAvatarDays(cid, days) return doRemoveAvatarDaysByAccount(getPlayerAccountId(cid), days) end function getAvatarDate(cid) return getAvatarDateByAccount(getPlayerAccountId(cid)) end Depois adicionei isso na database(SQL)(PHPMYADMIN) do servidor: Citar ALTER TABLE `accounts` ADD avatartime INT(15) NOT NULL DEFAULT 0; Fiz algumas modificações no script para ter chance da alavanca falhar: Citar local destino = {x=2644, y=2238, z=8} local chance = 20 function onUse(cid,item,frompos,item2,topos) if doTeleportThing(cid, destino) then doSendAnimatedText(getCreaturePosition(cid), "NO!", 129) if (math.random(100) < chance) then if getPlayerVocation(cid) == 1 then doPlayerSetVocation(cid,9) doSendMagicEffect(getCreaturePosition(cid), 28) doSendAnimatedText(getCreaturePosition(cid), "YES!", 129) setPlayerStorageValue(cid,56590,1) -- Sorcerer addAvatarDays(cid, 1) end else doPlayerSendCancel(cid,"You cannot use this object.") end if (math.random(100) < chance) then if getPlayerVocation(cid) == 2 then doPlayerSetVocation(cid,9) doSendMagicEffect(getCreaturePosition(cid), 28) doSendAnimatedText(getCreaturePosition(cid), "YES!", 129) setPlayerStorageValue(cid,56591,1) -- Druid addAvatarDays(cid, 1) end else doPlayerSendCancel(cid,"You cannot use this object.") end if (math.random(100) < chance) then if getPlayerVocation(cid) == 3 then doPlayerSetVocation(cid,9) doSendMagicEffect(getCreaturePosition(cid), 28) doSendAnimatedText(getCreaturePosition(cid), "YES!", 129) setPlayerStorageValue(cid,56592,1) -- Paladin addAvatarDays(cid, 1) end else doPlayerSendCancel(cid,"You cannot use this object.") end if (math.random(100) < chance) then if getPlayerVocation(cid) == 4 then doPlayerSetVocation(cid,9) doSendMagicEffect(getCreaturePosition(cid), 28) doSendAnimatedText(getCreaturePosition(cid), "YES!", 129) setPlayerStorageValue(cid,56593,1) -- Knight addAvatarDays(cid, 1) end else doPlayerSendCancel(cid,"You cannot use this object.") end return true end end Em creaturescripts eu adicionei: Citar function onLogin(cid) local avatar = isAvatar(cid) if getPlayerStorageValue (cid,56590) == 1 and getAvatarTime(cid) > 0 and avatar == FALSE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Seu periodo acabou!") doPlayerSetVocation(cid, 1) setPlayerStorageValue(cid,56590,0) -- end if getPlayerStorageValue (cid,56591) == 1 and getAvatarTime(cid) > 0 and avatar == FALSE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Seu periodo acabou!") doPlayerSetVocation(cid, 2) setPlayerStorageValue(cid,56591,0) -- end if getPlayerStorageValue (cid,56592) == 1 and getAvatarTime(cid) > 0 and avatar == FALSE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Seu periodo acabou!") doPlayerSetVocation(cid, 3) setPlayerStorageValue(cid,56592,0) -- end if getPlayerStorageValue (cid,56593) == 1 and getAvatarTime(cid) > 0 and avatar == FALSE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Seu periodo acabou!") doPlayerSetVocation(cid, 4) setPlayerStorageValue(cid,56593,0) -- end return true end Esses scripts ai foram editado por mim mesmo. Editado Março 23, 2018 7 anos por yoroshigod (veja o histórico de edições)
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.