elseifa nie musisz zamykac?:$
Last edited:
elseifa nie musisz zamykac?:$
if
elseif
if
else
end
else -- nigdy nie sprawdzałem czy może być if->elseif->else ale pewnie może być
end
???
elseif -- nie ma if'a który by zaczynał
end -- zakończenie funkcji a nie if'a a tym bardziej elseif'a
LUA:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local st = { [1] = 0000, -- tu podajesz id itema ktory wylosujesz [2] = 0001, [3] = 0002 } local iditema = xxxx -- tu podajesz id itema ktory musisz przyniesc 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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local rand = st[math.random(1, #st)] if(msgcontains(msg, 'prezent')) then selfSay('Przyniosels mi co trzeba?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'tak') and talkState[talkUser] == 1) then if((getPlayerItemCount(cid, iditema) >= 20) == TRUE) then doPlayerAddItem(cid, rand) selfSay('ok :)', cid) else selfSay('nie masz tego co trza.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'nie') and talkState[talkUser] == 1) then selfSay('ok', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
A może tak, a może nie?
Może za trzy minuty lub za dwie? Zaczyna się przedstawienie Co będzie na arenie? - Ja nie wiem! Nie jestem pewien...
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local st =
{
[1] = 8888, -- tu podajesz id itema ktory wylosujesz
[2] = 2160,
[3] = 2472
}
local iditema = 6497 -- tu podajesz id itema ktory musisz przyniesc
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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local rand = st[math.random(1, #st)]
if(msgcontains(msg, 'prezent')) then
selfSay('Przyniosels mi co trzeba?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'tak') and talkState[talkUser] == 1) then
if((getPlayerItemCount(cid, iditema) >= 20) == TRUE) then
doPlayerAddItem(cid, rand)
selfSay('ok :)', cid)
else
selfSay('nie masz tego co trza.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'nie') and talkState[talkUser] == 1) then
selfSay('ok', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local st =
{
[1] = 8888, -- tu podajesz id itema ktory wylosujesz
[2] = 2160,
[3] = 2472,
[3] = 2160
}
local iditema = 6497 -- tu podajesz id itema ktory musisz przyniesc
local ilosc = 1
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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local rand = st[math.random(1, #st)]
if(msgcontains(msg, 'prezent')) then
selfSay('Przyniosels mi co trzeba?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'tak') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, iditema, ilosc) == TRUE) then
if rand == 4 then
cc = math.random(3, 10)
doPlayerAddItem(cid, rand, cc)
else
doPlayerAddItem(cid, rand)
end
selfSay('ok :)', cid)
else
selfSay('nie masz tego co trza.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'nie') and talkState[talkUser] == 1) then
selfSay('ok', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Nie znikają present bagi...
wklej tu skrypt ze wszystkimi id powpisywanymi już i napisz jaki błąd wywala w konsoli.
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local st =
{
[1] = 8888, -- tu podajesz id itema ktory wylosujesz
[2] = 2160,
[3] = 2472
}
local iditema = 6497 -- tu podajesz id itema ktory musisz przyniesc
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 = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local rand = st[math.random(1, #st)]
if(msgcontains(msg, 'prezent')) then
selfSay('Przyniosels mi co trzeba?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'tak') and talkState[talkUser] == 1) then
if((getPlayerItemCount(cid, iditema) >= 20) == TRUE) then
doPlayerAddItem(cid, rand)
selfSay('ok :)', cid)
else
selfSay('nie masz tego co trza.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'nie') and talkState[talkUser] == 1) then
selfSay('ok', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
function 1gem(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2158) = 1 then
if doPlayerRemoveItem(cid,2158,1) then
npcHandler:say('Take your reward!', cid)
doPlayerAddItem(cid,5910,1)
end
else
npcHandler:say('Are you trying to mess with me?!', cid)
end
end
function 2gem(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid,2158) = 2 then
if doPlayerRemoveItem(cid,2158,2) then
npcHandler:say('Take your reward!', cid)
doPlayerAddItem(cid,5910,2)
end
else
npcHandler:say('Are you trying to mess with me?!', cid)
end
end
function gem(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
local itemid = xxxx
local ilosc = getPlayerItemCount(cid,itemid)
if ilosc >= 1 then
if doPlayerRemoveItem(cid,2158,ilosc) then
npcHandler:say('Take your reward!', cid)
doPlayerAddItem(cid,5910,ilosc)
end
else
npcHandler:say('Are you trying to mess with me?!', cid)
end
end