Ir para conteúdo

Problema Com Buyhouse


Sorokaba

Posts Recomendados

No config.lua do server tem la a opçao que diz o level necessário pra compra casa...blza...mas nao funciona, ele manda a mensagem apenas, mas se tiver o dinheiro compra mesmo assim...ou seja...Se você for level 100- e dar um !buyhouse vai aparecer que precisa level 100 e nao vai dar, Mas se tiver o dinheiro vai aparecer que precisa level 100 mas da...

Segue abaixo o script da talkaction

 

function onSay(cid, words, param)

 

local lookPos = getPlayerLookPos(cid)

local LEVEL = getConfigInfo("levelToBuyHouse")

local house = House.getHouseByPos(lookPos)

if(house == nil) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be looking to a house to buy one.")

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

if(house:buy(cid)) then

doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

else

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

end

 

if getPlayerLevel(cid) <LEVEL then

doPlayerSendCancel(cid, "You need level "..LEVEL.." to buy a house.")

return TRUE

end

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

Link para o comentário
Compartilhar em outros sites

antes

function onSay(cid, words, param)

 

local lookPos = getPlayerLookPos(cid)

local LEVEL = getConfigInfo("levelToBuyHouse")

local house = House.getHouseByPos(lookPos)

if(house == nil) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be looking to a house to buy one.")

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

if(house:buy(cid)) then

doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

else

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

end

 

if getPlayerLevel(cid) <LEVEL then

doPlayerSendCancel(cid, "You need level "..LEVEL.." to buy a house.")

return TRUE

end

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

depois

function onSay(cid, words, param)

 

local LEVEL = getConfigInfo("levelToBuyHouse")

local house = House.getHouseByPos(getPlayerLookPos(cid))

 

if(house == nil) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be looking to a house to buy one.")

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

elseif getPlayerLevel(cid) <LEVEL then

doPlayerSendCancel(cid, "You need level "..LEVEL.." to buy a house.")

return FALSE

elseif(house:buy(cid)) then

doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

return TRUE

else

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

a única coisa necessária era colocar a checagem de level antes do comando buyhouse(cid) e não depois, como constava no script... mas eu dei uma editada a nível de otimização ;)

Link para o comentário
Compartilhar em outros sites

tentou olhar no console ver se existia alguma msg de erro...

pode ser uma pergunta besta, mas está testando com um lvl maior que o lvl permitido?

 

bom... temos aqui um script q fazia errado mas pelo menos fazia alguma coisa

function onSay(cid, words, param)

 

local lookPos = getPlayerLookPos(cid)

local LEVEL = getConfigInfo("levelToBuyHouse")

local house = House.getHouseByPos(lookPos)

if(house == nil) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be looking to a house to buy one.")

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

if(house:buy(cid)) then

doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

else

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

end

 

if getPlayerLevel(cid) <LEVEL then

doPlayerSendCancel(cid, "You need level "..LEVEL.." to buy a house.")

return TRUE

end

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

segundo vc o problema era que ele vendia mesmo pra players abaixo do lvl permitido... então vamos jogar a checagem do lvl pra antes da venda da casa

 

function onSay(cid, words, param)

 

local lookPos = getPlayerLookPos(cid)

local LEVEL = getConfigInfo("levelToBuyHouse")

local house = House.getHouseByPos(lookPos)

if(house == nil) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be looking to a house to buy one.")

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

if getPlayerLevel(cid) <LEVEL then

doPlayerSendCancel(cid, "You need level "..LEVEL.." to buy a house.")

return TRUE

end

 

if(house:buy(cid)) then

doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

else

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

end

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, words)

return FALSE

end

 

se assim der certo, vamos às otimizações

 

function onSay(cid, words, param)

local level = getConfigInfo("levelToBuyHouse")

local house = House.getHouseByPos(getPlayerLookPos(cid))

local effect = CONST_ME_POFF

if getPlayerLevel(cid) < LEVEL then doPlayerSendCancel(cid, "You need level "..LEVEL.." to buy a house.")

elseif(house == nil) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be looking to a house to buy one.")

elseif(house:buy(cid)) then effect = CONST_ME_MAGIC_BLUE end

doSendMagicEffect(getThingPos(cid), effect)

return TRUE

end

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...