kaspertje100
Member
- Joined
- May 8, 2008
- Messages
- 236
- Reaction score
- 7
Hi peeps,
I would like to ask you a favor!
So I get this error msg in my console: (using TFS 0.3.6)
and using this script:
To explain a lil more:
This script should make a person able to use flying system, the storage of flying system = 102015. But the npc should check if the player is VIP and have 10000 gold coins. Well golds coins I won't have to explain xD but ehm the storage ID of VIP == 10201.
IF someone could help I would be really pleased!
Yours,
Kasper
I would like to ask you a favor!
So I get this error msg in my console: (using TFS 0.3.6)
Code:
[Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Fly.lua
data/npc/scripts/Fly.lua:29: unexpected symbol near 'if'
and using this script:
Code:
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 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, 'fly')) then
selfSay('Do you want to learn to fly for 10000 gold coins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerStorageValue(uid, 10201) == -1 then
if(doPlayerRemoveMoney(cid, 10000)) then
setPlayerStorageValue(cid, 102015,1)
selfSay('You can now fly.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
elseif if getPlayerStorageValue(uid, 10201) == -1)) then
if(doPlayerRemoveMoney(cid, 10000)) then
setPlayerStorageValue(cid, 102015,1)
selfSay('You can now fly.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you aren\'t vip.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
To explain a lil more:
This script should make a person able to use flying system, the storage of flying system = 102015. But the npc should check if the player is VIP and have 10000 gold coins. Well golds coins I won't have to explain xD but ehm the storage ID of VIP == 10201.
IF someone could help I would be really pleased!
Yours,
Kasper