Ir para conteúdo
  • Cadastre-se

(Resolvido)Critical E Dodge no LOOK


Ir para solução Resolvido por MaTTch,

Posts Recomendados

Boa tarde galera , gostaria de adicionar ao lado de [Frags:0] no look do player [Critical:0] e [Dodge:0] Assim todos saberão a quantidade que um e outro possui para evitar acusações indevidas...

Link para o post
Compartilhar em outros sites
Agora, Fir3element disse:

como funciona seu sistema de critical/dodge? storage? database?

storage

creaturescripts/script/Critical 

local lvlcrit = 48913
local multiplier = 1.9
local effect = 16




function onStatsChange(cid, attacker, type, combat, value)
if (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isPlayer(attacker) and isCreature(cid) then
if (getPlayerStorageValue(attacker, lvlcrit)*1) >= math.random (0,1000) then
value = math.ceil(value*(multiplier))
doTargetCombatHealth(attacker, cid, combat, -value, -value, 255)
doSendMagicEffect(getCreaturePosition(cid), effect)
doSendAnimatedText(getCreaturePos(attacker), "Critical!", 35)
return false
end
end
return true
end

creaturescripts/script/Dodge

local lvldodge = 48902
local percent = 1.0


function onStatsChange(cid, attacker, type, combat, value)
if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS and isCreature(attacker) then
if (getPlayerStorageValue(cid, lvldodge)*3) >= math.random (0,1000) then
value = math.ceil(value*(percent))
doTargetCombatHealth(attacker, cid, combat, -value, -value, 255)
doSendAnimatedText(getCreaturePos(cid), "DODGE", 6)
return false
end
end
return true
end


Actions/script/Criticalrook
 

--- CRITICAL System by Night Wolf
   
  local config = {
   effectonuse = 14, -- efeito que sai
   levelscrit = 100,  --- leveis que terão
   storagecrit = 48913 -- storage que será verificado
   }
   
function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, config.storagecrit) < config.levelscrit then
   doRemoveItem(item.uid, 1)
doSendMagicEffect(topos,config.effectonuse)
doPlayerSendTextMessage(cid,22,"You've Leveled your Critical Skill to ["..(getPlayerStorageValue(cid, config.storagecrit)+1).."/"..config.levelscrit.."].")
setPlayerStorageValue(cid, config.storagecrit, getPlayerStorageValue(cid, config.storagecrit)+1)
elseif getPlayerStorageValue(cid, config.storagecrit) >= config.levelscrit then
doPlayerSendTextMessage(cid,22,"You've already reached the MAX level of Critical Skill.\nCongratulations!!!!")
    return 0
    end
return 1
end

actions/script/dodgestone
 

 local config = {
   effectonuse = 14, -- efeito que sai
   levelsdodge = 100,  --- leveis que terão
   storagedodge = 48902 -- storage que será verificado
   }
   
function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, config.storagedodge) < config.levelsdodge then
   doRemoveItem(item.uid, 1)
doSendMagicEffect(topos,config.effectonuse)
doPlayerSendTextMessage(cid,22,"You've Leveled your Dodge Skill to ["..(getPlayerStorageValue(cid, config.storagedodge)+1).."/100].")
setPlayerStorageValue(cid, config.storagedodge, getPlayerStorageValue(cid, config.storagedodge)+1)
elseif getPlayerStorageValue(cid, config.storagedodge) >= config.levelsdodge then
doPlayerSendTextMessage(cid,22,"You've already reached the MAX level of Dodge Skill.\nCongratulations!!!!")
    return 0
    end
return 1
end

Actions.xml
 

	<action itemid="8302" event="script" value="dodgestone.lua"/>
	<action itemid="8303" script="criticalrock.lua"/>

 

Link para o post
Compartilhar em outros sites
  • Moderador

Vou ver se consigo fazer aqui pra você.

actions/script/dodgestone

local config = {
   effectonuse = 14, -- efeito que sai
   levelsdodge = 100,  --- leveis que terão
   storagedodge = 48902 -- storage que será verificado
   }
   
function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, config.storagedodge) < config.levelsdodge then
   doRemoveItem(item.uid, 1)
doSendMagicEffect(topos,config.effectonuse)
doPlayerSendTextMessage(cid,22,"You've Leveled your Dodge Skill to ["..(getPlayerStorageValue(cid, config.storagedodge)+1).."/100].")
setPlayerStorageValue(cid, config.storagedodge, getPlayerStorageValue(cid, config.storagedodge)+1)
doPlayerSetSpecialDescription(cid,'\n[Dodge: '..config.storagedodge..']')
elseif getPlayerStorageValue(cid, config.storagedodge) >= config.levelsdodge then
doPlayerSendTextMessage(cid,22,"You've already reached the MAX level of Dodge Skill.\nCongratulations!!!!")
    return 0
    end
return 1
end

