• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

What is wrong with that piece of script?

Zonkill

Banned User
Joined
Oct 10, 2010
Messages
102
Reaction score
1
Hey,
I have NPC which 'have' missions for players, and this mission is bugged.. what is the problem?

Code:
if(msgcontains(msg, 'fourth')) then
selfSay('Hey, again you. This time i want to ask you for collect 100 blueberries. See, my sister really loves {blueberries}, and she is really sad last time. I hope that will make her little happy', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'blueberries') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,102) < 1) then
selfSay('Have you arleady 100 blueberries?.', cid)
else
if (getPlayerStorageValue(cid,103) > 0) then
selfSay('Sorry, but you arleady did this mission!', cid)
else
if(doPlayerRemoveItem(cid, item4, 100) == TRUE) then
setPlayerStorageValue(cid,103,1)
doPlayerAddExperience(cid,10000)
selfSay('Thanks for blueberries. (10000exp up)', cid)
else
selfSay('I need 100 blueberries.', cid)
end
end
end
return true
end

Code:
17:25 GM[1]: fourth
17:25 Gandalf: Hey, again you. This time i want to ask you for collect 100 blueberries. See, my sister really loves blueberries, and she is really sad last time. I hope that will make her little happy
17:25 GM [1]: blueberries
17:25 Gandalf: Have you arleady 100 blueberries?.
17:25 GM [1]: blueberries
17:25 Gandalf: Have you arleady 100 blueberries?.
 
LUA:
local storage = 24351 --Storage used
local itemi = 1111 --Blue berry ID
if(msgcontains(msg, 'fourth')) then
    selfSay('Hey, again you. This time i want to ask you for collect 100 blueberries. See, my sister really loves {blueberries}, and she is really sad last time. I hope that will make her little happy', cid)
    setPlayerStorageValue(cid, storage, 1)
elseif(msgcontains(msg, 'blueberries') and getPlayerStorageValue(cid, storage) == 1) then
    selfSay('Have you arleady 100 blueberries?', cid)
    talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
    if doPlayerRemoveItem(cid, itemi, 100) == TRUE then
        doCreatureSay(cid, "Thanks for blueberries. (10000exp up)", TALKTYPE_ORANGE_1)
        setPlayerStorageValue(cid, storage, 2)
        doPlayerAddExperience(cid,10000)
    else
        doCreatureSay(cid, "I have only "..getPlayerItemCount(cid, itemi).."/100 blueberries.", TALKTYPE_ORANGE_1)
    end
elseif(msgcontains(msg, 'fourth') and getPlayerStorageValue(cid, storage) == 2) then
    selfSay('Sorry, but you arleady did this mission!', cid)
end
return 1
end
Haven't tested, trying to remember how to script :D
 
Back
Top