Postado Fevereiro 4, 2017 8 anos Alguém poderia me ajuda com esse script??? queria que ao dar look no player aparecer quantos resets ele tem ! to precisando muito, pra quem ajudar rep+ desde ja obrigado Script local config = { backToLevel = 100, redskull = false, -- need to be without redskull to reset? battle = false, -- need to be without battle to reset? pz = false, -- need to be in protect zone to reset? stages = { {resets = 1, level = 400, premium = 330}, {resets = 2, level = 820, premium = 340}, {resets = 3, level = 1200, premium = 355}, {resets = 4, level = 1550, premium = 360}, {resets = 5, level = 1900, premium = 370}, {resets = 6, level = 2300, premium = 380}, {resets = 2^1024, level = 2700, premium = 990} } } function onSay(cid, words, param) local function getPlayerResets(cid) local resets = getPlayerStorageValue(cid, 500) return resets < 0 and 0 or resets end local function doPlayerAddResets(cid, count) setPlayerStorageValue(cid, 500, getPlayerResets(cid) + count) end if config.redskull and getCreatureSkullType(cid) == 4 then return doPlayerSendCancel(cid, "You need to be without red skull to reset.") elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then return doPlayerSendCancel(cid, "You need to be in protection zone to reset.") elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then return doPlayerSendCancel(cid, "You need to be without battle to reset.") end local resetLevel = 0 for x, y in ipairs(config.stages) do if getPlayerResets(cid) <= y.resets then resetLevel = isPremium(cid) and y.premium or y.level break end end if getPlayerLevel(cid) < resetLevel then return doPlayerSendCancel(cid, "Você precisa de nível " .. resetLevel .. " ou mais para resetar.") end doPlayerAddResets(cid, 1) local healthMax, manaMax = getCreatureMaxHealth(cid), getCreatureMaxMana(cid) doPlayerAddLevel(cid, -(getPlayerLevel(cid) - config.backToLevel)) setCreatureMaxHealth(cid, healthMax) setCreatureMaxMana(cid, manaMax) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Agora você tem " .. getPlayerResets(cid) .. " " .. (getPlayerResets(cid) == 1 and "reset" or "resets") .. ".") return true end
Postado Fevereiro 4, 2017 8 anos No seu look.lua da pasta creaturescripts/scripts coloque essa parte if isPlayer(thing.uid) then resets = getPlayerStorageValue(thing.uid, 500)+1 doPlayerSetSpecialDescription(thing.uid, "\nResets: [" .. resets .."]") end return true end
Postado Fevereiro 9, 2017 8 anos Autor Em 04/02/2017 em 22:50, Noob II disse: No seu look.lua da pasta creaturescripts/scripts coloque essa parte if isPlayer(thing.uid) then resets = getPlayerStorageValue(thing.uid, 500)+1 doPlayerSetSpecialDescription(thing.uid, "\nResets: [" .. resets .."]") end return true end eu n tenho esse script no meu creaturescripts/scripts tenho so o fraglook e tentei colocar so que n ouve nada function getPlayerFrags(cid) local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = {date = result:getDataInt("date")} if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = { day = table.maxn(contents.day), week = table.maxn(contents.week), month = table.maxn(contents.month) } return size.day + size.week + size.month end function onLogin(cid) registerCreatureEvent(cid, "fraglook") return true end function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..']') return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..']') local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'' if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.' end if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end agora do jeito que me pediu function getPlayerFrags(cid) local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = {date = result:getDataInt("date")} if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = { day = table.maxn(contents.day), week = table.maxn(contents.week), month = table.maxn(contents.month) } return size.day + size.week + size.month end function onLogin(cid) registerCreatureEvent(cid, "fraglook") return true end function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..']') return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..']') local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'' if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.' end if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if isPlayer(thing.uid) then resets = getPlayerStorageValue(thing.uid, 500)+1 doPlayerSetSpecialDescription(thing.uid, "\nResets: [" .. resets .."]") end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end Editado Fevereiro 9, 2017 8 anos por Thenebrozo (veja o histórico de edições)
Postado Fevereiro 9, 2017 8 anos function getPlayerFrags(cid) local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = {date = result:getDataInt("date")} if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = { day = table.maxn(contents.day), week = table.maxn(contents.week), month = table.maxn(contents.month) } return size.day + size.week + size.month end function getPlayerResets(cid) local resets = getPlayerStorageValue(cid, 500) return resets < 0 and 0 or resets end function onLogin(cid) registerCreatureEvent(cid, "fraglook") return true end function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..'] - [Resets: '..getPlayerResets(thing.uid)..']') return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..'] - [Resets: '..getPlayerResets(cid)..']') local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'' if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.' end if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end
Postado Fevereiro 9, 2017 8 anos qual seu tfs? e o protocolo? Editado Fevereiro 9, 2017 8 anos por Cleiton Felipi Errei :) (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.