Ir para conteúdo

Featured Replies

Postado

Esta dando esse erro ao executar !bless

bless.png

 

Script:

Spoiler

function onSay(cid, words, param)
local fail = 0
 
    if getPlayerLevel(cid) < 31 then
        cost = 2000
    else
        cost = ((getPlayerLevel(cid) - 30) * 200) + 2000
    end
   
    if cost > 20000 then
        cost = 20000
    end
 
    for i = 1, 5 do
        if getPlayerBlessing(cid, i) then
            fail = fail + 1
        else
            if doPlayerRemoveMoney(cid, cost) == TRUE then
                doPlayerAddBlessing(cid, i)
                if i == 5 and not(fail == 5) then
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
                end
            else
                doPlayerSendCancel(cid, "You do not have enough money to buy all the blessings!")
                break
            end
        end
    end
    if fail == 5 then
        doPlayerSendCancel(cid, "You already have all the blessings!")
    end
return TRUE
end
 

 

Me ajudem por favor :(

  • Respostas 11
  • Visualizações 833
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Esta é uma mensagem automática! Este tópico foi movido para a área correta. Pedimos que você leia as regras do fórum.  

Posted Images

Postado

Esta é uma mensagem automática! Este tópico foi movido para a área correta.
Pedimos que você leia as regras do fórum.

Spoiler

This is an automated message! This topic has been moved to the correct area.
Please read the forum rules.

 

Postado

a função getPlayerBlessing não existe no teu server ou tem outro nome.
descobre qual versão TFS ou outro você está usando, e baixa a lista de funções LUA.
google pode te ajudar nisso.

Postado
  • Autor

Essas funções no caso fica em algum lugar especifico amigo?, nas sources?

Bom amigo eu achei aqui, eu consegui entender, agora não dá mais erro, mas eu checkei na database e não esta adicionando as bless, eu percebi que no caso não esta executando a query slá pela script, aqui minha bless_system:

 

function RemovePlayerBlessing(cid)
mysqlQuery("UPDATE `players` SET `bless1` = '0',`bless2` = '0',`bless3` = '0',`bless4` = '0',`bless5` = '0' WHERE `name` = \"" .. getPlayerName(cid) .. "\"", "SET")
return true
end

function AddPlayerBlessing(cid, type)
local MGB = mysqlQuery("SELECT `bless1`, `bless2`, `bless3`, `bless4`, `bless5` FROM `players` WHERE `name` = '" .. getPlayerName(cid) .. "';", "bless1, bless2, bless3, bless4, bless5")
if type == 1 then
	if (MGB.bless1) == "0" then
		mysqlQuery("UPDATE `players` SET `bless1` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
		CheckPlayerBlessings(cid)
		return true
	else
	return false
	end
elseif type == 2 then
	if (MGB.bless2) == "0" then
		mysqlQuery("UPDATE `players` SET `bless2` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
		CheckPlayerBlessings(cid)
		return true
	else
	return false
	end
elseif type == 3 then
	if (MGB.bless3) == "0" then
		mysqlQuery("UPDATE `players` SET `bless3` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
		CheckPlayerBlessings(cid)
		return true
	else
	return false
	end
elseif type == 4 then
	if (MGB.bless4) == "0" then
		mysqlQuery("UPDATE `players` SET `bless4` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
		CheckPlayerBlessings(cid)
		return true
	else
	return false
	end
elseif type == 5 then
	if (MGB.bless5) == "0" then
		mysqlQuery("UPDATE `players` SET `bless5` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
		CheckPlayerBlessings(cid)
		return true
	else
	return false
	end	
end
end

 

Editado por Natan Fernandes (veja o histórico de edições)

Postado
14 horas atrás, Natan Fernandes disse:

Esta dando esse erro ao executar !bless

bless.png

 

Script:

  Ocultar conteúdo


function onSay(cid, words, param)
local fail = 0
 
    if getPlayerLevel(cid) < 31 then
        cost = 2000
    else
        cost = ((getPlayerLevel(cid) - 30) * 200) + 2000
    end
   
    if cost > 20000 then
        cost = 20000
    end
 
    for i = 1, 5 do
        if getPlayerBlessing(cid, i) then
            fail = fail + 1
        else
            if doPlayerRemoveMoney(cid, cost) == TRUE then
                doPlayerAddBlessing(cid, i)
                if i == 5 and not(fail == 5) then
                    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
                end
            else
                doPlayerSendCancel(cid, "You do not have enough money to buy all the blessings!")
                break
            end
        end
    end
    if fail == 5 then
        doPlayerSendCancel(cid, "You already have all the blessings!")
    end
return TRUE
end
 

 

Me ajudem por favor :(

Teste com esse:
 

local bless = {1, 2, 3, 4, 5}
local cost = 20000
function onSay(cid, words, param)
for i = 1, table.maxn(bless) do
if(getPlayerBlessing(cid, bless[i])) then
doPlayerSendCancel(cid, "Voceja tem todas as bless.")
return TRUE
end
end

if(doPlayerRemoveMoney(cid, cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerAddBlessing(cid, bless[i])
end
doCreatureSay(cid, "You are now blessed!" ,19)
doSendMagicEffect(getPlayerPosition(cid), 49)
else
doPlayerSendCancel(cid, "Voce precisa de 20k para a bless.")
end
return TRUE
end 

 

Feliz daquele que ensina o que sabe, e aprende o que ensina.

 

               

star-wars-animated-gif-23.gif

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo