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

Help npc - lvl

szajker123

New Member
Joined
May 12, 2012
Messages
195
Reaction score
0
Hi, I found the forum script that after giving the NPC gives itemu item / only I've done features
PHP:
doPlayerAddLevel(cid, 1, round)
only that something does not work when I have 10 items of this writing
PHP:
selfSay('You dont have enought tokens!', cid)
but i need here with 10 items ..
PHP:
if getPlayerItemCount(cid,1) >= 10 then
            doPlayerRemoveItem(cid,11877,10)
Does anyone help? REP + + + for your help!

here's the entire script
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, 'lvl') or msgcontains(msg, '10 meat')) then
if getPlayerItemCount(cid,1) >= 10 then
doPlayerRemoveItem(cid,11877,10)
selfSay('Okey, here you are!', cid)
doPlayerAddLevel(cid, 1, round)
talkState[talkUser] = 0

else
selfSay('You dont have enought tokens!', cid)
talkState[talkUser] = 0
end

elseif(msgcontains(msg, 'offer')) then
selfSay('Here is my offer:', cid)
selfSay('10 tokens = lvl', cid)
selfSay('15 tokens = lvl', cid)
selfSay('20 tokens = lvl', cid)
end



return true

end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
I don't think that the scripts works like you want it to work but answering to your question:
LUA:
if getPlayerItemCount(cid,1) >= 10 then
            doPlayerRemoveItem(cid,11877,10)
doPlayerRemoveItem(cid,11877,10) -- you need to add here the ID of your tokens (i don't know which tokens you are using - 6527 Christmas tokens/9020 Vampire Lord tokens), but 11877 is a piece of bridge (on distro that i am using).

But i think your script is unfinished, i don't think it will work for:
LUA:
elseif(msgcontains(msg, 'offer')) then
 selfSay('Here is my offer:', cid)
 selfSay('10 tokens = lvl', cid)
 selfSay('15 tokens = lvl', cid)
 selfSay('20 tokens = lvl', cid)
 end
 
hmmm .. on my server does not bridge only meat I gave it so, for example, if you could and you remade this script to work? or who has any .. Please help
Rep + + + + + + using
Regards
 
he just used a different script because I had the mission: D and i did not give the prize only level! Thanks for that you tried to help me I have given you a reputation: P (PLEASE CLOSE TOPIC)
 
Back
Top