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

Solved Help NPC boat, teleport dont work?

gmstrikker

Well-Known Member
Joined
Jul 30, 2014
Messages
458
Solutions
1
Reaction score
50
Why dont work? SV 0.4 (8.60)
Dont erros on console
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)   
NpcSystem.parseParameters(npcHandler)
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
local position = {
   city  = {x= 1363, y=1839, z=6},
   firstisland = {x= 777, y=1612, z=6},
   secondisland  = {x= 829, y=1643, z=7},
   thirdisland  = {x= 792, y=1584, z=7}
}

local msgerror = 'You need Premium Account or VIP.'
local travel = 'You can go to {city}, {first island}, {second island}, {third island}'
if(msgcontains(msg, 'travel')) then  
     doPlayerSendTextMessage(cid, MESSAGE_FIRST, travel)
elseif(msgcontains(msg, 'city')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
  doTeleportThing(cid, position.city)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   
elseif (msgcontains(msg, 'first island')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
  doTeleportThing(cid, position.firstisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   
elseif (msgcontains(msg, 'second island')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
  doTeleportThing(cid, position.secondisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   
elseif (msgcontains(msg, 'third island')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
  doTeleportThing(cid, position.thirdisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   

end
return true
end   
   

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Code:
if getPlayerStorageValue(cid, 666) < os.time() or isPremium(cid) == FALSE then
Use and instead of or, else if 1 of them is true, so if someone is not vip or not premium, it will give that message instead of teleporting the player (which means players need to be both).
 
Oh! Ty, but the problem isnt it, its a normal error

But my error is: When i say:
travel or first island

NPC dont say nothing, and idk why!
 
The player receives a textmessage instead of an npc message.
Code:
doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
If it should be an npc message, you can use selfSay instead.
Code:
selfSay(msgerror, cid)
 
Sorry to long time Limos, my internet back today
Now its work!

If one people need script working is it:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)   
NpcSystem.parseParameters(npcHandler)
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
local position = {
   city  = {x= 1363, y=1839, z=6},
   firstisland = {x= 777, y=1612, z=6},
   secondisland  = {x= 829, y=1643, z=7},
   thirdisland  = {x= 792, y=1584, z=7}
}

local msgerror = 'You need Premium Account or VIP.'
local travel = 'You can go to {city}, {first island}, {second island}, {third island}'
if(msgcontains(msg, 'travel')) then  
     selfSay(travel, cid)
elseif(msgcontains(msg, 'city')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.city)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   
elseif (msgcontains(msg, 'first island')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.firstisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   
elseif (msgcontains(msg, 'second island')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.secondisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   
elseif (msgcontains(msg, 'third island')) then  
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.thirdisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
   

end
return true
end   
   

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

---

Limos can u help me?

I wanted to do a boat trap, every time the player travels up it would have 1% chance go to this boat in position X = 1000 Y = 1000 Z = 7
 
have fun :)
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)  
NpcSystem.parseParameters(npcHandler)
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

local position = {
   city  = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 1363, y=1839, z=6},
   firstisland = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 777, y=1612, z=6},
   secondisland  = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 829, y=1643, z=7},
   thirdisland  = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 792, y=1584, z=7}
}

local msgerror = 'You need Premium Account or VIP.'
local travel = 'You can go to {city}, {first island}, {second island}, {third island}'
if(msgcontains(msg, 'travel')) then 
     selfSay(travel, cid)
elseif(msgcontains(msg, 'city')) then 
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.city)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
  
elseif (msgcontains(msg, 'first island')) then 
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.firstisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
  
elseif (msgcontains(msg, 'second island')) then 
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.secondisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
  
elseif (msgcontains(msg, 'third island')) then 
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.thirdisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
  

end
return true
end  
  

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
have fun :)
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler)
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

local position = {
   city  = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 1363, y=1839, z=6},
   firstisland = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 777, y=1612, z=6},
   secondisland  = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 829, y=1643, z=7},
   thirdisland  = math.random(10) == 1 and {x= 1000, y=1000, z=7} or {x= 792, y=1584, z=7}
}

local msgerror = 'You need Premium Account or VIP.'
local travel = 'You can go to {city}, {first island}, {second island}, {third island}'
if(msgcontains(msg, 'travel')) then
     selfSay(travel, cid)
elseif(msgcontains(msg, 'city')) then
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.city)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
 
elseif (msgcontains(msg, 'first island')) then
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.firstisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
 
elseif (msgcontains(msg, 'second island')) then
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.secondisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
 
elseif (msgcontains(msg, 'third island')) then
   if getPlayerStorageValue(cid, 666) < os.time() and isPremium(cid) == FALSE then
     selfSay(msgerror, cid)
   else
  doTeleportThing(cid, position.thirdisland)
  doSendMagicEffect(getPlayerPosition(cid), 11)
  return true
  end
 

end
return true
end 
 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Isnt it, but thank you to function random, now i dont need help, i will make my script
ty guys <3
 
Back
Top