• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC, Sprzedaż Viali.

Niestety, nie mogę jakoś znaleźć tego, wiesz może jak owa funkcja się nazywa?

Edit"
chyba znalazłem;p "isPzLocked(cid)"
 
Last edited:
Witam, Wie ktoś jak zrobić aby npc nie rozróżniał czy ktoś pisze z małej czy dużej litery?

Np jak napisze 'fire sword' -> odpowie a jak napisze 'Fire sword' to już nie, jak zrobić aby npc
odpisywał nie ważne z jakiej litery napisze?
 
do npc.lua w npc lib:
Code:
function msgcontains(message, keyword)
	local a, b = string.find(message:lower(), keyword)
	if a == nil or b == nil then
		return false
	end
	return true
end
 
Niestety , nie chodzi mi to;\

Tutaj jest skrypt, może coś mam źle?

Lua:
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 greetCallback(cid)
    -- Resetting talkState[talkUser]
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    talkState[talkUser] = 0
    return true
end


function msgcontains(txt, str)
    return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
 
 
 function creatureSayCallback (cid, type, msg)
    
    if(npcHandler.focus ~= cid) then
        return false
    end
    
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    
    
    
     if msgcontains(msg,"fire sword") or msgcontains(msg, 'bright word') or msgcontains(msg, 'sword of valor') or msgcontains(msg, "serpent sword") or msgcontains(msg, "enchanted plate") or msgcontains(msg, "dragon shield") then
        name = msg
        npcHandler:say('Do lil\' one want to trade a '.. msg ..'?')
        talkState[talkUser] = 1
        
    elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
    npcHandler:say('You not have stuff me want for.')
    talkState[talkUser] = 1
    
    elseif msgcontains(msg,msg) and  talkState[talkUser] == 1 then
    npcHandler:say('Silly lil\' one you are.')
    talkState[talkUser] = 0
        
        
    end
    
    
    
    return true
end
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited by a moderator:
Back
Top