• 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

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,901
Reaction score
26
Location
Canada
Not sure if this has been released, But i thought it would be helpful for those who dont have it.

Lua:
function isPlayerOnline(player)
        local check = db.getResult("SELECT `online` FROM `players` WHERE `id` = " .. player .. ";")
        local on = check:getDataInt("online")
        if on ~= 0 then
                return TRUE
        else
                return FALSE
        end
end
 
if getPlayerByNameWildcard(getCreatureName(cid)) or isPlayer(cid) then

kkthxbye

Also with yours we have to use player GUID as param, as cid wouldn't work.
 
Would this work?

I'm not so good at writing most functions that deal with ALL of the players.

Code:
function isOnline(name)
	for i = 1, #getPlayersOnline()
		return getPlayerByNameWildcard(name[i])
	end
end
 
I'm not so good at writing most functions that deal with ALL of the players.

Code:
function isOnline(name)
	for i = 1, #getPlayersOnline()
		return getPlayerByNameWildcard(name[i])
	end
end

Code:
if(getPlayerByNameWildcard(name)) then
	return true
else
	return false
end
 
Back
Top