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

Lua Function getPlayerClientVersion(cid)

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
Very simple, but WTF.Error requested it.

PHP:
int32_t LuaScriptInterface::luaGetPlayerClientVersion(lua_State* L)
{
    //getPlayerClientVersion(cid)
    ScriptEnviroment* env = getEnv();
    Player* player = env->getPlayerByUID((uint32_t)popNumber(L));
    if(!player)
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }
    else
        lua_pushnumber(L, player->getClientVersion());

    return 1;
}

Don't forget to add:
PHP:
	//getPlayerClientVersion(cid)
	lua_register(m_luaState, "getPlayerClientVersion", LuaScriptInterface::luaGetPlayerClientVersion);
(in right place) and line to luascript.h

It's for 0.3.6. It return client in 3 digits, like: 854, 860 ;)
 
How often does one encounter a situation where multiple versions of the client are supported?

I guess I shouldn't say anything... Our server is still 8.54-8.57. Lol.
 
Shouldn't the client version always be the same for all players? I mean if you're running a 8.6 server, then the returned value should always be 8.6 since only people with Tibia 8.6 can connect.
 
This is included by default in TFS, isn't it? Since I can get that info by simply clicking on player with GOD char:

Code:
18:02 You see yourself. You are god.
Health: [150 / 150].
IP: 193.41.45.29, Client: 860.
Position: [X: 32369] [Y: 32234] [Z: 7].

Well, anyway...
 
This is included by default in TFS, isn't it? Since I can get that info by simply clicking on player with GOD char:

Code:
18:02 You see yourself. You are god.
Health: [150 / 150].
IP: 193.41.45.29, Client: 860.
Position: [X: 32369] [Y: 32234] [Z: 7].

Well, anyway...

yeah, but what if the guy wants to make a script like
Lua:
function onLogin(cid)
      if getPlayerCleintVersion(cid) == 854 then
      doPlayerSendTextMessage(cid, 22, "Your client version is 854 so you\'ll debug!")
  end
return TRUE
end
 
Last edited:
This is included by default in TFS, isn't it? Since I can get that info by simply clicking on player with GOD char:

Code:
18:02 You see yourself. You are god.
Health: [150 / 150].
IP: 193.41.45.29, Client: 860.
Position: [X: 32369] [Y: 32234] [Z: 7].

Well, anyway...
It's in sources, not a lua function
 
is posible detec one custum client?

function onLogin(cid)
if getPlayerCleintVersion(cid) == 854 then
doPlayerSendTextMessage(cid, 22, "You need custum client for no\'ll debug!")
end
return TRUE
end
 
Back
Top