MA
pedido

Ajuda A Arruma Esse Script

Por maiconskavurska, 14 de jun. de 2012 em Scripts

script
20
2.9k
14 de junho de 2012 às 07:10

Salve, Creio Que Estou Na Área Correta.

Bom, Eu Consegui Um Script De Reset Aqui Mesmo No Fórum...

Ele Está Funcionando Perfeitamente, Eu Só Queria Fazer Uns Ajuste Nele...

Eu Queria o Seguinte, Que Ao Resetar Que Ele Reset a Life e Mana Também e Que Fosse Promovido, Exemplo Royal Paladin Ao Resetar Ficaria Royal Paladin [1]

e Que o NPC Cobrasse 500k + X Item.

 

Se Alguém Puder Me Ajudar Agradeço.

 

 

-- config

minlevel = 25000 -- level para resetar

price = 500000 -- dinheiro para pagar ao resetar

newlevel = 30 -- level após reset

newexp = 368300 -- nova experiencia após reset

-- end config

function addReset(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,36874,resets+1)

return true

end

function getResets(cid)

resets = getPlayerStorageValue(cid,36874)

if resets < 0 then

resets = 0

end

return resets

end

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end

function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg, 'reset') then

selfSay('Do you want to reset your character level? Your character will be logged off if you confirm. You must pay '..price..' gold coins to reset.', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if getPlayerMoney(cid) < price then

selfSay('You must pay '..price..' gold coins to reset.', cid)

elseif getPlayerLevel(cid) < minlevel then

selfSay('You must be at least level '.. minlevel ..' to reset.', cid)

else

doPlayerRemoveMoney(cid,price)

addReset(cid)

playerid = getPlayerGUID(cid)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok.', cid)

elseif msgcontains(msg, 'resets') then

selfSay('You have '..getResets(cid)..' reset(s).', cid)

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Editado Junho 14 por Vilden

VildenV
14 de junho de 2012 às 07:14

Maicon, você bugou a script, quando usa CODE não pode fazer formatação dentro dele. Arrume.

sem formatação aqui dentro ouu [b]fomtação bugada[/b]

 

Agora sim.

Editado Junho 14 por Vilden

14 de junho de 2012 às 07:18

@Vilden

Editei, Agora Ta Correto ?

Você Edito La, Você Só Coloco Em Quote Ou Edito o Script Também ?

Editado Junho 14 por maiconskavurska

caoticC
14 de junho de 2012 às 16:03

-- config

local itemid= 2150 --item que vai precisar--

minlevel = 25000 -- level para resetar

price = 500000 -- dinheiro para pagar ao resetar

newlevel = 30 -- level após reset

newexp = 368300 -- nova experiencia após reset

local health = 25 --Vida que ele vai ficar

local mana = 25 ---Mana que ele vai ficar

 

local voc = {

["Paladin"] = {type = "Druid"},

["Sorcerer"] = {type = "Paladin"},

["Druid"] = {type = "Paladin"}

 

-------Modifica aki o que exemplo ["Vocaçao que ele"] = {type = "Vocaçao que ele transformara"} deixe a virgula no utlimo--------------

 

}

 

-- end config

function addReset(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,36874,resets+1)

setPlayerStorageValue(cid, 29826, getPlayerStorageValue(cid, 29826) +1)

return true

end

function getResets(cid)

resets = getPlayerStorageValue(cid,36874)

if resets < 0 then

resets = 0

end

return resets

end

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end

function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg, 'reset') then

