PDA

View Full Version : count my self



ososzayat
01-19-2016, 01:36 AM
Creature.iPlayers() is counting everyone but my self.. i need something which counts my name too.

DarkstaR
01-19-2016, 01:46 AM
local mylist = {Creature.New(Self.ID())}
for name, c in Creature.iPlayers() do table.append(mylist, c) end


something like that

ososzayat
01-19-2016, 09:09 PM
@DarkstaR (http://forums.xenobot.net/member.php?u=2)
what im trying to do is a checker for the character name.. so the script is exclusive on some characters only.


Module.New('CheckIfAllowed', function(Allow)
local List = {"Lord Zayat", "Wezy"}
for _, c in Creature.iPlayers()do
if table.isStrIn(List,c:Name()) then
print([[Happy Hunting.]])
else
print([[You're not allowed To run this script.]])
Cavebot.Stop()
end
end
Allow:Delay(4500, 5500)end)

but Creature.iPlayers() don't see me :(


EDITTTT:
this would work if the id isn't changing everytime i loggin :s



Module.New('CheckIfMe', function(Allow)
local id1 = 268448xxx -- first character id
local id2 = 268448xxx -- second character id
if Self.ID() == id1 or Self.ID() == id2 then
print([[Happy Hunting]])
else
print([[you're not allowed to run this script]])
Cavebot.Stop()
end


Allow:Delay(10000, 15000)
end)

Jontor
01-20-2016, 10:16 AM
@DarkstaR (http://forums.xenobot.net/member.php?u=2)
what im trying to do is a checker for the character name.. so the script is exclusive on some characters only.


Module.New('CheckIfAllowed', function(Allow)
local List = {"Lord Zayat", "Wezy"}
for _, c in Creature.iPlayers()do
if table.isStrIn(List,c:Name()) then
print([[Happy Hunting.]])
else
print([[You're not allowed To run this script.]])
Cavebot.Stop()
end
end
Allow:Delay(4500, 5500)end)

but Creature.iPlayers() don't see me :(


EDITTTT:
this would work if the id isn't changing everytime i loggin :s



Module.New('CheckIfMe', function(Allow)
local id1 = 268448xxx -- first character id
local id2 = 268448xxx -- second character id
if Self.ID() == id1 or Self.ID() == id2 then
print([[Happy Hunting]])
else
print([[you're not allowed to run this script]])
Cavebot.Stop()
end


Allow:Delay(10000, 15000)
end)



I think this could work for you:



local names = {"Lord Zayat", "Wezy"}
local isAllowed = false

Module.New("checkName", function(check)
if (table.find(names, Self.Name())) then
isAllowed = true
else
isAllowed = false
end

check:Delay(10000)
end)

ososzayat
01-20-2016, 01:29 PM
@Jontor (http://forums.xenobot.net/member.php?u=49447)
omg.. is there Self.Name() ?? i missed it xD
thanks alot man xDD gonna try it :d

edit: WORKED!!! THANKS MAN!!!!!!!