• 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!

Need help with script

Blouzer

New Member
Joined
Aug 2, 2012
Messages
11
Reaction score
0
I need help with a script so it works on tfs4

thanks in advance

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end

function onThink() npcHandler:eek:nThink() 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

msg = string.lower(msg)


local config = {

[{"shovel","rope","backpack","riona"}] = {type = MAPMARK_SHOVEL, pos = {x=149,y=47,z=7}, name = "Riona\'s Tool Shop"},

[{"demon","demons"}] = {type = MAPMARK_TICK, pos = {x=133,y=38,z=7}, name = "Demons"}

}


for var, ret in pairs(config) do

for _, check in pairs(var) do

if msg == check then

type,pos,name = ret.type,ret.pos,ret.name

selfSay('Do you want me to add a mapmark '..msg..'? {yes}', cid)

talkState[talkUser] = 1

end

end

end

if(msgcontains(msg, 'yes') and talkState[talkUser] >= 1) then

doPlayerAddMapMark(cid, pos,type,name)

npcHandler:say('Here you are.', cid)

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and talkState[talkUser] >= 1) then

selfSay('Well then, hope you can find it yourself!', cid)

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

end

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())
 
If you can't create the npc ingame, it will show an error in your console, post that error.
Also use code tags and remove the enters between the lines.
 
Back
Top