JAVA skipping sa-mp client for direct connecting - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: JAVA skipping sa-mp client for direct connecting (
/showthread.php?tid=625429)
JAVA skipping sa-mp client for direct connecting -
justinnater - 01.01.2017
Hello, I understand that this thread is for pawn related questions but I could not find another section where this topic would make sense being.
So... I am making an anti-cheat program which has to be executed by the players who are willing to play in a specific virtual world where all the other users are who use this .jar file.
Does anyone know how to connect to a server by java code?
Re: JAVA skipping sa-mp client for direct connecting -
Spmn - 01.01.2017
Quote:
Originally Posted by justinnater
Hello, I understand that this thread is for pawn related questions but I could not find another section where this topic would make sense being.
So... I am making an anti-cheat program which has to be executed by the players who are willing to play in a specific virtual world where all the other users are who use this .jar file.
Does anyone know how to connect to a server by java code?
|
Well, if you want to use the share the same connection that SA-MP client uses, then you have to hook into both server and client RakServer, respectively RakPeer interface using a DLL written in C++ (since there is no java implementation of RakNet), then implement a communication interface between DLL and your java application, so you can use raknet functions in your .jar. This approach is pretty hard to achieve.
A more easier way is to create a TCP socket on your server using socket plugin and make your java application connect to that socket, this way you won't rely on SA-MP networking stuff, but you'd have to implement a sort of player-anticheat identification system.
A third way would be using a website where both client and server have access. Anticheat client would send info to that webserver, and your SA-MP server would query the webserver.