Testa esse, se funcionar me avise que faço o do critical.

Link para o post
Compartilhar em outros sites
Em 12/01/2017 ás 11:56, moviebr disse:

Vou ver se consigo fazer aqui pra você.

actions/script/dodgestone


local config = {
   effectonuse = 14, -- efeito que sai
   levelsdodge = 100,  --- leveis que terão
   storagedodge = 48902 -- storage que será verificado
   }
   
function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, config.storagedodge) < config.levelsdodge then
   doRemoveItem(item.uid, 1)
doSendMagicEffect(topos,config.effectonuse)
doPlayerSendTextMessage(cid,22,"You've Leveled your Dodge Skill to ["..(getPlayerStorageValue(cid, config.storagedodge)+1).."/100].")
setPlayerStorageValue(cid, config.storagedodge, getPlayerStorageValue(cid, config.storagedodge)+1)
doPlayerSetSpecialDescription(cid,'\n[Dodge: '..config.storagedodge..']')
elseif getPlayerStorageValue(cid, config.storagedodge) >= config.levelsdodge then
doPlayerSendTextMessage(cid,22,"You've already reached the MAX level of Dodge Skill.\nCongratulations!!!!")
    return 0
    end
return 1
end

Testa esse, se funcionar me avise que faço o do critical.

Desculpe a demora irei testar aqui.

@Forum 
Fala ai mano , não funcionou .... :(

Link para o post
Compartilhar em outros sites
  • Moderador
Em 14/01/2017 ás 00:16, moviebr disse:

Apareceu algum erro na distro?

 

R: Sem erros na distro desculpe a demora.

 

Em 14/01/2017 ás 00:35, MaTTch disse:

Manda seu script de look dos frags pra gente poder alterar.


Toma ai...
 

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

 

Link para o post
Compartilhar em outros sites
  • Solução
Spoiler

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)..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48913)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48902)) or 0))..']')
		return true
	elseif thing.uid == cid then
		doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(cid,48913)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(cid,48902)) or 0))..']')
		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

 

 

Link para o post
Compartilhar em outros sites
23 horas atrás, MaTTch disse:
  Ocultar conteúdo


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)..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48913)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48902)) or 0))..']')
		return true
	elseif thing.uid == cid then
		doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(cid,48913)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(cid,48902)) or 0))..']')
		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

 

 

Irei testar aqui!! REP++ PELA INICIATIVA DE AJUDA. 

Funcionou perfeitamente !!! OBGD REP++

Editado por Yago Blind. (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Manow, ta certo aparece no personagem o critical + dodge + frags. só que ao usar o dodge ou critical não conta no look. permanece em 0

@MaTTch

Editado por Feel Strung
atualizar a resposta (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
1 hora atrás, Feel Strung disse:

Manow, ta certo aparece no personagem o critical + dodge + frags. só que ao usar o dodge ou critical não conta no look. permanece em 0

@MaTTch

 

Reveja seus scripts, pois funcionou perfeitamente, tenho quase certeza de que é sua stronage ... não deve ser a mesma de minhas scripts...

Link para o post
Compartilhar em outros sites
  • 2 months later...
Em 22/01/2017 ás 19:32, Feel Strung disse:

Manow, ta certo aparece no personagem o critical + dodge + frags. só que ao usar o dodge ou critical não conta no look. permanece em 0

@MaTTch


é porque você precisa colocar as storages do critical e dodge que você utiliza no seu servidor.

Scriptszinhos:

 

Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.

Link para o post
Compartilhar em outros sites
Em 27/03/2017 ás 03:06, pablobion disse:


é porque você precisa colocar as storages do critical e dodge que você utiliza no seu servidor.

fiz substituição do scripts, porém não aparece no look..

troquei as storage também nem assim nenhum sina!

Link para o post
Compartilhar em outros sites
4 horas atrás, mateusmoretti disse:

fiz substituição do scripts, porém não aparece no look..

troquei as storage também nem assim nenhum sina!


você ja tem algum script utilizando look? tenta modificar... cara eu testei aqui e deu certo. você ta fazendo algo errado.

Scriptszinhos:

 

Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.

Link para o post
Compartilhar em outros sites
1 hora atrás, pablobion disse:


você ja tem algum script utilizando look? tenta modificar... cara eu testei aqui e deu certo. você ta fazendo algo errado.

sim eu subistui por esse que o cara fez, porém não aparece nem no look

ai troquei as storage nem assim também!

Link para o post
Compartilhar em outros sites
  • 10 months later...
On 20/01/2017 at 6:30 PM, Yago Blind. said:

Irei testar aqui!! REP++ PELA INICIATIVA DE AJUDA. 

Funcionou perfeitamente !!! OBGD REP++

 

tem como me falar qual lugar colocar esse scripts ? tipo assim  DATA / actions .? e oh lugar de substituir ?   

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo