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

Check if player is using Otclient

imkingran

Learning everyday.
Premium User
Joined
Jan 15, 2014
Messages
1,318
Solutions
35
Reaction score
435
Hi guys,
Trying to learn more about OTclient and I have a question:
I see in TFS 1.0 Lua functions there is this function:
Player.isUsingOtClient(self)

Is there a similar function to check if a player is using Otclient in TFS 0.4?

Thanks for your help!
 
Interesting, thanks for the help Summ. I'll search for a function that checks for the users OS.
 
Hey @Summ
My goal for using Otclient is to create a bot-free client that players can use to play and reward them for playing manually by granting the some features such as 25-30% more experience for using this Client.

Is there a way to manipulate the experience through OTclient itself? Or will I have to recognize that the player has connected with Otclient and then make a script for that in the sources/lua side.

Thanks for sharing your knowledge.
 
not sure about 0.4 but in 1.0 there is a c++ function for the player class called "getOperatingSystem()" if you use getOperatingSystem() >= 0x0A then you know if the player is using OTClient or not (windows/linux/mac)
 
not sure about 0.4 but in 1.0 there is a c++ function for the player class called "getOperatingSystem()" if you use getOperatingSystem() >= 0x0A then you know if the player is using OTClient or not (windows/linux/mac)

Thanks that's good to know. I plan on making one for TFS 1.0 later down the road.

Any alternate solutions for TFS 0.4 if that function doesn't exist?
 
I've just taken a deeper look into my really really old alpha 0.4 sources and it appears there, so you should have it in newer ones aswell.
You can use in the Player class the function "isUsingOtclient()" returns either true or false

If you need it to be a lua function aswell then just leave a message here and I'll make it for you.
 
I've just taken a deeper look into my really really old alpha 0.4 sources and it appears there, so you should have it in newer ones aswell.
You can use in the Player class the function "isUsingOtclient()" returns either true or false

If you need it to be a lua function aswell then just leave a message here and I'll make it for you.

If you could make it a lua function that'd be really helpful, in the meantime I will try try to implement it into the sources in an attempt to learn something about C++.
 
ok screw me, just noticed that this function already exists.
Code:
isPlayerUsingOtclient(cid)
 
That's amazing, thanks I'll try it!
 
For some reason it's not detecting Otclient, I must be making a mistake somewhere:

login.lua :
Code:
if isPlayerUsingOtclient(cid) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You are using OTclient.")
end

constant.lua
Code:
CLIENTOS_OTCLIENT_LINUX = 10
CLIENTOS_OTCLIENT_WINDOWS = 11

shortcut.lua
Code:
function isPlayerUsingOtclient(cid)
return getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_WINDOWS
end
 
Last edited:
For some reason it's not detecting Otclient, I must be making a mistake somewhere:

shortcut.lua
Code:
function isPlayerUsingOtclient(cid)
return getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_WINDOWS
end

You don't need that part, isPlayerUsingOtclient(cid) is already a c function
 
I think in the sources I'm using it must not be a function yet. I'm using rev 5916.

Code:
[19:52:04.446] [Error - CreatureScript Interface]
[19:52:04.446] data/creaturescripts/scripts/vipexp.lua:onLogin
[19:52:04.446] Description:
[19:52:04.446] data/creaturescripts/scripts/vipexp.lua:6: attempt to call global 'isPlayerUsingOtclient' (a nil value)
[19:52:04.446] stack traceback:
[19:52:04.446]  data/creaturescripts/scripts/vipexp.lua:6: in function <data/creaturescripts/scripts/vipexp.lua:3>

luascript.h: http://pastebin.com/xWEHfEcV

Edit---
I actually tested on TFS 1.0 to see if it was an error of the engine or the client and on TFS 1.0 it's not recognizing OTclient either.

Code:
if Player.isUsingOtClient(player) then
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Hi")
end

I was using the pre-compiled versions here: http://otland.net/threads/otclient-builds-windows.217977/
 
Last edited:
bump, I'm sure i'm making a stupid mistake somewhere, could anyone help point it out to me?

Thanks for your patience.
 
Sorry for that, but can help more people: The function can be: "isPlayerUsingOtclient(cid)" or Player:isUsingOtClient(self) . Depends the version of the DISTRO.
 
Back
Top