[Tool/Web/Other] JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Tools and Files (
https://sampforum.blast.hk/forumdisplay.php?fid=82)
+---- Thread: [Tool/Web/Other] JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP (
/showthread.php?tid=213072)
JSA-MP - A Java API for SAMP -
Faab234 - 18.01.2011
Welcome.
Today, I was working on an API for SAMP written in Java. Finally, I'm done with version 1.1.0 Alpha.
Currently.
Currently, JSA-MP has only support for the Query Mechanism.
Requirements.- JVM (Java Virtual Machine)
- JDK
- Apache Mina (NIO Library)
- slf4j Library
Tips
Downloads, Links, Documentation, ect
http://code.******.com/p/jsa-mp/
Examples, tutorials
Here I'll post tutorials and examples..
Example Code: Get info of your Server.
Код:
/**
* Copyright © 2011 Fabian M <faabtech.com>
*
* More information about the JSAMP API may be found on these websites:
* http://faabtech.com/projects/java/jsamp
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the fsollowing conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
package jsamp.example;
import org.faabtech.jsamp.event.OnReadyListener;
import org.faabtech.jsamp.event.SAMPAdapter;
import org.faabtech.jsamp.query.QueryHandler;
/**
* @author Fabian
*
*/
public class Example {
/**
* Our variables
*/
private static final String ADDRESS = ""; // Your SAMP IP
private static final int PORT = 7777; //Your SAMP port usually 7777
private static final char COMMAND = QueryHandler.INFO; // The query command
/**
* @param args
*/
public static void main(String[] args) {
/**
* We will construct an new Instance of the queryhandler
*/
QueryHandler query = new QueryHandler(ADDRESS, PORT, COMMAND);
/**
* We're adding an on ready listener.
* This event will executed when the Query is sended and decoded.
*/
query.setOnReadyListener(new OnReadyListener() { // New instance of the on ready listener
/*
* (non-Javadoc)
* @see org.faabtech.jsamp.event.OnReadyListener#run(org.faabtech.jsamp.event.SAMPAdapter)
*/
@Override
public void run(SAMPAdapter adapter) { // Because the Superclass of QueryHandler is the SAMPAdapter, the param is SAMPAdapter
/**
* This method will be executed when the query is sended and decoded.
*/
QueryHandler current = ((QueryHandler) (adapter)); // Because the param adapter only contains the members of SAMPAdapter we need to cast it.
int players = current.getInfo().getPlayers(); // Get the players
System.out.println(players);
}});
}
}
End
Credits: Faab234 A.K.A Fabian M
Rate/Hate.
Re: JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP -
kiss - 09.02.2011
good job dude! Keep it up!
Re: JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP -
TheAlienForce - 09.02.2011
Nice.
Re: JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP -
Ash. - 09.02.2011
Interesting, but couldnt this cause security loop holes? (If used incorrectly that is)
However good job!
//This forum requires that you wait 60 seconds between posts. Please try again in 18 seconds.
//Got myself some tea
Re: JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP -
McPhantom - 12.02.2011
wow, good work nice library. I have something I would really like to see in the samp library or in J-SAMP:
Able to do webrequests. POST & GET. That would be really great. That way we could let a user login into a website/forum to check if his username & password are right.
Anyways it would be great
Re: JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP -
Slice - 13.02.2011
Topic title:
"JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP"
..........what? Is it an API of the game GTA:SA containing an extension called SAMP?
It's SA-MP, btw, and SA-MP is a mod.
Also, it's mechanism - not meganism.
Anyone can be a smartass!
pce