selfSay('Do you want to reset your character level? Your character will be logged off if you confirm. You must pay '..price..' gold coins to reset.', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if not doPlayerRemoveItem(cid, itemid, 1) then

selfSay('Desculpe,Voce não tem o item necessario', cid)

return true

end

if getPlayerMoney(cid) < price then

selfSay('You must pay '..price..' gold coins to reset.', cid)

elseif getPlayerLevel(cid) < minlevel then

selfSay('You must be at least level '.. minlevel ..' to reset.', cid)

else

doPlayerRemoveMoney(cid,price)

addReset(cid)

setCreatureMaxHealth(cid, health)

setCreatureMaxMana(cid, mana)

doCreatureAddMana(cid, mana)

local vocacao = getPlayerVocation(cid)

doCreatureAddHealth(cid, health)

local name = getCreatureName(cid)

local transfvoc = voc[vocacao].type

doPlayerSetVocation(cid, transfvoc)

playerid = getPlayerGUID(cid)

local name = getCreatureName(cid)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok.', cid)

elseif msgcontains(msg, 'resets') then

selfSay('You have '..getResets(cid)..' reset(s).', cid)

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Editado Junho 14 por caotic

14 de junho de 2012 às 16:29

@caotic

Testei e Aconteceu o Seguinte

Player Reseta o Level a Life e Mana e Muda a Vocation

Só Que Ta Ficando Um Zero Na Frente Do Nome e Eu Não Quero Isso, e Se Você Puder Me Ensina a Mexer No Script (Tipo Mostra Onde Eu Ponho Pra Cada Vocation i Pra Sua Devida Promotion (Exemplo: Druid Reseta e Vira Elder Druid)) Porque Eu Testei Com Um Royal Paladin e Ele Viro Elite Knight.

Agradeço Deis De Já.

Obrigado.

caoticC
14 de junho de 2012 às 16:44

mais esta correto coloquei e so para saber quanto tempo o playerdeu reset.

14 de junho de 2012 às 16:58

@caotic

Exeplo: Player Royal Paladin Pegano Esse Reset Ele Vai Ranger

Eu Quero Por Vocation Porque a Cada Vocation Nova Que Ele Pegar Ele Vai Ganha Tudo Em Dobro Da Vocation Anterior, e Cada Vocation Druid, Sorc, Kina, Paladin Tem As Vocation Nova, Kina = Slayer, Sorc = Wyzard, Druid = Cleric, Paladin = Ranger...

 

Se Você Puder Arruma Pra Não Fica Os Numero No Nick e Puder Arruma Ele Pra Apenas Promove Do Druid Pra Elder Druid, As Vocations Normal e Me Explica Como Mudo As Vocation, Ai Eu Configuro Aqui.

 

Se Não Intende Só Pergunta Que Tarei Respondendo.

Se Não Der Pra Ajuda Suave.

Valeu Ai.

caoticC
14 de junho de 2012 às 17:40

ta ok refiz.

14 de junho de 2012 às 18:00

Deu Os Seguintes Erros

 

post-283854-0-40310400-1339707622_thumb.jpg

caoticC
14 de junho de 2012 às 18:08

Pensei que voce iria alterar a virgula como disse mais voce nao alterou agr eu alterei e esta funcionando.

14 de junho de 2012 às 18:26

Agora Está Com Esse Erro, Desculpa o Abuso é Que Eu Não Intendo Muito De Script ;/

 

post-283854-0-95169400-1339709191_thumb.jpg

caoticC
14 de junho de 2012 às 18:48

vc confundiu não e por palavra e por id

 

 

 

local voc = {

["8"] = {type = "10"},

 

 

entende eu so coloquei por nome pensando que ia te ajudar

 

Mais e por id XD

14 de junho de 2012 às 19:09

@caotic

La Vem Eu Com Mais Um Erro kkkk

Pelo Que Eu Apareceu Um Bagulho De Lib

Tenho Que Cria Algum Arquivo Na Pasta Lib ?

 

post-283854-0-17832700-1339711753_thumb.jpg

caoticC
14 de junho de 2012 às 19:28

Não tem erro o scripts foi testado so se voce esqeceu de tirar as reticencias deixa assim então que funfa:

 

local voc = {

[1] = {type = 14},

[2] = {type = 12},

[8] = {type = 10}

 

-------Modifica aki o que exemplo ["Vocaçao que ele"] = {type = "Vocaçao que ele transformara"} deixe a virgula no utlimo--------------

 

}

14 de junho de 2012 às 21:00

@caotic

Exemplo

 

local voc = {

[1] = {type = 5},

[2] = {type = 6},

[3] = {type = 7},

[4] = {type = 8}

 

-------Modifica aki o que exemplo ["Vocaçao que ele"] = {type = "Vocaçao que ele transformara"} deixe a virgula no utlimo--------------

 

}

 

 

Assim Posso Faze Isso ? kkkk