Accueil   FORUM   Aide Rechercher Admin Calendrier Membres Identifiez-vous Inscrivez-vous   **  
Half-life Design

Articles
  
   Discussions
   Half-Life
       Coding
       Mapping
       Modeling
   Half-Life²
       Coding
       Mapping
       Modeling
   Game Design
       Coding
       Mapping
       Modeling
  
   Worldcraft Online
   Téléchargements
  
Bienvenue, Invité. Veuillez vous connecter ou vous inscrire.
Avez-vous perdu votre courriel d'activation?
09 Février 2010, 08:21:32

Connexion avec identifiant, mot de passe et durée de la session

Modules

Téléchargements

Last 10 shouts:
19 Septembre 2006, 14:41:54
Ce theme est mieux que l'ancien !
18 Septembre 2006, 03:23:40
bonjour
16 Septembre 2006, 22:22:22
looks realy good
13 Septembre 2006, 11:02:07
+1 y roxx le theme Sourire par contre inutile le truc "1 week, 1month, 1 year" pour se logger, forever suffit...
13 Septembre 2006, 10:36:08
bravo
Pages: [1]
  Envoyer ce fil  |  Imprimer  
Auteur Fil de discussion: recupérer les informations des servers half life en c++  (Lu 1481 fois)
0 Membres et 1 Invité sur ce fil de discussion.
Anonymous
Invité
« le: 25 Mai 2003, 01:10:41 »

si qqun serait comment recupérer les informations des servers half life en c++
et aussi comment utiliser le rcon à partir d'un programme c++ celui m'arrangerai grandement

merci d'avance,
cordialement, mickyoun
http://www.mickyoun.fr.st
mickyoun@hotmail.com
Journalisée
FireStorm
Administrator
Honorable
*****

Karma: 12
Hors ligne Hors ligne

Messages: 3833


112973171 fstorm_@hotmail.com
Voir le profil
« Répondre #1 le: 25 Mai 2003, 11:19:35 »

C'est dans le SDK.

Citation
------------------------------

Revised 1/3/2001 ywb -- Added new rcon protocol info:

Note to those writing remote admin programs that issue rcon commands (the in-client rcon commands work as before), you will need to change your rcon tools to use the following revised protocol.

Remote App sends a UDP packet to the server on the server's port (e.g., 127.0.0.1:27015):

The packet should start with 4 consecutive bytes of 255 (32-bit integer -1) and the string:

\"challenge rconn\".

The server will respond to the requesting system on the purported remote IP address and port with four 255's and:

\"challenge rcon numbern\" where number is an unsigned int32 number.

To issue the actual rcon, the remote App then responds with a UDP packet containing 4 255s and:

\"rcon number \"password\" rconcommands\" where password is the rcon_password ( should be enclosed in quotes as noted so that multiple word passwords will continue to work ), number is the unsigned int32 number received from the server and rconcommands is the actual rcon command string.

If the remote App fails to send the appropriate challenge number, waits too long to send the challenge, or uses an invalid password more than a few times in the course of a few seconds, the remote App will be assumed to be malicious and the actual ip address used by the remote host will be permanently and automatically banned from the server (as with the addip command).  You can use listip to see the list of banned ip addresses on a server.


-----------------------------
Game servers will answer the following messages:
Messages are sent to the server by sending 4 consecutive bytes of 255 (32-bit integer -1) and then the string command followed by a zero byte to terminate it

\"ping\"
   Server responds with the following packet:
   (int32)  -1
   (byte)  ASCII 'j' (general acknowledgement, A2A_ACK)
   (byte)  0

\"info\"
   Server responds with the following packet:
   (int32)  -1
   (byte)  ASCII 'C' (info response, S2A_INFO)
   (string)  net address of server
   (string)  name of the host / server
   (string)  name of the map
   (string)  game directory (i.e. valve/)
   (string)  Game description (e.g. \"half-life multiplay\")
   (byte)  active client count
   (byte)  maximum clients allowed
   (byte)  protocol version

\"players\"
   Server responds with the following packet:
   (int32)  -1
   (byte)  ASCII 'D' (players response, S2A_PLAYER)
   (byte)  active client count

   for each active client
  (byte)  client number / index
  (string)  player name
  (int32)  client's frag total
  (float32)  client's total time in-game

\"rules\"
   Server responds with the following packet:
   (int32)  -1
   (byte)  ASCII 'E' (rules response, S2A_RULES)
   (int16)  number of rules

   for each rule
  (string)  rule name
  (string)  rule value


-------------------

Master server query protocol:

Sent to master:

(byte)    ASCII 'c' ( A2M_GET_SERVERS )

Response from master:

(int32)  -1
(byte)   ASCII 'd' ( M2A_SERVERS )
(byte)   unused

// This is followed by as many 6 byte ip addresses as will fit in the message.  The master currently feeds about 2K worth of IP address ( 300+ or so ), but we may up that # significantly in the near future.

(4 x byte) ip address
(int16)  port #



The old protocol is still valid, but there is a new, extended protocol:

Here are both the old and new protocols ( the new one is the \"details\" message ):

\"info\"
   Server responds with the following packet:
   (int32)  -1
   (byte)  ASCII 'C' (info response, S2A_INFO)
   (string)  net address of server
   (string)  name of the host / server
   (string)  name of the map
   (string)  game directory (i.e. valve/)
   (string)  Game description (e.g. \"half-life multiplay\")
   (byte)  active client count
   (byte)  maximum clients allowed
   (byte)  protocol version

\"details\"
   (int32)      -1
   (byte)  ASCII 'm' ( S2A_INFO_DETAILED )
   (string)  net address of server
   (string)  name of the host / server
   (string)  name of the map
   (string)  game directory (i.e. valve/)
   (string)  Game description (e.g. \"half-life multiplay\")
   (byte)  active client count
   (byte)  maximum clients allowed
   (byte)  protocol version
   (byte)  type of server == 'l' for listen or 'd' for dedicated
   (byte)  os of server == 'w' for win32 or 'l' for linux
   (byte)  password on server == 1 or yes, 0, for no
   (byte)  is server running a mod? == 1 for yes, 0 for no

   IFF the server is running mod byte was 1:

   (string)  URL for mod's \"info\" website
   (string)  URL for mod's download ftp server
   (string)  Empty string, unused (used to be HL version)
   (int32)  mod version #
   (int32)  mod download size ( in bytes, approx. )
   (byte)  is the mod a server side only mod?  1 == yes, 0 == no
   (byte)  does this server require you to have a custom client side .dll ( client.dll )?  1 == yes, 0 == no.

   Protocol extension (SDK 2.3), sent whether or not the mod byte is 0 or 1
   (byte)  server is a secure server == 1 for yes, 0 for no

\"infostring\" (SDK 2.3)
   (int32)      -1
   (string)  \"infostringresponse\"
   (string)  string containing key/value pairs delimited by the '' character.


Here is some code that uses the new protocol.  The first function starts the protocol and the second services the message and requests more ip addresses:

/*
==================
Host_GetBatchServerList_f

  Request full server list from HL master server.
==================
*/
void Host_GetBatchServerList_f( void )
{
   unsigned char c[10];
   adrlist_t *p;
   int i = 0;

   // Request a server list from the master servers.
   NET_Config( true ); // Initialize networking

   if ( gfNoMasterServer )
  return;

   if ( !valvemaster_adr )
  return;

   c[0] = A2M_GET_SERVERS_BATCH;  // ascii 'e'
   i++;

   *(int *)&c[1] = 0; // Request first batch.
   i += sizeof( int );

   p = valvemaster_adr;

   while ( p )
   {
  // send to valve master
  Con_Printf (\"Requesting batch server list from %sn\", NET_AdrToString ( p->adr) );
  NET_SendPacket (NS_CLIENT, i, c, p->adr );
  p = p->next;
   }
}

// Upon receiving ( 5 bytes, 4 for the -1 and 1 byte for the 'f' character ):
int32  -1
M2A_SERVER_BATCH               // Ascii 'f', the response to the above

void CL_ParseBatchServerList( void )
{
   char szAddress[128] = \"\";
   unsigned char cIP[4];
   int i;
   unsigned short iIPPort;
   int nNumAddresses;
   int count = 1;
   int unique = 0;

   MSG_ReadByte(); // Skip r

   unique = MSG_ReadLong();

   // So far we have read 6 chars.  Remainder of message length is iBytesRead - 6
   nNumAddresses = net_message.cursize - sizeof(int) - sizeof(unsigned char) - sizeof(byte);
  
   // Each address is 6 bytes long
   //  
   nNumAddresses /= 6;

   while (nNumAddresses-- > 0)
   {
  memset(szAddress, 0, 128);

  for (i = 0; i < 4; i++)
     cIP = MSG_ReadByte();

  sprintf( szAddress, \"%i.%i.%i.%i\"
     , (int)cIP[0]
     , (int)cIP[1]
     , (int)cIP[2]
     , (int)cIP[3]
  );

  iIPPort = BigShort((unsigned short)MSG_ReadShort());
  
  //if ( count <= 100 )
  //   Con_Printf( \"%4i:  %s:%in\", count, szAddress, iIPPort );
  
  count++;
   }

   Con_Printf( \"%i serversn\", count );

   if ( unique != 0 ) // More servers left, send another request to master
   {
  unsigned char c[10];
  int i = 0;

  // Request a server list from the master servers.
  NET_Config( true ); // Initialize networking

  c[0] = A2M_GET_SERVERS_BATCH;
  i++;

  *(int *)&c[1] = unique; // Request servers starting after this unique id.
  i += sizeof( int );

  // send to valve master
  Con_DPrintf (\"Requesting next batch ( %i ) server list from %sn\", unique, NET_AdrToString ( net_from ) );
  NET_SendPacket (NS_CLIENT, i, c, net_from );
   }
   else
  Con_Printf( \"Done.n\" );
}

Journalisée



DukeNukem
Expert
*****

Karma: 0
Hors ligne Hors ligne

Messages: leet


msn is gay
Voir le profil WWW
« Répondre #2 le: 25 Mai 2003, 11:56:44 »

http://www.game-lab.com/index.php?p=tuts_s...ow&t=3&idtut=63
Journalisée
Anonymous
Invité
« Répondre #3 le: 28 Mai 2003, 11:56:03 »

merci de ses précieuses infos les gars c trop cool je v pouvoir continuer
Journalisée
Anonymous
Invité
« Répondre #4 le: 28 Mai 2003, 16:32:43 »

j'ai un pb sur la ligne

if (!GetMessage (msg, 2048 /* BUFFER_SIZE*/))
        return false;

il me dis impossible de convertir  le tableau char msg  en tagMsg qui est *pBuf

si vous savez comment les convertir ca serai me rendre grand service
Journalisée
Anonymous
Invité
« Répondre #5 le: 03 Juin 2003, 10:20:07 »

voila le probleme est resolu c nikel
allez ciao et encore merci ^^
Journalisée
Pages: [1]
  Envoyer ce fil  |  Imprimer  
 
Aller à:  


Recents
[Aujourd'hui à 05:03:16]

[07 Décembre 2009, 00:46:15]

[04 Novembre 2009, 09:04:54]

[06 Octobre 2009, 10:46:20]

[22 Juillet 2009, 20:53:49]

Sondage
Membres
Total des membres: 7120
Dernier: IgnifsIncag
Stats
Total des messages: 36705
Total des fils de discussion: 3402
En ligne aujourd'hui: 12
En ligne total: 122
(07 Avril 2008, 15:51:10)
Membres en ligne
Utilisateurs: 2
Invités: 6
Total: 8

Propulsé par MySQL Propulsé par PHP création de sites-internet ruby on rails Powered by SMF 1.1 RC3 | SMF © 2001-2005, Lewis Media
TinyPortal v0.9.5 © Bloc
XHTML 1.0 Transitionnel valide ! CSS valide !