AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: Fake Server Queries (https://forums.alliedmods.net/showthread.php?t=244450)

Shooting King 07-18-2014 11:22

Module: Fake Server Queries
 
7 Attachment(s)
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 :

https://dl.dropboxusercontent.com/u/205125564/fq1.jpg
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

xxxperts 07-18-2014 11:38

Re: Module: Fake Server Queries
 
Good Job :fox:

bboygrun 07-18-2014 11:48

Re: Module: Fake Server Queries
 
Good job, but, isn't it illegal ?

hleV 07-18-2014 11:50

Re: Module: Fake Server Queries
 
For what purpose can this be used besides fooling players?

Shooting King 07-18-2014 11:55

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by hleV (Post 2169943)
For what purpose can this be used besides fooling players?

Quote:

Originally Posted by Arkshine (Post 1919180)
I would think it could be useful, if a player connects to the server, he may stay and it may lead to other players connection ; and eventually a server filled with only players. I see really no harm done. It's more a tool to motivate players to stay on the server and waiting for others players. If you want to blame someone, blame the admin who puts the module bots.

Quote:

Originally Posted by bboygrun (Post 2169942)
Good job, but, isn't it illegal ?

I don't think its illegal with HL1 games.

bboygrun 07-18-2014 12:06

Re: Module: Fake Server Queries
 
AFAIK it is, i have to retrieve the text i found from Valve about it.

Arkshine 07-18-2014 12:21

Re: Module: Fake Server Queries
 
Oh, don't quote me \o/.

Shooting King 07-18-2014 12:24

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by Arkshine (Post 2169964)
Oh, don't quote me \o/.

:p

yokomo 07-18-2014 12:59

Re: Module: Fake Server Queries
 
Haha impressive!
Faster download all files before delete by moderatoz.

vlad_slick 07-18-2014 13:50

Re: Module: Fake Server Queries
 
Quote:

Originally Posted by yokomo (Post 2169979)

Faster download all files before delete by moderatoz.

AHAHAHAH! That's the first thing I thought after seeing the thread title. :avast:


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

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