Ir para conteúdo
  • Cadastre-se

[RESOLVIDO] -=[TFS]=- 0.3.6 - 8.60 - NPC Promotion ta Dando Erro no Console e Não Salva Vocação Fica de Primeira Com a Vocação Depois Quando Desloga e Loga Some Me Ajude Por Favor


Posts Recomendados

 

print( aparece isso --->

 

Player vocation set to

 

NPC/SCRIPT/PROMOTION.LUA

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

local vocation = {
    [2] = 6,
    [3] = 7,
    [4] = 8
}

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 = cid
    msg = string.lower(msg)
    local requiredLevel = 717217
    local vipCoinsItemId = 11192
    local requiredVipCoins = 100

    if isInArray({"promotion", "promot", "promo"}, msg) then
        selfSay('You need to have a premium account, 100 [VIP COINS], and be at level 717217!', cid)
        talkState[talkUser] = 1
    elseif msg == "yes" and talkState[talkUser] == 1 then
        local playerVocation = getPlayerVocation(cid)
        if vocation[playerVocation] then
            if isPremium(cid) then
                if getPlayerLevel(cid) >= requiredLevel then
                    if getPlayerItemCount(cid, vipCoinsItemId) >= requiredVipCoins then
                        doPlayerRemoveItem(cid, vipCoinsItemId, requiredVipCoins)
                        local newVocationId = vocation[playerVocation]
                        doPlayerSetVocation(cid, newVocationId)
                        doSendMagicEffect(getPlayerPosition(cid), 12)
                        selfSay("Congratulations, you have been promoted!", cid)
                    else
                        selfSay("You do not have enough [VIP COINS] to be promoted.", cid)
                    end
                else
                    selfSay("Sorry, you need to be at level 717217 or higher to be promoted!", cid)
                end
            else
                selfSay("Sorry, you need to be a premium player to be promoted.", cid)
            end
        else
            selfSay("Sorry, you cannot receive promotion.", cid)
        end
        talkState[talkUser] = 0
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

VOCATION.XML

<?xml version="1" encoding="UTF-8"?>
<vocations>
                <vocation id="0" name="None" description="none" needpremium="0" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="0" soulmax="255" gainsoulticks="1" basespeed="1" fromvoc="0" attackable="no">
		<formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
		<skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="1"/>
	</vocation>
	<vocation id="1" name="nil" description="nil" needpremium="0" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="4" gainmanaamount="1" manamultiplier="1" attackspeed="1500" soulmax="100" gainsoulticks="1" basespeed="100" fromvoc="nil">
		<formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
		<skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="1"/>
	</vocation>
        <vocation id="2" name="Mage" description="Mage" needpremium="0" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="1500" soulmax="100" gainsoulticks="1" basespeed="100" fromvoc="2">
                <formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
                <skill fist="1" club="1" sword="1.8" axe="1" distance="1" shielding="1" fishing="1" experience="99999"/>
        </vocation>
        <vocation id="3" name="Paladin" description="Paladin" needpremium="0" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="1500" soulmax="100" gainsoulticks="1" basespeed="100" fromvoc="3">
                <formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
                <skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="99999"/>
        </vocation>
        <vocation id="4" name="Knight" description="Knight" needpremium="0" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="1500" soulmax="100" gainsoulticks="1" basespeed="100" fromvoc="4">
                <formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
                <skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="99999"/>
        </vocation>
	<vocation id="5" name="nil" description="nil" needpremium="0" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="1500" soulmax="1" gainsoulticks="1" basespeed="100" lessloss="0" fromvoc="nil">
		<formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
		<skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="1"/>
	</vocation>
        <vocation id="6" name="[VIP] Mage" description="[VIP] Mage" needpremium="1" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="0" soulmax="255" gainsoulticks="1" basespeed="220" fromvoc="2" lessloss="0">
                <formula mleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
                <skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="100000"/>
        </vocation>
 	<vocation id="7" name="[VIP] Paladin" description="[VIP] Paladin" needpremium="1" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="0" soulmax="255" gainsoulticks="1" basespeed="220" fromvoc="3" lessloss="0">
                <formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
                <skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="100000"/>
        </vocation>
        <vocation id="8" name="[VIP] Knight" description="[VIP] Knight" needpremium="1" gaincap="1" gainhp="1" gainmana="1" gainhpticks="1" gainhpamount="1" gainmanaticks="1" gainmanaamount="1" manamultiplier="1" attackspeed="0" soulmax="255" gainsoulticks="1" basespeed="220" fromvoc="4" lessloss="0">
                <formula meleeDamage="1" distDamage="1" wandDamage="1" magDamage="1" magHealingDamage="1" defense="1" magDefense="1" armor="1"/>
                <skill fist="1" club="1" sword="1" axe="1" distance="1" shielding="1" fishing="1" experience="100000"/>
        </vocation>
</vocations>



data/npc/scripts/promotion.lua:15: in function <data/npc/scripts/promotion.lua:15>

[20/07/2024 08:57:34] [Error - Npc interface] 
[20/07/2024 08:57:34] data/npc/scripts/promotion.lua:onThink
[20/07/2024 08:57:34] Description: 
[20/07/2024 08:57:34] (luaGetNpcDistanceTo) Thing not found

[20/07/2024 08:57:34] [Error - Npc interface] 
[20/07/2024 08:57:35] data/npc/scripts/promotion.lua:onThink
[20/07/2024 08:57:35] Description: 
[20/07/2024 08:57:35] (luaGetCreatureName) Creature not found

[20/07/2024 08:57:35] [Error - Npc interface] 
[20/07/2024 08:57:35] data/npc/scripts/promotion.lua:onThink
[20/07/2024 08:57:35] Description: 
[20/07/2024 08:57:35] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #3 to 'gsub' (string/function/table expected)
[20/07/2024 08:57:35] stack traceback:
[20/07/2024 08:57:35] 	[C]: in function 'gsub'
[20/07/2024 08:57:35] 	data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
[20/07/2024 08:57:35] 	data/npc/lib/npcsystem/npchandler.lua:538: in function 'onWalkAway'
[20/07/2024 08:57:35] 	data/npc/lib/npcsystem/npchandler.lua:473: in function 'onThink'
[20/07/2024 08:57:35] 	data/npc/scripts/promotion.lua:15: in function <data/npc/scripts/promotion.lua:15>

 

Editado por Muvukaa (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Muvukaa mudou o título para [RESOLVIDO] -=[TFS]=- 0.3.6 - 8.60 - NPC Promotion ta Dando Erro no Console e Não Salva Vocação Fica de Primeira Com a Vocação Depois Quando Desloga e Loga Some Me Ajude Por Favor

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo