TH
pedido

So da use quem e de x vocação

Por TheSource, 31 de mar. de 2013 em Scripts

resolvido
script
12
1.4k
TheSourceT
31 de março de 2013 às 02:02

Preciso que alguém me ajude a modificar esse script, para que so a vocação de id "x" possa da use nele, script abaixo.

function onUse(cid, item, frompos, item2, topos)
local monstro = getItemAttribute(item.uid, "corpse")
local health = getItemAttribute(item.uid, "health")
local name = getItemAttribute(item.uid, "monstro")
if #getCreatureSummons(cid) > 3 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ja esta usando uma reencarnação ou um pet")
return true
end
if getPlayerMana(cid) < health/100*70 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem chakra suficiente")
return true
end
if getPlayerStorageValue(cid, 24436) == 1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode invocar mais de reanimação junto.")
return true
end
t = doCreateMonster(monstro, getThingPos(cid))
doConvinceCreature(cid, t)
setCreatureMaxHealth(t, health)
doCreatureAddHealth(t, health)
doPlayerAddMana(t, -getItemAttribute(item.uid, "health")/90)
setPlayerStorageValue(cid, 24436, name)
return true[/b]
[b]end
PsyMcKenzieP
31 de março de 2013 às 03:34

Tenta assim:

 

 

function onUse(cid, item, frompos, item2, topos)
local monstro = getItemAttribute(item.uid, "corpse")
local health = getItemAttribute(item.uid, "health")
local name = getItemAttribute(item.uid, "monstro")
local vocationUse = {4, 8} -- poem a vocação e a promotion

if getCreatureSummons(cid) > 3 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ja esta usando uma reencarnação ou um pet")
return true
end
if getPlayerMana(cid) < health/100*70 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem chakra suficiente")
return true
end
if getPlayerStorageValue(cid, 24436) == 1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode invocar mais de reanimação junto.")
return true
end
if getPlayerVocation(cid) ~= 4 or getPlayerVocation(cid) ~= 8 then
doPlayerSendTextMessage(cid,22,"Você não tem a vocação apropriada")		  
return TRUE			  
end

t = doCreateMonster(monstro, getThingPos(cid))
doConvinceCreature(cid, t)
setCreatureMaxHealth(t, health)
doCreatureAddHealth(t, health)
doPlayerAddMana(t, -getItemAttribute(item.uid, "health")/90)
setPlayerStorageValue(cid, 24436, name)
return true
end

 

Aqui você edita a vocação que irá usar:

 

local vocationUse = {4, 8} -- poem a vocação e as promotions

 

E aqui:

 

if getPlayerVocation(cid) ~= 4 or getPlayerVocation(cid) ~= 8 then

Editado Março 31 por PsyMcKenzie

TheSourceT
31 de março de 2013 às 04:20

Edit: n7V0yyS.png?1

Editado Março 31 por TheSource

dalvorsnD
31 de março de 2013 às 11:31
function onUse(cid, item, frompos, item2, topos)
local monstro = getItemAttribute(item.uid, "corpse")
local health = getItemAttribute(item.uid, "health")
local name = getItemAttribute(item.uid, "monstro")
local vocationUse = {4, 8} -- poem a vocação e a promotion
if #getCreatureSummons(cid) > 3 then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ja esta usando uma reencarnação ou um pet")
 return true
end
if getPlayerMana(cid) < health/100*70 then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem chakra suficiente")
 return true
end
if getPlayerStorageValue(cid, 24436) == 1 then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode invocar mais de reanimação junto.")
 return true
end
if isInArray(vocationUse, getPlayerVocation(cid)) then
 doPlayerSendTextMessage(cid,22,"Você não tem a vocação apropriada")			  
 return TRUE					  
end
t = doCreateMonster(monstro, getThingPos(cid))
doConvinceCreature(cid, t)
setCreatureMaxHealth(t, health)
doCreatureAddHealth(t, health)
doPlayerAddMana(t, -getItemAttribute(item.uid, "health")/90)
setPlayerStorageValue(cid, 24436, name)
return true
end

drakylucasD
31 de março de 2013 às 12:11

dalvorsn ta errado, vc ta colocando erro se for da vocação ^^

 

tente assim:

function onUse(cid, item, frompos, item2, topos)
local monstro = getItemAttribute(item.uid, "corpse")
local health = getItemAttribute(item.uid, "health")
local name = getItemAttribute(item.uid, "monstro")
local vocationUse = {4, 8} -- poem a vocação e a promotion
if #getCreatureSummons(cid) > 3 then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ja esta usando uma reencarnação ou um pet")
 return true
end
if getPlayerMana(cid) < health/100*70 then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem chakra suficiente")
 return true
end
if getPlayerStorageValue(cid, 24436) == 1 then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode invocar mais de reanimação junto.")
 return true
end
if not isInArray(vocationUse, getPlayerVocation(cid)) then
 return doPlayerSendTextMessage(cid,22,"Você não tem a vocação apropriada")					                                 
end
t = doCreateMonster(monstro, getThingPos(cid))
doConvinceCreature(cid, t)
setCreatureMaxHealth(t, health)
doCreatureAddHealth(t, health)
doPlayerAddMana(t, -getItemAttribute(item.uid, "health")/90)
setPlayerStorageValue(cid, 24436, name)
return true
end

 

(só coloquei o not, de resto tava certo)

TheSourceT
31 de março de 2013 às 13:46

deu limite de rep, assim que libera venho no tópico e dou rep aos 3, muito obrigado pela ajuda.

Editado Março 31 por TheSource

PsyMcKenzieP
31 de março de 2013 às 19:20

Deu certo mano?

TheSourceT
31 de março de 2013 às 21:47

Sim funcionou :)

PsyMcKenzieP
31 de março de 2013 às 22:30

Reportado para moverem!

Qualquer coisa posta ae, que a gente tenta ajudar.

TheSourceT
31 de março de 2013 às 23:07

Ok, todas minah duvidas terminaram so esperando liberar, para poder passa o rep do dalvorsn ^^

BananaFightB
02 de abril de 2013 às 13:36

Tópico movido para a seção de dúvidas e pedidos resolvidos.

4 meses depois...
markindootM
24 de agosto de 2013 às 19:52

posta a tag ae