BE
dúvida

Script Ao Matar 1 Player Ganhar Skill De First E +

Por beddy, 09 de jun. de 2012 em Scripts

script
7
1.5k
beddyB
09 de junho de 2012 às 16:49

Queria um script, que ao matar 1 player, o player que matou ganha +1 skill de first...

E

queria outro script que ao morrer, voce ganha +1 skill de club...

 

peguei uma funcao, adicionei lib

function doPlayerSetSkill(cid, skill, amount)
local pid = getPlayerGUID(cid)
doRemoveCreature(cid,true)
db.executeQuery("UPDATE `player_skills` SET `value` = ".. amount .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. skill ..";")
return TRUE
end
function doPlayerSetMagic(cid, amount)
local pid = getPlayerGUID(cid)
doRemoveCreature(cid,true)
db.executeQuery("UPDATE `players` SET `maglevel` = " .. amount .. " WHERE `id` = "..pid)
return TRUE
end

 

e usei este script,

 

function onKill(cid, target)
           if isPlayer(cid) and isPlayer(target) then
doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST)+1)
           end
           return true
end
function onPrepareDeath(cid, deathList)
           if isPlayer(deathList[1]) then
 doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB)+1)
           end
           return true
end

 

PROBLEMAS:

* o char nao morre... ele fica sem a barra de life e mana e nao morre!

* o player que mata, nao ganha o skill de fist..

 

Alguem me ajuda!

Editado Junho 13 por beddy

OneshotO
09 de junho de 2012 às 17:09

skills.lua em data/creaturescripts/scripts

function onKill(cid, target)
if isPlayer(cid) and isPlayer(target) then
	doPlayerAddSkill(cid, SKILL_FIST, 1, true)
end
return true
end

function onPrepareDeath(cid, deathList)
if isPlayer(deathList[1]) then
	doPlayerAddSkill(cid, SKILL_CLUB, -1, true)
end
return true
end

 

creaturescripts.xml

<event type="kill" name="FistSkill" event="script" value="skills.lua"/>
<event type="preparedeath" name="ClubSkill" event="script" value="skills.lua"/>

 

login.lua* (data/creaturescripts/scripts)

registerCreatureEvent(cid, "FistSkill")
registerCreatureEvent(cid, "ClubSkill")

 

Antes de:

 

return true

 

No caso de perder skills, estou fazendo um teste, caso não funcione, farei através de uma query no banco de dados.

beddyB
09 de junho de 2012 às 20:30

Oneshot, nao pegou aqui no meu sv nao...

 

someone help please

 

UP!

 

up

OneshotO
09 de junho de 2012 às 20:38

beddy,

 

Não adianta falar que não pegou? Há algum erro no console? Função que não existe?

Editado Junho 9 por Oneshot

beddyB
13 de junho de 2012 às 12:15

Nao, nao pegou, nao deu mensagem no console, e nao deu nada!

Isso que achei estranho!?

 

up

 

up

 

up, peguei uma funcao, adicionei lib

function doPlayerSetSkill(cid, skill, amount)
local pid = getPlayerGUID(cid)
doRemoveCreature(cid,true)
db.executeQuery("UPDATE `player_skills` SET `value` = ".. amount .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. skill ..";")
return TRUE
end
function doPlayerSetMagic(cid, amount)
local pid = getPlayerGUID(cid)
doRemoveCreature(cid,true)
db.executeQuery("UPDATE `players` SET `maglevel` = " .. amount .. " WHERE `id` = "..pid)
return TRUE
end

 

e usei este script,

 

function onKill(cid, target)
    if isPlayer(cid) and isPlayer(target) then
doPlayerSetSkill(cid, SKILL_FIST, getPlayerSkillLevel(cid, SKILL_FIST)+1)
    end
    return true
end
function onPrepareDeath(cid, deathList)
    if isPlayer(deathList[1]) then
 doPlayerSetSkill(cid, SKILL_CLUB, getPlayerSkillLevel(cid, SKILL_CLUB)+1)
    end
    return true
end

 

porem ocoreram alguns bugs, como por exemplo, o char nao morre... ele fica sem a barra de life e mana e nao morre! e o player que mata, nao ganha o skill..

Tem como ajudar?

 

UP NENEM, AJUDA AI !

 

eae amores ajudai ai

 

Alguem ajuda ae!

 

upping!

 

Ninguem pode me ajudar mans?!

 

AJUDA AI GENTE, NINGUEM SABE?!

ErimythE
13 de junho de 2012 às 12:48

em pedido do Beedy o tópico sera fechado e movido.

foi modificado de "pedido" para "duvida" assim como ele tbm pediu pelo report.

Tópico Fechado.

VildenV
13 de junho de 2012 às 12:48

Autor do tópico pediu para mover, irei pedir para ele postar a solução.

obs; ja tinha movido e alertado ao autor que ele pode editar o tópico como bem quiser, abç

Editado Junho 13 por Vilden