Raised This Month: $32 Target: $400
 8% 

Module: Fake Server Queries


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 07-18-2014 , 11:22   Module: Fake Server Queries
Reply With Quote #1

Fake Server Queries v1.1 - 1/1/2017


In brief, This module gives you the ability to change Server Query fields. Thereby providing modified information to the client about the server. This module currently supports only some A2S_INFO Fields namely,
  • Server Name
  • Map Name
  • Game Name
  • Players (Online)
  • MaxPlayers
  • Bots

Others can be added on request.

Natives and Forwards :
PHP Code:
/* 
   Set Host Name on Sendto Quries
   MaxLen In SvBrowser - 63 + 1 (null)

   if an empty string ("") is passed, FL_SVNAME flag will be unset.  
*/
native fq_set_hostname( const szHostName[] );

/* 
   Set Map Name on Sendto Quries
   MaxLen In SvBrowser - 31 + 1 (null)

   if an empty string ("") is passed, FL_MAPNAME flag will be unset.
*/
native fq_set_mapname( const szMapName[] );

/* 
   Set Game Name on Sendto Quries
   MaxLen In SvBrowser - 63 + 1 (null)

   if an empty string ("") is passed, FL_GAMENAME flag will be unset.
*/
native fq_set_gamename( const szGameName[] );

/* 
   Set Players on Sendto Quries
   If iPlayers is less than 0 i.e a negative number
   Original playersnum will be set.
   if a Negative number is passed, FL_PLAYERS will be unset.

   returns 0 On Success and -1 on Failure ( Value is greater than 127 )
*/
native fq_set_players( const iPlayers );

/* 
   Set Hostname on Sendto Quries
   If iMaxPlayers is less than 0 i.e a negative number
   Original maxplayers will be set.
   if a Negative number is passed, FL_MAXPLAYERS will be unset.

   returns 0 On Success and -1 on Failure ( Value is greater than 127 )
*/
native fq_set_maxplayers( const iMaxPlayers );

/* 
   Set Hostname on Sendto Quries
   If iBotsNum is less than 0 i.e a negative number
   Original botsnum will be set.
   if a Negative number is passed, FL_BOTSNUM will be unset.

   returns 0 On Success and -1 on Failure ( Value is greater than 127 )
*/
native fq_set_botsnum( const iBotsNum );

enum FFlags(<<=1)
{
    
FL_SVNAME = ( 1<<),
    
FL_MAPNAME,
    
FL_GAMENAME,
    
FL_PLAYERS,
    
FL_MAXPLAYERS,
    
FL_BOTSNUM
}

/* 
   Set Hostname on Sendto Quries
   UnSet respective variables. You can even pass the bitsum of the above flags
   eg. fq_unset( FL_SVNAME | FL_BOTSNUM );

   returns 0 on Success and -1 on Failure
*/
native fq_unset( const FFlags:iFlags );

/*
   Called Before replying to a request.
   To block sending Response to an IP, return PLUGIN_HANDLED. 
   This will block call to SendTo fuction.

   Header is a part (till first \x00 encounter) of Actuall response which would be sent by the server.
*/
forward Server_SendTo( const szIP[], const szHeader[] ); 
Installation :
1. Download fakequeries_binary.zip from the attachments.
2. Extract it in your game directory.
3. Optional: Add "fake_queries" in your modules.ini (in amxmodx/configs dir).
Credits :
Arkshine aka noob :p and joropito (for CHooker class)
Examples :
1. fq_Basic:

PHP Code:
#include <amxmodx>
#include <fake_queries>

new const szHostName[] = "Shooting Kings Test Server";
new const 
szMapName[] = "sk_dust2";
new const 
szGameName[] = "AM Game";

new const 
iPlayers 12;
new const 
iMaxPlayers 64;
new const 
iBotsNum 0;

public 
plugin_init()
{
    
register_plugin"FakeQueries""1.0""Shooting King" );
    
    
fq_set_hostnameszHostName );
    
fq_set_mapnameszMapName );
    
fq_set_gamenameszGameName );

    if( !
fq_set_players(iPlayers) )
        
log_amx"Players Successfully Set." );
    else
        
log_amx"Players Failed to Set." );

    if( !
fq_set_maxplayers(iMaxPlayers) )
        
log_amx"MaxPlayers Successfully Set." );
    else
        
log_amx"MaxPlayers Failed to Set." );

    if( !
fq_set_botsnum(iBotsNum) )
        
log_amx"Bots Successfully Set." );
    else
        
log_amx"Bots Failed to Set." );

Result :

2. fq_BlockIP

PHP Code:
#include <amxmodx>
#include <fake_queries>

new szTestIP[] = "127.0.0.1";

public 
plugin_init()
{
    
register_plugin"FakeQueries : Block IP""1.0""Shooting King" );
}

public 
Server_SendTo( const szIP[], const szHeader[] )
{
    if( 
equal(szIPszTestIP) )
    {
        
log_amx"Blocked Connection from %s with header %s"szIPszHeader );
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;

Know Issues:
Code:
 - None.
ChangeLog :
Code:
 
1.1v 
- Fixed BotCount not being set on queries
- Changed technical name of the module to fake_queries, i.e, the name of module, library, include etc etc..
- Updated vs toolkit to vs110

1.0v 
- Initial Release
Github: Link (https://github.com/ShootingKing-AM/FakeServerQueries)

Plugins and the module are tested on Windows and Linux (Ubuntu 14.04 LTS x64) with HLDS v6132.

v1.0 Download count - 27277
Attached Files
File Type: sma Get Plugin or Get Source (fq_Basic.sma - 1986 views - 831 Bytes)
File Type: sma Get Plugin or Get Source (fq_BlockIP.sma - 1923 views - 406 Bytes)
File Type: inc fake_queries.inc (2.3 KB, 900 views)
File Type: zip fakequeries_binary.zip (177.1 KB, 1026 views)
File Type: zip fakequeries_source.zip (49.1 KB, 863 views)
File Type: dll fake_queries_amxx.dll (405.5 KB, 578 views)
File Type: so fake_queries_amxx_i386.so (25.5 KB, 942 views)
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here

Last edited by Shooting King; 01-01-2017 at 05:33. Reason: Tested on Linux as well.
Shooting King is offline
 


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 13:50.


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