Forkz
Well-Known Member
- Joined
- Jun 29, 2020
- Messages
- 380
- Solutions
- 1
- Reaction score
- 89
Hello,
I need someone to help transform these scripts into TFS 1.2, below.
I need someone to help transform these scripts into TFS 1.2, below.
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
local items = {
item1 = {2177, 2168}
}
local counts = {
count1 = {1, 1}
}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'life crystal') then
selfSay('You want to swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.',cid)
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then
doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])
doPlayerAddItem(cid, items.item1[2], counts.count1[2])
selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)
talkState[talkUser] = 0
else
selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)
end
else
selSay('Ok then!', cid)
talkState[talkUser] = 0
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Attachments
-
otland.png7.4 KB · Views: 0 · VirusTotal