Raised This Month: $275 Target: $400
 68% 

[ANY] ASteambot - Create your own modules !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 09-03-2017 , 09:01   [ANY] ASteambot - Create your own modules !
Reply With Quote #1

ASteambot - Developper


Introduction

So... About a year ago, I made a steambot wich turned out to not be that usefull nor well made. I reprogrammed it, from scratch and ASteambot was "born". It's still an ugly undevelopped fetus, but it somehow work already [CLICK] .

But the interesting part about it is that I want to create a simple interface so anybody with basic knowledge about sourcepawn will be able to do his own plugins using ASteambot.

I have already mode two plugins using the interface and it works pretty well, I must say.
ASteambot Donation
ASteambot Chat

The point of this thread is to explain how my interface work and also to get returns from you, about what stops you from doing plugins with the interface, what could be improved or if I should keep it alive or not.

How does it work ?

Well, ASteambot have a TCP endpoint, where you can send some queries through it.
Wich means, Socket extension [CLICK] is required.

Enough speech, more actions

First of all, you will need the include file, you can grab it on Github [CLICK].
Let's take a look at it.

ASteambot.inc (03.09.2017)
PHP Code:
/*
*
*    Contains things for ASteambot plugin developpement <--- Best description ever, isn't it ?
*
*/
#if defined _INCLUDE_ASteambot
 #endinput
#endif
#define _INCLUDE_ASteambot

#define AS_REGISTER_SERVER        0
#define AS_HOOK_CHAT            1
#define AS_UNHOOK_CHAT            2
#define AS_SIMPLE                3
#define AS_TRADEOFFER_SUCCESS    4
#define AS_TRADEOFFER_DECLINED    5
#define AS_SCAN_INVENTORY        6
#define AS_CREATE_TRADEOFFER    7
#define AS_NOT_FRIENDS            8
#define AS_TRADE_TOKEN            9
#define AS_FRIEND_INVITE        10

/** 
 * Connect to ASteambot and get your server ID. Will work only after OnConfigsExecuted().
 * Will automatically try to keep the connection alive, even after disconnection.
 * 
 * @return          Nothing. 
 */ 
//native void ASteambot_Connect() 

/** 
 * Disconnect from ASteambot. On reconnection, you will get a new server ID.
 * 
 * @return          Nothing. 
 */ 
//native void ASteambot_Disconnect() 

/** 
 * Get the connection state to ASteambot
 * 
 * @return          true if connected and can receive/send messages, false otherwise. 
 */ 
native bool ASteambot_IsConnected() 

/** 
 * Send a message to ASteambot (Maximum char 900). 
 * 
 * @return          Nothing.
 */ 
native void ASteambot_SendMesssage(int MessageType, const char[] message

/** 
 * Send a message to ASteambot (Maximum char 900). 
 * 
 * @return          Nothing.
 */ 
native void ASteambot_CreateTradeOffer(int clientint gameIDHandle ArrayAssetID

/** 
 * Fire when ever you get a message from ASteambot.
 * 
 * @return          Nothing.
 */ 
forward int ASteambot_Message(int MessageTypechar[] message, const int messageSize);

/**
Shared plugin information
**/
public SharedPlugin _pl_ASteambot 
{
    
name "[ANY] ASteambot Core",
    
file "ASteambot_Core.smx",
#if defined REQUIRE_PLUGIN
    
required 1
#else
    
required 0
#endif
}; 
The first lines (#define ...) contains the data-head, in other words, the type of message you want to send. Let's take a look.

AS_REGISTER_SERVER
This one should NEVER be usued by you. It's ASteambot_Core who use it and he should be the only one.
When ASteambot receive this type of message it will give the server an ID. It's like :
Server : "Hey, ASteambot, I want to connect to ya"
ASteambot : "Wait mate, I'll give you a number so I don't forget who you are, OK ?"
Server : "Okay, yeah."

AS_HOOK_CHAT
This message type means that you want to send everything that his written in the game server chat to the steambot.
If you receive this message, a friend of ASteambot have written "HOOKCHAT" in steamchat.
If you send a message with this message type, ASteambot will try to forward this message to all steam friends who are hooking this server chat.

AS_UNHOOK_CHAT
If you receive this message, a friend of ASteambot have written "STOPHOOK" in steamchat.
If you send a message with this message type, ASteambot will do nothing.

AS_SIMPLE
If you receive this message, ASteambot is trying to send you a message composed like this :
Arkarr : this is a test text

If you send a message with this message type, ASteambot will try to send a message through steam to the specified steamID.
Message you send must me composed like this :
ASteambot_SendMesssage(AS_SIMPLE, "STEAM_0:1:42047781/Hello world!");

AS_TRADEOFFER_SUCCESS
If you receive this message, ASteambot is trying to send you a message composed like this :
STEAM_0:1:42047781/523523634/45.10
This message can be subdivised in 3 parts.
STEAM_0:1:42047781 is the first part and the steam ID of the player who completed a trade offer.
523523634 is the trade ID.
45.10 is how much $ the trade was worth. In this exemple, I traded for 45.10$ worth of steam items.
It means a trade have successfully ended.
If you send a message with this message type, ASteambot will do nothing.

AS_TRADEOFFER_DECLINED
If you receive this message, ASteambot is trying to send you a message composed like this :
STEAM_0:1:42047781/523523634/45.10
This message can be subdivised in 3 parts.
STEAM_0:1:42047781 is the first part and the steam ID of the player who completed a trade offer.
523523634 is the trade ID.
45.10 is how much $ the trade was worth. In this exemple, I traded for 45.10$ worth of steam items.
It means a trade have been declined ended.
If you send a message with this message type, ASteambot will do nothing.

AS_SCAN_INVENTORY
If you receive this message, ASteambot is trying to send you a message composed like this :
STEAM_0:1:42047781/[TF2 items]/[CSGO items]/[DOTA 2 items]

Obviously, the first part is the steamID of the player's inventory.
[TF2 items], [CSGO items] and [DOTA 2 items] contains all the inventory that have a value in steam market higher than 0.00.
It's compossed like this :
item_id=item_name=item_value,item2_id=item2_n ame=item2_value,...

If you send a message with this message type, ASteambot will return AS_SCAN_INVENTORY as message type and will return the inventory as well, as explained just above.
Message you send must me composed like this :
ASteambot_SendMesssage(AS_SCAN_INVENTORY, "STEAM_0:1:42047781");

AS_CREATE_TRADEOFFER
You don't use it, because the message is a pain in the @S* to explain. Instend, you use the approriate function for that, check below.
You will receive this kind of message once a trade offer has been created. It return the trade offer id.

AS_NOT_FRIENDS
If you receive this message, it means that you tried to do something that require ASteambot and the player to be friend. For exemple, you need to be friend to send a trade offer (or use a token, but it's not implemented yet in ASteambot TCP interface).
The message is composed like this :
STEAM_0:1:42047781
It just contain the steamID of the one who tried to do something that is not allowed.
If you send that message to ASteambot, nothing happens.

AS_TRADE_TOKEN
Does nothing when you send, you will never receive it.

AS_FRIEND_INVITE
You will never receive this message type.
Ask ASteambot to add the following steamID to his friends through steam request.
Usage :
ASteambot_SendMesssage(AS_FRIEND_INVITE, "STEAM_0:1:42047781");

AS_INVITE_GROUP
Ask ASteambot to add the following steamID to the steam group.
Usage :
ASteambot_SendMesssage(AS_INVITE_GROUP, "STEAM_0:1:42047781/GROUP_ID");
GROUP_ID can be found here : http://steamcommunity.com/groups/YOU...listxml/?xml=1
it's the number in <groupID64>'s tag, for exemple :
http://steamcommunity.com/groups/ark...listxml/?xml=1 group's id is 103582791460339322
Keep in mind that the ASteambot need the right to invite people in the group...
If you receive this message, it means that someone have been invited to the steam group.
The message is composed like this :
STEAM_0:1:42047781

ASteambot_RegisterModule()
PHP Code:
/** 
 * Register the plugin, required to receive and send messages.
 * 
 * @return          Nothing.
 */ 
native bool ASteambot_RegisterModule(const char[] moduleName
It is required to register your module to ASteambot_Core in order to be able to receive and send message to ASteambot. Do that in OnPluginStart()

ASteambot_RemoveModule()
PHP Code:
/** 
 * Remove the module from ASteambot_Core, the plugin won't be able to receive and send messages anymore.
 * 
 * @return          Nothing.
 */ 
native void ASteambot_RemoveModule() 
Remove the module from the registery of ASteambot_Core. Do that in OnPluginEnd().

ASteambot_IsConnected()
PHP Code:
/** 
 * Get the connection state to ASteambot
 * 
 * @return          true if connected and can receive/send messages, false otherwise. 
 */ 
native bool ASteambot_IsConnected() 
This function is pretty explicit, it return true if the server is connected to ASteambot or not.

ASteambot_SendMesssage(int MessageType, const char[] message)
PHP Code:
/**  
 * Send a message to ASteambot (Maximum char 900).  
 *  
 * @return          Nothing. 
 */  
native void ASteambot_SendMesssage(int MessageType, const char[] message
This function allow you to send a message to ASteambot. That's it. Nothing more.
You should ALWAYS (do as I say, not as I do ) check if the server is connected to ASteambot before trying to send him anything.

ASteambot_CreateTradeOffer(int client, int gameID, Handle ArrayAssetID)
PHP Code:
/**  
 * Create a trade offer with ASteambot and the given client.  
 *  
 * @return          Nothing. 
 */  
native void ASteambot_CreateTradeOffer(int clientint gameIDHandle ArrayAssetID
gameID has to be valid.
TF2 = 440
CSGO = 730
DOTA2 = 570

ArrayAssetID is a arry wich contains valid assetID, assetID can be retrieved from ASteambot using the message type AS_SCAN_INVENTORY.

PHP Code:
/**  
 * Fire when ever you get a message from ASteambot. 
 *  
 * @return          Nothing. 
 */  
forward int ASteambot_Message(int MessageTypechar[] message, const int messageSize); 
Well, when you can get Message from ASteambot, it fire. I don't know what else to say.






Alright, that was boring. If you have any other questions, or want to request anything else, just do it !
__________________

Last edited by Arkarr; 05-30-2018 at 09:36.
Arkarr is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 05-30-2018 , 09:40   Re: [ANY] ASteambot - Create your own modules !
Reply With Quote #2

I made several updates since I wrote that post.
I need to do updates but firstly, I want to know if it has helped someone or not at all.
If not, then I won't continue updating this post.
Just send me a PM or leave a reply here.
__________________
Arkarr is offline
extremeg
Senior Member
Join Date: Dec 2012
Location: Germany
Old 05-31-2018 , 12:23   Re: [ANY] ASteambot - Create your own modules !
Reply With Quote #3

yeah this post was for me very helpfull then you documented it well
__________________
C#/Java/MySQL/SourcePawn/PHP/Perl/Phyton Developer - [CSGO Surf/Bhop since 2013]
extremeg is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 05-31-2018 , 13:15   Re: [ANY] ASteambot - Create your own modules !
Reply With Quote #4

Quote:
Originally Posted by extremeg View Post
yeah this post was for me very helpfull then you documented it well
Okay, I will update it then.
__________________
Arkarr is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:21.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode