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

Lua How to check if a summon is your or someone other?

waqmaz

Member
Joined
Jun 17, 2015
Messages
203
Reaction score
11
TFS 0.3.6
Hello. How to check if a summon is your or someone other?
This way I can check if a summon is a summon:
Code:
if getCreatureMaster(target) ~= target then
Now I want to check if a summon is my summon and if a summon os others.
Please helpe me. I need this script to make my server.
How to use properly this function?
Code:
getCreatureMaster
getCreatureMaster(cid)
Info
This function checks creature master. Its used for summoned creatures, to check who has summoned it.

Returns
Creature master cid if found, otherwise self cid.
Rep.++
 
Hey, it doesn't work.
Code:
    if isPlayer(getCreatureMaster(target)) then
        doCreatureSay(cid, "The creature is your!", TALKTYPE_ORANGE_1)
    end
I've done 2 characters and checked it on multiclient. Both summons of both characters makes me saying "The creature is your".
 
it doesnt work? it works exactly like intended, you just dont seem to understand what it does..

getCreatureMaster(...) returns a CID, if the creature is a summon it returns the CID of the player (or monster) who owns it, if it is not a summon it will return its own CID
isPlayer(getCreatureMaster(target)) will only check if the master is a player, if you want to check if the summon is your own you'd have to use with with a players cid for example if its a talkaction, but i cant help you with that without the rest of the script

for example you could have a talkaction
!mysummons
Code:
function onSay(cid, words, param, channel)
local specs = getSpectators(...)
for i=1,#specs,1 do
if isPlayer(getCreatureMaster(specs[i])) and getCreatureMaster(specs[i]) == cid then
doCreatureSay(specs[i], "i am "..cids.." summon.")
end
return true
end
 
Code:
function onAttack(cid, target)
   if isMonster(target) then
     if isSummon(target) then
       if getCreatureMaster(target) == cid then
         -- Your summon
       else
         -- someone else summons
       end
     end
   end
   return true
end
 
Back
Top