• 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 a Talkaction

The Mapper

Just Imagine
Joined
Jul 22, 2009
Messages
182
Reaction score
2
Hello OTland, can anybody make me a talkaction so that when players under lvl 50 say !temple they get teleported to their corresponding city? PZ Lock pls.
 
Solution
Ok i was helping The Mapper in pm

here is the final script for 0.3.6 if anyone wants it, now it should ignore battle lock if you are inside pz zone
Code:
function onSay(cid, words, param)
local playerPos = getCreaturePosition(cid)

   if getTilePzInfo(playerPos) then
       doSendMagicEffect(playerPos, CONST_ME_POFF)
       doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
       return true
   end
   
   if getCreatureCondition(cid, CONDITION_INFIGHT) then
       doCreatureSay(cid, 'You are in combat', TALKTYPE_MONSTER) -- remove this line if you dont want text in default chat
       doSendMagicEffect(playerPos, CONST_ME_POFF)
   return true
   end...
1.1+
Code:
function onSay(player, words, param)
    local playerPos = player:getPosition()
    if player:isPzLocked() then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'You are PZ locked.')
        playerPos:sendMagicEffect(CONST_ME_POFF)
        return true
    end
    if player:getLevel() > 50 then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'You must be level 50 or below to use this command.')
        playerPos:sendMagicEffect(CONST_ME_POFF)
        return true
    end
    player:teleportTo(player:getTown():getTemplePosition())
    return true
end

0.3.6/0.4
Code:
function onSay(cid, words, param)
    local playerPos = getCreaturePosition(cid)
    if isPlayerPzLocked(cid) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You are PZ locked.')
        doSendMagicEffect(playerPos, CONST_ME_POFF)
        return true
    end
    if getPlayerLevel(cid) > 50 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You must be level 50 or below to use this command.')
        doSendMagicEffect(playerPos, CONST_ME_POFF)
        return true
    end
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    return true
end
 
Thank you so much! Im using 0.3.6/0.4
Everytime the player says !temple It is shown in the default channel. Is there any way that it does not appear? Or maybe appear in orange letters like the emoted spells?
 
try change it to this
Code:
isPlayerPzLocked(cid) == true

for spell emote
change
Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You are PZ locked.')
and
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You must be level 50 or below to use this command.')

to
Code:
doCreatureSay(cid, 'You are PZ locked.', TALKTYPE_MONSTER)
and
doCreatureSay(cid, 'You must be level 50 or below to use this command.', TALKTYPE_MONSTER)
and if you dont want it to say anything you just remove those lines
 
Last edited:
isPlayerPzLocked(cid) == true
this is the exact same as doing isPlayerPzLocked(cid)
all conditions in if statements return either true/false

Also PZ Locked is not working on 0.3.6/0.4
try
Code:
if not isPlayerPzLocked(cid) then
it might return false (meaning the player is not pz locked), my mistake
also replace all of the "return true"s to "return false"
after that it shouldn't show the command in default chat
 
this is the exact same as doing isPlayerPzLocked(cid)
all conditions in if statements return either true/false


try
Code:
if not isPlayerPzLocked(cid) then
it might return false (meaning the player is not pz locked), my mistake
also replace all of the "return true"s to "return false"
after that it shouldn't show the command in default chat

It is giving me debug
 
Can you copy it all?
Well the script it not the same as this.
the script is just using the same function

Edit: i have a question do you mean if thay are battle locked or Pz locked.
I mean if a monster is targeting you, its should still be possible to teleport
because isPlayerPzLocked(cid) is only true if you have attacked a player
 
Im sorry I wanted battle locked. Sorry my english is not that good.
Hehe ok, that explains why the isPlayerPzLocked didnt work, im not sure if it's possible to check if the player is battle locked.
I will have a look if i find something

change the isPlayerPzLocked(cid) to this
Code:
isPlayerPzLocked(cid) or getCreatureCondition(cid, CONDITION_PHYSICAL)
 
Hehe ok, that explains why the isPlayerPzLocked didnt work, im not sure if it's possible to check if the player is battle locked.
I will have a look if i find something

change the isPlayerPzLocked(cid) to this
Code:
isPlayerPzLocked(cid) or getCreatureCondition(cid, CONDITION_PHYSICAL)
Not working tho
 
Still not working. Who wants to come to the server?
again, use the not keyword
Code:
if not getCreatureCondition(cid, CONDITION_INFIGHT) then
it will return true if cid has CONDITION_INFIGHT, and we want to execute something if it's false: so we use the not keyword to make sure the next bool that's passed is not true
it's basically
if not true then
meaning if getCreatureCondition returns false, the if statement will execute its body, otherwise it wont.
another way of doing this is
Code:
if getCreatureCondition(cid, CONDITION_INFIGHT) == false then
 
Ok i was helping The Mapper in pm

here is the final script for 0.3.6 if anyone wants it, now it should ignore battle lock if you are inside pz zone
Code:
function onSay(cid, words, param)
local playerPos = getCreaturePosition(cid)

   if getTilePzInfo(playerPos) then
       doSendMagicEffect(playerPos, CONST_ME_POFF)
       doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
       doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
       return true
   end
   
   if getCreatureCondition(cid, CONDITION_INFIGHT) then
       doCreatureSay(cid, 'You are in combat', TALKTYPE_MONSTER) -- remove this line if you dont want text in default chat
       doSendMagicEffect(playerPos, CONST_ME_POFF)
   return true
   end

   if getPlayerLevel(cid) > 50 then
       doCreatureSay(cid, 'You must be level 50 or below to use this command', TALKTYPE_MONSTER) -- remove this line if you dont want text in default chat
       doSendMagicEffect(playerPos, CONST_ME_POFF)
   return true
   end
   
   doSendMagicEffect(playerPos, CONST_ME_POFF)
   doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
   return true
end
 
Solution
Back
Top