[Tool/Web/Other] JSA-MP - An Java API of the game GTA San Andreas with the extension SAMP
#1

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
  • Eclipse
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/jsampn...7.71662568 *
 * 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.


Reply
#2

good job dude! Keep it up!
Reply
#3

Nice.
Reply
#4

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
Reply
#5

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
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)