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

isPlayerOnline(name)

Code:
function isPlayerOnline(kid)
  if type(kid) == 'string' then
    return isPlayer(getCreatureByName(kid))
  elseif type(kid) == 'number' then
    return isPlayer(kid)
  else
    error('Value is '..type(kid)..' and it can be string or number')
  end
end

Same function... isPlayer = isPlayerOnline
 
Code:
function isPlayerOnline(kid)
  if type(kid) == 'string' then
    return isPlayer(getCreatureByName(kid))
  elseif type(kid) == 'number' then
    return isPlayer(kid)
  else
    error('Value is '..type(kid)..' and it can be string or number')
  end
end

Same function... isPlayer = isPlayerOnline

Stop rewrite my scripts, i hate that <_<.

PS: Say me how your script should work,..

if isPlayerOnline(cid) ? == error
if isPlayerOnline(""..getCreatureName(cid).."") == error
 
just like

if isPlayerOnline(cid) then <- stupid using cid xD

or

isPlayerOnline(getcreaturename(target)) then


and yezzzzz mock way is the best one lol
 
just like

if isPlayerOnline(cid) then <- stupid using cid xD

or

isPlayerOnline(getcreaturename(target)) then


and yezzzzz mock way is the best one lol

Lua:
function onKill(cid, target, lastHit)
     isPlayerOnline(getCreatureName(target)) == TRUE then
     ...
     ...
     ...
     end
end

:confused: stupid using :).
 
@Shawak
nope...
i used function 'type'
it return an string saying type of var, strig, number, table, boolean, nil, userdata...
so it check if is a number or string, if it is a number it check direct by player id, but if it is an string iot check how as name xP

<sorry to rewrite>
some peoples like it :S

But has one different kind to make it...
for k,v in pairs(getOnlinePlayers()) do
...
:p
 
I know what you mean, but i think "getCreatureByName(kid)" won't work is the player is offline, and you get a console error, or not?

I don't know what "getCreatureByName(kid)" return, ;).
 
Nice but isPlayer(cid) does the exact same thing with less resources doesnt it?

Lua:
if isPlayer(cid) == TRUE then
 doSendPlayerTextMessage(cid, 10, "Player: " ..getCreatureName(cid).. " is online.")
end
 
Last edited:
@shawak
if i use:
getCreatureByName(kid,false)
it returns nil ^^
 
Lua:
function isPlayerOnline(name)
        return(getPlayerByName(name) ~= nil)
end
 
Back
Top