コード例 #1
0
bool CNetworkModule::Startup(void)
{
	// Create the socket descriptor
	RakNet::SocketDescriptor socketDescriptor(CVAR_GET_INTEGER("port"), CVAR_GET_STRING("hostaddress").Get());

	// Attempt to startup raknet
	bool bReturn = (m_pRakPeer->Startup(CVAR_GET_INTEGER("maxplayers"), &socketDescriptor, 1, 0) == RakNet::RAKNET_STARTED);

	// Did it start?
	if(bReturn)
	{
		// Set the maximum incoming connections
		m_pRakPeer->SetMaximumIncomingConnections(CVAR_GET_INTEGER("maxplayers"));

		// Get the password string
		CString strPassword = CVAR_GET_STRING("password");

		// Do we have a password?
		if(strPassword.GetLength() > 0)
		{
			// Set the server password
			m_pRakPeer->SetIncomingPassword(strPassword.Get(), strPassword.GetLength());
		}
	}

	// Return
	return bReturn;
}
コード例 #2
0
ファイル: menu_creategame.cpp プロジェクト: bmk10/sing-engine
/*
=================
UI_CreateGame_Begin
=================
*/
static void UI_CreateGame_Begin( void )
{
	if( !MAP_IS_VALID( uiCreateGame.mapName[uiCreateGame.mapsList.curItem] ))
		return;	// bad map

	if( CVAR_GET_FLOAT( "host_serverstate" ) && CVAR_GET_FLOAT( "maxplayers" ) == 1 )
		HOST_ENDGAME( "end of the game" );

	CVAR_SET_FLOAT( "deathmatch", 1.0f );	// FIXME
	CVAR_SET_FLOAT( "maxplayers", atoi( uiCreateGame.maxClients.buffer ));
	CVAR_SET_STRING( "hostname", uiCreateGame.hostName.buffer );
	CVAR_SET_STRING( "defaultmap", uiCreateGame.mapName[uiCreateGame.mapsList.curItem] );

	// all done, start server
	if( uiCreateGame.dedicatedServer.enabled )
	{
		HOST_WRITECONFIG ( CVAR_GET_STRING( "servercfgfile" ));

		char cmd[128];
		sprintf( cmd, "#%s", gMenu.m_gameinfo.gamefolder );

		// NOTE: dedicated server will be executed "defaultmap"
		// from engine after restarting
		HOST_CHANGEGAME( cmd, "Starting dedicated server...\n" );
	}
	else
	{
		HOST_WRITECONFIG ( CVAR_GET_STRING( "lservercfgfile" ));

		char cmd[128];
		sprintf( cmd, "exec %s\nmap %s\n", CVAR_GET_STRING( "lservercfgfile" ), CVAR_GET_STRING( "defaultmap" ));
	
		CLIENT_COMMAND( FALSE, cmd );
	}
}
コード例 #3
0
/*
=================
UI_PlayerSetup_GetConfig
=================
*/
static void UI_PlayerSetup_GetConfig( void )
{
	int	i;

	strncpy( uiPlayerSetup.name.buffer, CVAR_GET_STRING( "name" ), sizeof( uiPlayerSetup.name.buffer ));

	// find models
	UI_PlayerSetup_FindModels();

	// select current model
	for( i = 0; i < uiPlayerSetup.num_models; i++ )
	{
		if( !stricmp( uiPlayerSetup.models[i], CVAR_GET_STRING( "model" )))
		{
			uiPlayerSetup.model.curValue = (float)i;
			break;
		}
	}

	if( gMenu.m_gameinfo.flags & GFL_NOMODELS )
		uiPlayerSetup.model.curValue = 0.0f; // force to default

	strcpy( uiPlayerSetup.currentModel, uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue] );
	uiPlayerSetup.model.maxValue = (float)(uiPlayerSetup.num_models - 1);

	uiPlayerSetup.topColor.curValue = CVAR_GET_FLOAT( "topcolor" ) / 255;
	uiPlayerSetup.bottomColor.curValue = CVAR_GET_FLOAT( "bottomcolor" ) / 255;

	if( CVAR_GET_FLOAT( "cl_himodels" ))
		uiPlayerSetup.hiModels.enabled = 1;

	if( CVAR_GET_FLOAT( "ui_showmodels" ))
		uiPlayerSetup.showModels.enabled = 1;
}
コード例 #4
0
/*
=================
UI_PlayerSetup_GetConfig
=================
*/
static void UI_PlayerSetup_GetConfig( void )
{
	strncpy( uiPlayerSetup.name.buffer, CVAR_GET_STRING( "name" ), sizeof( uiPlayerSetup.name.buffer ));

	char curColor[CS_SIZE];
	int rgb[3];
	strncpy( curColor, CVAR_GET_STRING("cl_crosshair_color"), CS_SIZE);
	sscanf( curColor, "%d %d %d", rgb, rgb + 1, rgb + 2 );

	// check for custom colors
	int i;
	for( i = 0; i < 5; i++)
	{
		if( rgb[0] == g_iCrosshairAvailColors[i][0] &&
			rgb[1] == g_iCrosshairAvailColors[i][1] &&
			rgb[2] == g_iCrosshairAvailColors[i][2] )
		{
			break;
		}
	}

	if( i == 5 )
	{
		strcpy( g_szCrosshairAvailColors[i], curColor );
		g_iCrosshairAvailColors[i][0] = rgb[0];
		g_iCrosshairAvailColors[i][1] = rgb[1];
		g_iCrosshairAvailColors[i][2] = rgb[2];
		uiPlayerSetup.crosshairColor.maxValue = 5;
	}
	else
	{
		g_szCrosshairAvailColors[5][0] = '\0'; // mark that we're not used custom colors
		uiPlayerSetup.crosshairColor.maxValue = 4;
	}

	uiPlayerSetup.crosshairColor.generic.name = g_szCrosshairAvailColors[i];
	uiPlayerSetup.crosshairColor.curValue = i;

	static char crosshairSize[CS_SIZE];
	strncpy( crosshairSize, CVAR_GET_STRING( "cl_crosshair_size" ), CS_SIZE );
    for( i = 0; i < 4; i++ )
	{
		if( !stricmp( crosshairSize, g_szCrosshairAvailSizes[i] ) )
		{
			uiPlayerSetup.crosshairSize.generic.name = g_szCrosshairAvailSizes[i];
			break;
		}
	}
	// fix possible errors
	if( i == 4 )
	{
		uiPlayerSetup.crosshairSize.generic.name = g_szCrosshairAvailSizes[0];
		CVAR_SET_STRING( "cl_crosshair_size", "auto" );
	}
	if( CVAR_GET_FLOAT( "cl_crosshair_translucent") )
		uiPlayerSetup.crosshairTranslucent.enabled = 1;
}
コード例 #5
0
ファイル: CSystemNatives.cpp プロジェクト: DarkKlo/maf2mp
SQInteger CSystemNatives::ServerName( SQVM * pVM )
{
#ifdef _CLIENT
	sq_pushstring( pVM, pCore->GetServerName().Get(), pCore->GetServerName().GetLength() );
#else
	sq_pushstring( pVM, CVAR_GET_STRING( "hostname" ), strlen(CVAR_GET_STRING( "hostname" )) );
#endif
	return 1;
}
コード例 #6
0
CHalfLifeMultiplay :: CHalfLifeMultiplay()
{
	m_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients);
	int length;

	char * pFileList = (char*)LOAD_FILE_FOR_ME( "motd.txt", &length );

	if ( pFileList )
		g_bHaveMOTD = true;
	else
		g_bHaveMOTD = false;

	RefreshSkillData();
	m_flIntermissionEndTime = 0;
	m_flGameEndTime = 0.0;
	
	// 11/8/98
	// Modified by YWB:  Server .cfg file is now a cvar, so that 
	//  server ops can run multiple game servers, with different server .cfg files,
	//  from a single installed directory.
	// Mapcyclefile is already a cvar.

	// 3/31/99
	// Added lservercfg file cvar, since listen and dedicated servers should not
	// share a single config file. (sjb)
	if ( IS_DEDICATED_SERVER() )
	{
		// dedicated server
		char *servercfgfile = (char *)CVAR_GET_STRING( "servercfgfile" );

		if ( servercfgfile && servercfgfile[0] )
		{
			char szCommand[256];
			
			ALERT( at_console, "Executing dedicated server config file\n" );
			sprintf( szCommand, "exec %s\n", servercfgfile );
			SERVER_COMMAND( szCommand );
		}
	}
	else
	{
		// listen server
		char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" );

		if ( lservercfgfile && lservercfgfile[0] )
		{
			char szCommand[256];
			
			ALERT( at_console, "Executing listen server config file\n" );
			sprintf( szCommand, "exec %s\n", lservercfgfile );
			SERVER_COMMAND( szCommand );
		}
	}
}
コード例 #7
0
ファイル: multiplay_gamerules.cpp プロジェクト: Skumek/hlsdk
CHalfLifeMultiplay :: CHalfLifeMultiplay()
{
	g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients);
	
	RefreshSkillData();
	m_flIntermissionEndTime = 0;
	
	// 11/8/98
	// Modified by YWB:  Server .cfg file is now a cvar, so that 
	//  server ops can run multiple game servers, with different server .cfg files,
	//  from a single installed directory.
	// Mapcyclefile is already a cvar.

	// 3/31/99
	// Added lservercfg file cvar, since listen and dedicated servers should not
	// share a single config file. (sjb)
	if ( IS_DEDICATED_SERVER() )
	{
		// this code has been moved into engine, to only run server.cfg once
	}
	else
	{
		// listen server
		char *lservercfgfile = (char *)CVAR_GET_STRING( "lservercfgfile" );

		if ( lservercfgfile && lservercfgfile[0] )
		{
			char szCommand[256];
			
			ALERT( at_console, "Executing listen server config file\n" );
			sprintf( szCommand, "exec %s\n", lservercfgfile );
			SERVER_COMMAND( szCommand );
		}
	}
}
コード例 #8
0
ファイル: menu_gamepad.cpp プロジェクト: Reedych/xash3d
/*
=================
UI_GamePad_GetConfig
=================
*/
static void UI_GamePad_GetConfig( void )
{
	float side, forward, pitch, yaw;
	char binding[7] = { 0 };
	static char lt_threshold_text[8], rt_threshold_text[8];

	strncpy( binding, CVAR_GET_STRING( "joy_axis_binding"), sizeof( binding ));

	side = CVAR_GET_FLOAT( "joy_side" );
	forward = CVAR_GET_FLOAT( "joy_forward" );
	pitch = CVAR_GET_FLOAT( "joy_pitch" );
	yaw = CVAR_GET_FLOAT( "joy_yaw" );

	uiGamePad.side.curValue = fabs( side );
	uiGamePad.forward.curValue = fabs( forward );
	uiGamePad.pitch.curValue = fabs( pitch );
	uiGamePad.yaw.curValue = fabs( yaw );

	uiGamePad.invSide.enabled = side < 0.0f ? true: false;
	uiGamePad.invFwd.enabled = forward < 0.0f ? true: false;
	uiGamePad.invPitch.enabled = pitch < 0.0f ? true: false;
	uiGamePad.invYaw.enabled = yaw < 0.0f ? true: false;

	// I made a monster...
	for( int i = 0; i < sizeof( binding ) - 1; i++ )
	{
		switch( binding[i] )
		{
		case 's':
			uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_SIDE];
			uiGamePad.axisBind[i].curValue = JOY_AXIS_SIDE;
			break;
		case 'f':
			uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_FWD];
			uiGamePad.axisBind[i].curValue = JOY_AXIS_FWD;
			break;
		case 'p':
			uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_PITCH];
			uiGamePad.axisBind[i].curValue = JOY_AXIS_PITCH;
			break;
		case 'y':
			uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_YAW];
			uiGamePad.axisBind[i].curValue = JOY_AXIS_YAW;
			break;
		case 'r':
			uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_RT];
			uiGamePad.axisBind[i].curValue = JOY_AXIS_RT;
			break;
		case 'l':
			uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_LT];
			uiGamePad.axisBind[i].curValue = JOY_AXIS_LT;
			break;
		default:
			uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_NULL];
			uiGamePad.axisBind[i].curValue = JOY_AXIS_NULL;
		}
	}
}
コード例 #9
0
void CHalfLifeMultiplay :: SendMOTDToClient( edict_t *client )
{
	// read from the MOTD.txt file
	int length, char_count = 0;
	char *pFileList;
	char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( (char *)CVAR_GET_STRING( "motdfile" ), &length );

	// send the server name
	MESSAGE_BEGIN( MSG_ONE, gmsgServerName, nullptr, client );
		WRITE_STRING( CVAR_GET_STRING("hostname") );
	MESSAGE_END();

	// Send the message of the day
	// read it chunk-by-chunk,  and send it in parts

	while ( pFileList && *pFileList && char_count < MAX_MOTD_LENGTH )
	{
		char chunk[MAX_MOTD_CHUNK+1];
		
		if ( strlen( pFileList ) < MAX_MOTD_CHUNK )
		{
			strcpy( chunk, pFileList );
		}
		else
		{
			strncpy( chunk, pFileList, MAX_MOTD_CHUNK );
			chunk[MAX_MOTD_CHUNK] = 0;		// strncpy doesn't always append the null terminator
		}

		char_count += strlen( chunk );
		if ( char_count < MAX_MOTD_LENGTH )
			pFileList = aFileList + char_count; 
		else
			*pFileList = 0;

		MESSAGE_BEGIN( MSG_ONE, gmsgMOTD, nullptr, client );
			WRITE_BYTE( *pFileList ? FALSE : TRUE );	// FALSE means there is still more message to come
			WRITE_STRING( chunk );
		MESSAGE_END();
	}

	FREE_FILE( aFileList );
}
コード例 #10
0
ファイル: multiplay_gamerules.cpp プロジェクト: Arkshine/NS
void CHalfLifeMultiplay :: SendMOTDToClient( edict_t *client )
{
	// read from the MOTD.txt file
	int length, char_count = 0;
	char *pFileList;
	char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( (char *)CVAR_GET_STRING( "motdfile" ), &length );

	// send the server name
	NetMsg_ServerName( &client->v, string( CVAR_GET_STRING( "hostname" ) ) );
	
	// Send the message of the day
	// read it chunk-by-chunk,  and send it in parts
	
	while ( pFileList && *pFileList && char_count < MAX_MOTD_LENGTH )
	{
		char chunk[MAX_MOTD_CHUNK+1];
		
		if ( strlen( pFileList ) < MAX_MOTD_CHUNK )
		{
			strcpy( chunk, pFileList );
		}
		else
		{
			strncpy( chunk, pFileList, MAX_MOTD_CHUNK );
			chunk[MAX_MOTD_CHUNK] = 0;		// strncpy doesn't always append the null terminator
		}
		
		char_count += strlen( chunk );
		if ( char_count < MAX_MOTD_LENGTH )
			pFileList = aFileList + char_count; 
		else
			*pFileList = 0;
		
		NetMsg_MOTD( &client->v, *pFileList ? false : true, string( chunk ) );
	}
	
	FREE_FILE( aFileList );
}
コード例 #11
0
void CChatWindow::InitFontAndBackground()
{
	// Load our chat font
	m_pFont = g_pGUI->GetFont(CVAR_GET_STRING("chatfont").Get(), CVAR_GET_INTEGER("chatsize"));

	// Do we not have a valid font?
	if(!m_pFont)
		g_pGUI->ShowMessageBox("Invalid chat font.\nPlease set a valid font in the Chat tab of the Settings menu.", "Warning");

	// Set our background colors
	m_ulBackgroundColor = D3DCOLOR_ARGB(CVAR_GET_INTEGER("chatbga"), 
										CVAR_GET_INTEGER("chatbgr"), 
										CVAR_GET_INTEGER("chatbgg"), 
										CVAR_GET_INTEGER("chatbgb"));
}
コード例 #12
0
ファイル: multiplay_gamerules.cpp プロジェクト: Arkshine/NS
void GetMapNamesFromMapCycle(StringList& outMapNameList)
{
    char* mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" );
    ASSERT( mapcfile != NULL );
    
    char szBuffer[ MAX_RULE_BUFFER ];
    char szMap[ 32 ];
    int length;
    char *pFileList;
    char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( mapcfile, &length );
    int hasbuffer;
    mapcycle_item_s *newlist = NULL;
    
    if ( pFileList && length )
    {
        // the first map name in the file becomes the default
        while ( 1 )
        {
            hasbuffer = 0;
            memset( szBuffer, 0, MAX_RULE_BUFFER );
            
            pFileList = COM_Parse( pFileList );
            if ( strlen( com_token ) <= 0 )
                break;
            
            strcpy( szMap, com_token );
            
            // Any more tokens on this line?
            if ( COM_TokenWaiting( pFileList ) )
            {
                pFileList = COM_Parse( pFileList );
                if ( strlen( com_token ) > 0 )
                {
                    hasbuffer = 1;
                    strcpy( szBuffer, com_token );
                }
            }
            
            // Check map
            if ( IS_MAP_VALID( szMap ) )
            {
                outMapNameList.push_back( szMap );
            }
        }
        
        FREE_FILE( aFileList );
    }
}
コード例 #13
0
bool CSettingsMenu::OnSaveButtonClick(const CEGUI::EventArgs &eventArgs)
{
	bool bWindowed = ((CEGUI::Checkbox *)m_GUIElements.pWindowedCheckBox)->isSelected();
	bool bShowFPS = ((CEGUI::Checkbox *)m_GUIElements.pFPSCheckBox)->isSelected();
	String strNick(m_GUIElements.pNickEditBox->getText().c_str());
	String strFont(m_GUIElements.pChatFontEditBox->getText().c_str());
	String strFontSize(m_GUIElements.pChatFontSizeEditBox->getText().c_str());
	String strBackgroundAlpha(m_GUIElements.pChatBGColorAEditBox->getText().c_str());
	String strBackgroundRed(m_GUIElements.pChatBGColorREditBox->getText().c_str());
	String strBackgroundGreen(m_GUIElements.pChatBGColorGEditBox->getText().c_str());
	String strBackgroundBlue(m_GUIElements.pChatBGColorBEditBox->getText().c_str());

	CVAR_SET_BOOL("windowed", bWindowed);
	CVAR_SET_BOOL("fps", g_pClient->GetFPSToggle());
	g_pClient->SetFPSToggle(bShowFPS);
	CVAR_SET_INTEGER("chatfont", strFont.ToInteger());
	CVAR_SET_INTEGER("chatsize", strFontSize.ToInteger());
	CVAR_SET_INTEGER("chatbga", strBackgroundAlpha.ToInteger());
	CVAR_SET_INTEGER("chatbgr", strBackgroundRed.ToInteger());
	CVAR_SET_INTEGER("chatbgg", strBackgroundGreen.ToInteger());
	CVAR_SET_INTEGER("chatbgb", strBackgroundBlue.ToInteger());

	// Init the chat window font and background
	g_pClient->GetChatWindow()->InitFontAndBackground();

	if(CVAR_GET_STRING("nick").Compare(strNick) != 0)
	{
		CVAR_SET_STRING("nick", strNick);
		g_pClient->SetNick(strNick);

		CNetworkManager * pNetworkManager = g_pClient->GetNetworkManager();
		if(pNetworkManager && pNetworkManager->IsConnected())
		{
			CBitStream bsSend;
			bsSend.Write(strNick);
			pNetworkManager->RPC(RPC_NameChange, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE_ORDERED);
		}
	}

	if(bWindowed != g_pClient->IsWindowedMode())
		g_pClient->GetGUI()->ShowMessageBox("You must restart IV:MP for the windowed mode option to take effect", "Information.");
	
	SetVisible(false);

	return true;
}
コード例 #14
0
ファイル: menu_touchoptions.cpp プロジェクト: Tox86/xash3d
static void UI_TouchOptions_GetProfileList( void )
{
	char	**filenames;
	int	i = 0, numFiles, j = 0;
	char *curprofile;

	strncpy( uiTouchOptions.profileDesc[i], "Presets:", CS_SIZE );
	uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
	i++;

	filenames = FS_SEARCH( "touch_presets/*.cfg", &numFiles, TRUE );
	for ( ; j < numFiles; i++, j++ )
	{
		if( i >= UI_MAXGAMES ) break;

		// strip path, leave only filename (empty slots doesn't have savename)
		COM_FileBase( filenames[j], uiTouchOptions.profileDesc[i] );
		uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
	}

	// Overwrite "Presets:" line if there is no presets
	if( i == 1 )
		i = 0;

	filenames = FS_SEARCH( "touch_profiles/*.cfg", &numFiles, TRUE );
	j = 0;
	curprofile = CVAR_GET_STRING("touch_config_file");

	strncpy( uiTouchOptions.profileDesc[i], "Profiles:", CS_SIZE );
	uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
	i++;

	strncpy( uiTouchOptions.profileDesc[i], "default", CS_SIZE );
	uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];

	uiTouchOptions.profiles.highlight = i;

	uiTouchOptions.firstProfile = i;
	i++;

	for ( ; j < numFiles; i++, j++ )
	{
		if( i >= UI_MAXGAMES ) break;

		COM_FileBase( filenames[j], uiTouchOptions.profileDesc[i] );
		uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
		if( !strcmp( filenames[j], curprofile ) )
			uiTouchOptions.profiles.highlight = i;
	}
	uiTouchOptions.profiles.numItems = i;

	uiTouchOptions.remove.generic.flags |= QMF_GRAYED;
	uiTouchOptions.apply.generic.flags |= QMF_GRAYED;

	if( uiTouchOptions.profiles.generic.charHeight )
	{
		uiTouchOptions.profiles.numRows = (uiTouchOptions.profiles.generic.height2 / uiTouchOptions.profiles.generic.charHeight) - 2;
		if( uiTouchOptions.profiles.numRows > uiTouchOptions.profiles.numItems )
			uiTouchOptions.profiles.numRows = i;
	}

	for ( ; i < UI_MAXGAMES; i++ )
		uiTouchOptions.profileDescPtr[i] = NULL;
	uiTouchOptions.profiles.curItem = uiTouchOptions.profiles.highlight;


	uiTouchOptions.profiles.itemNames = (const char **)uiTouchOptions.profileDescPtr;
}
コード例 #15
0
ファイル: util.cpp プロジェクト: Arkshine/NS
// return team number 0 through 3 based what MOD uses for team numbers
int UTIL_GetTeam(edict_t *pEntity)
{
   if (mod_id == TFC_DLL)
   {
      return pEntity->v.team - 1;  // TFC teams are 1-4 based
   }
   else if (mod_id == CSTRIKE_DLL)
   {
      char *infobuffer;
      char model_name[32];

      infobuffer = (*g_engfuncs.pfnGetInfoKeyBuffer)( pEntity );
      strcpy(model_name, (g_engfuncs.pfnInfoKeyValue(infobuffer, "model")));

      if ((strcmp(model_name, "terror") == 0) ||  // Phoenix Connektion
          (strcmp(model_name, "arab") == 0) ||    // old L337 Krew
          (strcmp(model_name, "leet") == 0) ||    // L337 Krew
          (strcmp(model_name, "artic") == 0) ||   // Artic Avenger
          (strcmp(model_name, "guerilla") == 0))  // Gorilla Warfare
      {
         return 0;
      }
      else if ((strcmp(model_name, "urban") == 0) ||  // Seal Team 6
               (strcmp(model_name, "gsg9") == 0) ||   // German GSG-9
               (strcmp(model_name, "sas") == 0) ||    // UK SAS
               (strcmp(model_name, "gign") == 0) ||   // French GIGN
               (strcmp(model_name, "vip") == 0))      // VIP
      {
         return 1;
      }

      return 0;  // return zero if team is unknown
   }
   else if ((mod_id == GEARBOX_DLL) && (pent_info_ctfdetect != NULL))
   {
      // OpFor CTF map...

      char *infobuffer;
      char model_name[32];

      infobuffer = (*g_engfuncs.pfnGetInfoKeyBuffer)( pEntity );
      strcpy(model_name, (g_engfuncs.pfnInfoKeyValue(infobuffer, "model")));

      if ((strcmp(model_name, "ctf_barney") == 0) ||
          (strcmp(model_name, "cl_suit") == 0) ||
          (strcmp(model_name, "ctf_gina") == 0) ||
          (strcmp(model_name, "ctf_gordon") == 0) ||
          (strcmp(model_name, "otis") == 0) ||
          (strcmp(model_name, "ctf_scientist") == 0))
      {
         return 0;
      }
      else if ((strcmp(model_name, "beret") == 0) ||
               (strcmp(model_name, "drill") == 0) ||
               (strcmp(model_name, "grunt") == 0) ||
               (strcmp(model_name, "recruit") == 0) ||
               (strcmp(model_name, "shephard") == 0) ||
               (strcmp(model_name, "tower") == 0))
      {
         return 1;
      }

      return 0;  // return zero if team is unknown
   }
   else if (mod_id == FRONTLINE_DLL)
   {
      return pEntity->v.team - 1;  // Front Line Force teams are 1-4 based
   }
   else if(mod_id == AVH_DLL)
   {
	   return pEntity->v.team;
   }
   else  // must be HL or OpFor deathmatch...
   {
      char *infobuffer;
      char model_name[32];

      if (team_names[0][0] == 0)
      {
         char *pName;
         char teamlist[MAX_TEAMS*MAX_TEAMNAME_LENGTH];
         int i;

         num_teams = 0;
         strcpy(teamlist, CVAR_GET_STRING("mp_teamlist"));
         pName = teamlist;
         pName = strtok(pName, ";");

         while (pName != NULL && *pName)
         {
            // check that team isn't defined twice
            for (i=0; i < num_teams; i++)
               if (strcmp(pName, team_names[i]) == 0)
                  break;
            if (i == num_teams)
            {
               strcpy(team_names[num_teams], pName);
               num_teams++;
            }
            pName = strtok(NULL, ";");
         }
      }

      infobuffer = (*g_engfuncs.pfnGetInfoKeyBuffer)( pEntity );
      strcpy(model_name, (g_engfuncs.pfnInfoKeyValue(infobuffer, "model")));

      for (int index=0; index < num_teams; index++)
      {
         if (strcmp(model_name, team_names[index]) == 0)
            return index;
      }

      return 0;
   }
}
コード例 #16
0
ファイル: multiplay_gamerules.cpp プロジェクト: Skumek/hlsdk
/*
==============
ChangeLevel

Server is changing to a new level, check mapcycle.txt for map name and setup info
==============
*/
void CHalfLifeMultiplay :: ChangeLevel( void )
{
	static char szPreviousMapCycleFile[ 256 ];
	static mapcycle_t mapcycle;

	char szNextMap[32];
	char szFirstMapInList[32];
	char szCommands[ 1500 ];
	char szRules[ 1500 ];
	int minplayers = 0, maxplayers = 0;
	strcpy( szFirstMapInList, "hldm1" );  // the absolute default level is hldm1

	int	curplayers;
	BOOL do_cycle = TRUE;

	// find the map to change to
	char *mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" );
	ASSERT( mapcfile != NULL );

	szCommands[ 0 ] = '\0';
	szRules[ 0 ] = '\0';

	curplayers = CountPlayers();

	// Has the map cycle filename changed?
	if ( stricmp( mapcfile, szPreviousMapCycleFile ) )
	{
		strcpy( szPreviousMapCycleFile, mapcfile );

		DestroyMapCycle( &mapcycle );

		if ( !ReloadMapCycleFile( mapcfile, &mapcycle ) || ( !mapcycle.items ) )
		{
			ALERT( at_console, "Unable to load map cycle file %s\n", mapcfile );
			do_cycle = FALSE;
		}
	}

	if ( do_cycle && mapcycle.items )
	{
		BOOL keeplooking = FALSE;
		BOOL found = FALSE;
		mapcycle_item_s *item;

		// Assume current map
		strcpy( szNextMap, STRING(gpGlobals->mapname) );
		strcpy( szFirstMapInList, STRING(gpGlobals->mapname) );

		// Traverse list
		for ( item = mapcycle.next_item; item->next != mapcycle.next_item; item = item->next )
		{
			keeplooking = FALSE;

			ASSERT( item != NULL );

			if ( item->minplayers != 0 )
			{
				if ( curplayers >= item->minplayers )
				{
					found = TRUE;
					minplayers = item->minplayers;
				}
				else
				{
					keeplooking = TRUE;
				}
			}

			if ( item->maxplayers != 0 )
			{
				if ( curplayers <= item->maxplayers )
				{
					found = TRUE;
					maxplayers = item->maxplayers;
				}
				else
				{
					keeplooking = TRUE;
				}
			}

			if ( keeplooking )
				continue;

			found = TRUE;
			break;
		}

		if ( !found )
		{
			item = mapcycle.next_item;
		}			
		
		// Increment next item pointer
		mapcycle.next_item = item->next;

		// Perform logic on current item
		strcpy( szNextMap, item->mapname );

		ExtractCommandString( item->rulebuffer, szCommands );
		strcpy( szRules, item->rulebuffer );
	}

	if ( !IS_MAP_VALID(szNextMap) )
	{
		strcpy( szNextMap, szFirstMapInList );
	}

	g_fGameOver = TRUE;

	ALERT( at_console, "CHANGE LEVEL: %s\n", szNextMap );
	if ( minplayers || maxplayers )
	{
		ALERT( at_console, "PLAYER COUNT:  min %i max %i current %i\n", minplayers, maxplayers, curplayers );
	}
	if ( strlen( szRules ) > 0 )
	{
		ALERT( at_console, "RULES:  %s\n", szRules );
	}
	
	CHANGE_LEVEL( szNextMap, NULL );
	if ( strlen( szCommands ) > 0 )
	{
		SERVER_COMMAND( szCommands );
	}
}
コード例 #17
0
// getServerPassword()
int CServerNatives::GetPassword(lua_State * pVM)
{
	String sPass = CVAR_GET_STRING("password");
	script_pushlstring(pVM, sPass.C_String(), sPass.GetLength());
	return 1;
}
コード例 #18
0
/*
=================
UI_CreateGame_Init
=================
*/
static void UI_CreateGame_Init( void )
{
	memset( &uiCreateGame, 0, sizeof( uiCreateGame_t ));

	uiCreateGame.menu.vidInitFunc = UI_CreateGame_Init;
	uiCreateGame.menu.keyFunc = UI_CreateGame_KeyFunc;

	StringConcat( uiCreateGame.hintText, "Map", MAPNAME_LENGTH );
	StringConcat( uiCreateGame.hintText, uiEmptyString, MAPNAME_LENGTH );
	StringConcat( uiCreateGame.hintText, "Title", TITLE_LENGTH );
	StringConcat( uiCreateGame.hintText, uiEmptyString, TITLE_LENGTH );

	uiCreateGame.background.generic.id = ID_BACKGROUND;
	uiCreateGame.background.generic.type = QMTYPE_BITMAP;
	uiCreateGame.background.generic.flags = QMF_INACTIVE;
	uiCreateGame.background.generic.x = 0;
	uiCreateGame.background.generic.y = 0;
	uiCreateGame.background.generic.width = 1024;
	uiCreateGame.background.generic.height = 768;
	uiCreateGame.background.pic = ART_BACKGROUND;

	uiCreateGame.banner.generic.id = ID_BANNER;
	uiCreateGame.banner.generic.type = QMTYPE_BITMAP;
	uiCreateGame.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
	uiCreateGame.banner.generic.x = UI_BANNER_POSX;
	uiCreateGame.banner.generic.y = UI_BANNER_POSY;
	uiCreateGame.banner.generic.width = UI_BANNER_WIDTH;
	uiCreateGame.banner.generic.height = UI_BANNER_HEIGHT;
	uiCreateGame.banner.pic = ART_BANNER;

	uiCreateGame.advOptions.generic.id = ID_ADVOPTIONS;
	uiCreateGame.advOptions.generic.type = QMTYPE_BM_BUTTON;
	uiCreateGame.advOptions.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_GRAYED;
	uiCreateGame.advOptions.generic.x = 72;
	uiCreateGame.advOptions.generic.y = 230;
	uiCreateGame.advOptions.generic.name = "Adv. Options";
	uiCreateGame.advOptions.generic.statusText = "Open the LAN game advanced options menu";
	uiCreateGame.advOptions.generic.callback = UI_CreateGame_Callback;

	UI_UtilSetupPicButton( &uiCreateGame.advOptions, PC_ADV_OPT );

	uiCreateGame.done.generic.id = ID_DONE;
	uiCreateGame.done.generic.type = QMTYPE_BM_BUTTON;
	uiCreateGame.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
	uiCreateGame.done.generic.x = 72;
	uiCreateGame.done.generic.y = 280;
	uiCreateGame.done.generic.name = "Ok";
	uiCreateGame.done.generic.statusText = "Start the multiplayer game";
	uiCreateGame.done.generic.callback = UI_CreateGame_Callback;

	UI_UtilSetupPicButton( &uiCreateGame.done, PC_OK );

	uiCreateGame.cancel.generic.id = ID_CANCEL;
	uiCreateGame.cancel.generic.type = QMTYPE_BM_BUTTON;
	uiCreateGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
	uiCreateGame.cancel.generic.x = 72;
	uiCreateGame.cancel.generic.y = 330;
	uiCreateGame.cancel.generic.name = "Cancel";
	uiCreateGame.cancel.generic.statusText = "Return to LAN game menu";
	uiCreateGame.cancel.generic.callback = UI_CreateGame_Callback;

	UI_UtilSetupPicButton( &uiCreateGame.cancel, PC_CANCEL );

	uiCreateGame.dedicatedServer.generic.id = ID_DEDICATED;
	uiCreateGame.dedicatedServer.generic.type = QMTYPE_CHECKBOX;
	uiCreateGame.dedicatedServer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
	uiCreateGame.dedicatedServer.generic.name = "Dedicated server";
	uiCreateGame.dedicatedServer.generic.x = 72;
	uiCreateGame.dedicatedServer.generic.y = 685;
	uiCreateGame.dedicatedServer.generic.callback = UI_CreateGame_Callback;
	uiCreateGame.dedicatedServer.generic.statusText = "faster, but you can't join the server from this machine";

	uiCreateGame.hltv.generic.id = ID_HLTV;
	uiCreateGame.hltv.generic.type = QMTYPE_CHECKBOX;
	uiCreateGame.hltv.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
	uiCreateGame.hltv.generic.name = "HLTV";
	uiCreateGame.hltv.generic.x = 72;
	uiCreateGame.hltv.generic.y = 635;
	uiCreateGame.hltv.generic.callback = UI_CreateGame_Callback;
	uiCreateGame.hltv.generic.statusText = "enable hltv mode in multiplayer";

	uiCreateGame.hintMessage.generic.id = ID_TABLEHINT;
	uiCreateGame.hintMessage.generic.type = QMTYPE_ACTION;
	uiCreateGame.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
	uiCreateGame.hintMessage.generic.color = uiColorHelp;
	uiCreateGame.hintMessage.generic.name = uiCreateGame.hintText;
	uiCreateGame.hintMessage.generic.x = 590;
	uiCreateGame.hintMessage.generic.y = 215;

	uiCreateGame.mapsList.generic.id = ID_MAPLIST;
	uiCreateGame.mapsList.generic.type = QMTYPE_SCROLLLIST;
	uiCreateGame.mapsList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
	uiCreateGame.mapsList.generic.x = 590;
	uiCreateGame.mapsList.generic.y = 245;
	uiCreateGame.mapsList.generic.width = 410;
	uiCreateGame.mapsList.generic.height = 440;
	uiCreateGame.mapsList.generic.callback = UI_CreateGame_Callback;

	uiCreateGame.hostName.generic.id = ID_HOSTNAME;
	uiCreateGame.hostName.generic.type = QMTYPE_FIELD;
	uiCreateGame.hostName.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
	uiCreateGame.hostName.generic.name = "Server Name:";
	uiCreateGame.hostName.generic.x = 350;
	uiCreateGame.hostName.generic.y = 260;
	uiCreateGame.hostName.generic.width = 205;
	uiCreateGame.hostName.generic.height = 32;
	uiCreateGame.hostName.generic.callback = UI_CreateGame_Callback;
	uiCreateGame.hostName.maxLength = 16;
	strcpy( uiCreateGame.hostName.buffer, CVAR_GET_STRING( "hostname" ));

	uiCreateGame.maxClients.generic.id = ID_MAXCLIENTS;
	uiCreateGame.maxClients.generic.type = QMTYPE_FIELD;
	uiCreateGame.maxClients.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NUMBERSONLY;
	uiCreateGame.maxClients.generic.name = "Max Players:";
	uiCreateGame.maxClients.generic.x = 350;
	uiCreateGame.maxClients.generic.y = 360;
	uiCreateGame.maxClients.generic.width = 205;
	uiCreateGame.maxClients.generic.height = 32;
	uiCreateGame.maxClients.maxLength = 3;

	if( CVAR_GET_FLOAT( "maxplayers" ) <= 1 )
		strcpy( uiCreateGame.maxClients.buffer, "8" );
	else sprintf( uiCreateGame.maxClients.buffer, "%i", (int)CVAR_GET_FLOAT( "maxplayers" ));

	uiCreateGame.password.generic.id = ID_PASSWORD;
	uiCreateGame.password.generic.type = QMTYPE_FIELD;
	uiCreateGame.password.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDEINPUT;
	uiCreateGame.password.generic.name = "Password:"******"Starting a new game will exit";
	uiCreateGame.dlgMessage1.generic.x = 248;
	uiCreateGame.dlgMessage1.generic.y = 280;

	uiCreateGame.dlgMessage2.generic.id = ID_MSGTEXT;
	uiCreateGame.dlgMessage2.generic.type = QMTYPE_ACTION;
	uiCreateGame.dlgMessage2.generic.flags = QMF_INACTIVE|QMF_HIDDEN|QMF_DROPSHADOW;
	uiCreateGame.dlgMessage2.generic.name = "any current game, OK to exit?";
	uiCreateGame.dlgMessage2.generic.x = 248;
	uiCreateGame.dlgMessage2.generic.y = 310;

	uiCreateGame.yes.generic.id = ID_YES;
	uiCreateGame.yes.generic.type = QMTYPE_BM_BUTTON;
	uiCreateGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN|QMF_DROPSHADOW;
	uiCreateGame.yes.generic.name = "Ok";
	uiCreateGame.yes.generic.x = 380;
	uiCreateGame.yes.generic.y = 460;
	uiCreateGame.yes.generic.callback = UI_CreateGame_Callback;

	UI_UtilSetupPicButton( &uiCreateGame.yes, PC_OK );

	uiCreateGame.no.generic.id = ID_NO;
	uiCreateGame.no.generic.type = QMTYPE_BM_BUTTON;
	uiCreateGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN|QMF_DROPSHADOW;
	uiCreateGame.no.generic.name = "Cancel";
	uiCreateGame.no.generic.x = 530;
	uiCreateGame.no.generic.y = 460;
	uiCreateGame.no.generic.callback = UI_CreateGame_Callback;

	UI_UtilSetupPicButton( &uiCreateGame.no, PC_CANCEL );

	UI_CreateGame_GetMapsList();

	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.background );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.banner );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.advOptions );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.done );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.cancel );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.maxClients );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.hostName );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.password );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dedicatedServer );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.hltv );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.hintMessage );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.mapsList );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.msgBox );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dlgMessage1 );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dlgMessage2 );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.no );
	UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.yes );
}
コード例 #19
0
// getHostname()
SQInteger CServerNatives::GetHostName(SQVM * pVM)
{
	sq_pushstring(pVM, CVAR_GET_STRING("hostname"), -1);
	return 1;
}
コード例 #20
0
void CServerRPCHandler::PlayerConnect(CBitStream * pBitStream, CPlayerSocket * pSenderSocket)
{
	// Ensure we have a valid bit stream
	if(!pBitStream)
		return;

	// Read packet data
	EntityId playerId = pSenderSocket->playerId;
	int iVersion;
	pBitStream->Read(iVersion);

	String strName;
	pBitStream->Read(strName);

	CheckGTAFiles pCheckFiles;
	bool bGameFilesModded = false;
	pBitStream->Read((char *)&pCheckFiles, sizeof(CheckGTAFiles));

	if(pCheckFiles.bGTAFileChecksum || pCheckFiles.bHandleFileChanged) {
		if(CVAR_GET_BOOL("checkGTAFiles"))
			CLogFile::Printf("[FileCheckSum] Warning, detected modded GTA IV files at player %s", strName.Get());

		bGameFilesModded = true;
	}

	// Apply serial and ip
	String strIP = pSenderSocket->GetAddress(true);
	String strSerial = pSenderSocket->GetSerial();

	// Setup our reply packet
	CBitStream bsSend;
	
	// Check for matching network versions
	if(iVersion != NETWORK_VERSION)
	{
		bsSend.Write(REFUSE_REASON_INVALID_VERSION);
		g_pNetworkManager->RPC(RPC_ConnectionRefused, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE, playerId, false);
		CLogFile::Printf("[Connect] Authorization for %s (%s) failed (Invalid version (Client: %x, Server: %x))!", strIP.Get(), strName.Get(), iVersion, NETWORK_VERSION);
		return;
	}

	// Check that their name is valid
	if(strName.IsEmpty() || strName.GetLength() > MAX_NAME_LENGTH)
	{
		bsSend.Write(REFUSE_REASON_NAME_INVALID);
		g_pNetworkManager->RPC(RPC_ConnectionRefused, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE, playerId, false);
		CLogFile::Printf("[Connect] Authorization for %s (%s) failed (name invalid).", strIP.Get(), strName.Get());
		return;
	}

	// Check that their name is not already in use
	if(g_pPlayerManager->IsNameInUse(strName))
	{
		bsSend.Write(REFUSE_REASON_NAME_IN_USE);
		g_pNetworkManager->RPC(RPC_ConnectionRefused, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE, playerId, false);
		CLogFile::Printf("[Connect] Authorization for %s (%s) failed (name in use).", strIP.Get(), strName.Get());
		return;
	}

	CSquirrelArguments nameCheckArguments;
	nameCheckArguments.push(playerId);
	nameCheckArguments.push(strName);

	if(g_pEvents->Call("playerNameCheck", &nameCheckArguments).GetInteger() != 1)
	{
		bsSend.Write(REFUSE_REASON_NAME_INVALID);
		g_pNetworkManager->RPC(RPC_ConnectionRefused, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE, playerId, false);
		CLogFile::Printf("[Connect] Authorization for %s (%s) failed (name invalid).", strIP.Get(), strName.Get());
		return;
	}

	// Call the playerAuth event, and process the return value
	CSquirrelArguments playerAuthArguments;
	playerAuthArguments.push(playerId);
	playerAuthArguments.push(strName);
	playerAuthArguments.push(strIP);
	playerAuthArguments.push(strSerial);
	playerAuthArguments.push(bGameFilesModded);

	if(g_pEvents->Call("playerAuth", &playerAuthArguments).GetInteger() != 1)
	{
		bsSend.Write(REFUSE_REASON_ABORTED_BY_SCRIPT);
		g_pNetworkManager->RPC(RPC_ConnectionRefused, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE, playerId, false);
		CLogFile::Printf("[Connect] Authorization for %s (%s) failed (aborted by script).", strIP.Get(), strName.Get());
		return;
	}

	CLogFile::Printf("[Connect] Authorization for %s (%s) complete.", strIP.Get(), strName.Get());

	// Setup the player
	g_pPlayerManager->Add(playerId, strName);
	CPlayer * pPlayer = g_pPlayerManager->GetAt(playerId);
	
	// Check player creation
	if(!pPlayer)
	{
		CLogFile::Printf("[Connect] Failed to create player instance for %s.", strName.Get());
		return;
	}

	// Apply files
	pPlayer->SetFileCheck(pCheckFiles);

	// Let the vehicle manager handle the client join
	g_pVehicleManager->HandleClientJoin(playerId);

	// Let the player manager handle the client join
	g_pPlayerManager->HandleClientJoin(playerId);

	// Let the object manager handle the client join
	g_pObjectManager->HandleClientJoin(playerId);

	// Let the fire manager handle the client join
	g_pObjectManager->HandleClientJoinFire(playerId);

	// Let the blip manager handle the client join
	g_pBlipManager->HandleClientJoin(playerId);

	// Let the checkpoint manager handle the client join
	g_pCheckpointManager->HandleClientJoin(playerId);

	// Let the pickup manager handle the client join
	g_pPickupManager->HandleClientJoin(playerId);

	// Let the actor manager handle the client join
	g_pActorManager->HandleClientJoin(playerId);

	g_p3DLabelManager->HandleClientJoin(playerId);

	// Construct the reply bit stream
	bsSend.Write(playerId);
	bsSend.Write(CVAR_GET_STRING("hostname"));
	bsSend.WriteBit(CVAR_GET_BOOL("paynspray"));
	bsSend.WriteBit(CVAR_GET_BOOL("autoaim"));
	bsSend.Write(pPlayer->GetColor());
	bsSend.Write(CVAR_GET_STRING("httpserver"));
	bsSend.Write((unsigned short)CVAR_GET_INTEGER("httpport"));
	bsSend.Write((unsigned char)CVAR_GET_INTEGER("weather"));
	bsSend.WriteBit(CVAR_GET_BOOL("guinametags"));
	bsSend.WriteBit(CVAR_GET_BOOL("vehicledamage"));
	bsSend.WriteBit(CVAR_GET_BOOL("vehiclewaterdeath"));
	bsSend.WriteBit(CVAR_GET_BOOL("headmovement"));
	bsSend.Write(CVAR_GET_INTEGER("maxplayers"));

	// Time
	unsigned char ucHour = 0, ucMinute = 0;
	g_pTime->GetTime(&ucHour, &ucMinute);
	bsSend.Write((unsigned char)(ucHour + (24 * (1 + g_pTime->GetDayOfWeek()))));
	bsSend.Write(ucMinute);

	if(g_pTime->GetMinuteDuration() != CTime::DEFAULT_MINUTE_DURATION)
	{
		bsSend.Write1();
		bsSend.Write(g_pTime->GetMinuteDuration());
	}
	else
		bsSend.Write0();

	// Traffic Lights
	bsSend.Write((unsigned char)g_pTrafficLights->GetSetState());
	bsSend.Write(g_pTrafficLights->GetTimeThisCylce());

	if(g_pTrafficLights->GetSetState() != CTrafficLights::TRAFFIC_LIGHT_STATE_DISABLED_DISABLED)
	{
		if(g_pTrafficLights->IsLocked())
			bsSend.Write1();
		else
			bsSend.Write0();

		if(!g_pTrafficLights->IsUsingDefaultDurations())
		{
			bsSend.Write1();
			if(g_pTrafficLights->GetSetState() >= CTrafficLights::TRAFFIC_LIGHT_STATE_FLASHING_FLASHING)
				bsSend.Write(g_pTrafficLights->GetYellowDuration());
			else
			{
				bsSend.Write(g_pTrafficLights->GetGreenDuration());
				bsSend.Write(g_pTrafficLights->GetYellowDuration());
				bsSend.Write(g_pTrafficLights->GetRedDuration());
			}
		}
		else
			bsSend.Write0();
	}

	// Send the joined game RPC
	g_pNetworkManager->RPC(RPC_JoinedGame, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE_ORDERED, playerId, false);

	// Inform the resource file manager of the client join
	g_pClientResourceFileManager->HandleClientJoin(playerId);

	// Inform the script file manager of the client join
	g_pClientScriptFileManager->HandleClientJoin(playerId);

	CLogFile::Printf("[Join] %s (%d) is joining the game.", strName.Get(), playerId);

	CSquirrelArguments playerConnectArguments;
	playerConnectArguments.push(playerId);
	playerConnectArguments.push(strName);
	g_pEvents->Call("playerConnect", &playerConnectArguments);
}
コード例 #21
0
ファイル: Main.cpp プロジェクト: TheFRiChicken/ivmultiplayer
BOOL APIENTRY DllMain(HMODULE hModule, DWORD fdwReason, LPVOID lpReserved)
{
	switch(fdwReason)
	{
	case DLL_PROCESS_ATTACH:
		{
			// Disable thread library notifications
			DisableThreadLibraryCalls(hModule);

			// Install the exception handler
			CExceptionHandler::Install();

			// Delete chatlog
			CLogFile::Open("Chatlog.log");
			CLogFile::Printf("New chatlog created!");
			CLogFile::Close();

			// Open the log file
			CLogFile::Open("Client.log");

			// Log the version
			CLogFile::Printf(VERSION_IDENTIFIER "| " __DATE__ " - " __TIME__ "");

			// Open the settings file
			CSettings::Open(SharedUtility::GetAbsolutePath("clientsettings.xml"));

			// Parse the command line
			CSettings::ParseCommandLine(GetCommandLine());

			// Load the global vars from the settings
			g_strHost = CVAR_GET_STRING("ip");
			g_usPort = CVAR_GET_INTEGER("port");
			g_strNick = CVAR_GET_STRING("nick");
			g_strPassword = CVAR_GET_STRING("pass");
			g_bWindowedMode = CVAR_GET_BOOL("windowed");
			g_bFPSToggle = CVAR_GET_BOOL("fps");

			// IE9 fix - disabled if disableie9fix is set or shift is pressed
			if(!CVAR_GET_BOOL("disableie9fix") || GetAsyncKeyState(VK_SHIFT) > 0)
			{
				// Get the version info
				DWORD dwHandle;
				DWORD dwSize = GetFileVersionInfoSize("wininet.dll", &dwHandle);
				BYTE* byteFileInfo = new BYTE[dwSize];
				GetFileVersionInfo("wininet.dll", dwHandle, dwSize, byteFileInfo);

				unsigned int uiLen;
				VS_FIXEDFILEINFO* fileInfo;
				VerQueryValue(byteFileInfo, "\\", (LPVOID *)&fileInfo, &uiLen);
				delete byteFileInfo;

				// using IE9?
				if(fileInfo->dwFileVersionMS == 0x90000)
				{
					// Try and load a wininet.dll from the iv:mp directory
					if(!LoadLibrary(SharedUtility::GetAbsolutePath("wininet.dll")))
					{
						// Get path to it
						char szFindPath[MAX_PATH] = {0};
						char szWinSxsPath[MAX_PATH] = {0};
						char szBuildVersion[] = "00000";
						GetEnvironmentVariable("windir", szWinSxsPath, sizeof(szWinSxsPath));
						strcat_s(szWinSxsPath, sizeof(szWinSxsPath), "\\WinSxS\\");
						strcpy_s(szFindPath, sizeof(szFindPath), szWinSxsPath);
						strcat_s(szFindPath, sizeof(szFindPath), "x86_microsoft-windows-i..tocolimplementation_31bf3856ad364e35*");

						// try to find a usable wininet.dll in WinSXS (basically any non-9.x version)
						bool bLoaded = false;
						WIN32_FIND_DATA lpFindFileData;
						HANDLE hFindFile = FindFirstFile(szFindPath, &lpFindFileData);
						do
						{
							if(hFindFile == INVALID_HANDLE_VALUE)
								break;

							if(strlen(lpFindFileData.cFileName) > 63)
							{
								if(lpFindFileData.cFileName[62] < '9')
								{
									char szFullPath[MAX_PATH];
									sprintf_s(szFullPath, MAX_PATH, "%s%s\\wininet.dll", szWinSxsPath, lpFindFileData.cFileName);
									if(LoadLibrary(szFullPath))
									{
										CLogFile::Printf("Using %s to address IE9 issue", szFullPath);
										bLoaded = true;
										break;
									}
								}
							}
						}
						while(FindNextFile(hFindFile, &lpFindFileData));

						// Still failed, tell the user
						if(!bLoaded)
						{
							if(MessageBox(0, "Unfortunately, you have Internet Explorer 9 installed which is not compatible with GTA:IV. Do you want proceed anyway (and possibly crash?)", "IV:MP", MB_YESNO | MB_ICONERROR) == IDNO)
							{
								// Doesn't want to continue
								ExitProcess(0);
							}

							// Save the user's choice
							CVAR_SET_BOOL("disableie9fix", true);
						}
					}
				}
			}

			// Initialize the streamer
			g_pStreamer = new CStreamer();

			// Initialize the time
			g_pTime = new CTime();

			// Initialize the traffic lights
			g_pTrafficLights = new CTrafficLights();

			// Initialize the client task manager
			g_pClientTaskManager = new CClientTaskManager();

			// Initialize the game
			CGame::Initialize();

			// Install the XLive hook
			CXLiveHook::Install();

			// Install the Direct3D hook
			CDirect3DHook::Install();

			// Install the DirectInput hook
			CDirectInputHook::Install();

			// Install the Cursor hook
#ifdef IVMP_DEBUG
			CCursorHook::Install();
			g_pDebugView = new CDebugView();
#endif
			// Initialize the client script manager
			g_pClientScriptManager = new CClientScriptManager();

			// Initialize the events manager
			g_pEvents = new CEvents();

			// Initialize the network module, if it fails, exit
			if(!CNetworkModule::Init())
			{
				CLogFile::Printf("Failed to initialize the network module!\n");
				ExitProcess(0);
			}

			// Initialize the file transfer
			g_pFileTransfer = new CFileTransfer();

			// Initialize audio manager
			CAudioManager::Init();
		}
		break;
	case DLL_PROCESS_DETACH:
		{

			// Delete our file transfer
			SAFE_DELETE(g_pFileTransfer);

			// Delete our camera
			SAFE_DELETE(g_pCamera);

			// Delete our model manager
			SAFE_DELETE(g_pModelManager);

			// Delete our pickup manager
			SAFE_DELETE(g_pPickupManager);

			// Delete our checkpoint manager
			SAFE_DELETE(g_pCheckpointManager);

			// Delete our object manager
			SAFE_DELETE(g_pObjectManager);

			// Delete our blip manager
			SAFE_DELETE(g_pBlipManager);

			// Delete our actor manager
			SAFE_DELETE(g_pActorManager);

			// Delete our vehicle manager
			SAFE_DELETE(g_pVehicleManager);

			// Delete our local player
			SAFE_DELETE(g_pLocalPlayer);

			// Delete our player manager
			SAFE_DELETE(g_pPlayerManager);

			// Delete our network manager
			SAFE_DELETE(g_pNetworkManager);

			// Delete our name tags
			SAFE_DELETE(g_pNameTags);

			// Delete our input window
			SAFE_DELETE(g_pInputWindow);

			// Delete our chat window
			SAFE_DELETE(g_pChatWindow);

			// Delete our fps counter
			SAFE_DELETE(g_pFPSCounter);

#ifdef IVMP_DEBUG
			// Delete out debug viewer
			SAFE_DELETE(g_pDebugView);
#endif
			// Delete our credits
			SAFE_DELETE(g_pCredits);

			// Delete our main menu
			SAFE_DELETE(g_pMainMenu);

			// Delete our gui
			SAFE_DELETE(g_pGUI);

			// Delete our streamer class
			SAFE_DELETE(g_pStreamer);

			// Delete our time class
			SAFE_DELETE(g_pTime);

			// Delete our traffic lights
			SAFE_DELETE(g_pTrafficLights);

			// Delete our client script manager
			SAFE_DELETE(g_pClientScriptManager);

			// Delete our client task manager
			SAFE_DELETE(g_pClientTaskManager);

			// Delete our events manager
			SAFE_DELETE(g_pEvents);

			// Uninstall the Cursor hook
#ifdef IVMP_DEBUG
			CCursorHook::Uninstall();
#endif

			// Uninstall the DirectInput hook
			CDirectInputHook::Uninstall();

			// Uninstall the Direct3D hook
			CDirect3DHook::Uninstall();

			// Shutdown audio manager
			CAudioManager::SetAllVolume(0.0f);
			CAudioManager::RemoveAll();

			// Shutdown our game
			CGame::Shutdown();

			// Close the settings file
			CSettings::Close();

			// Close the log file
			CLogFile::Close();

			// Uninstall the XLive hook
			//CXLiveHook::Uninstall(); // Not needed
		}
		break;
	}

	return TRUE;
}
コード例 #22
0
// getServerPassword()
SQInteger CServerNatives::GetPassword(SQVM * pVM)
{
	String sPass = CVAR_GET_STRING("password");
	sq_pushstring(pVM, sPass.C_String(), sPass.GetLength());
	return 1;
}
コード例 #23
0
// getHostname()
int CServerNatives::GetHostName(lua_State * pVM)
{
	script_pushstring(pVM, CVAR_GET_STRING("hostname"));
	return 1;
}
コード例 #24
0
CSettingsMenu::CSettingsMenu(void)
{
	assert(!m_pSingleton);

	// Set our singleton
	m_pSingleton = this;

	// Set up the GUI
	CGUI * pGUI = g_pClient->GetGUI();

	float fWidth = (float)pGUI->GetDisplayWidth();
	float fHeight = (float)pGUI->GetDisplayHeight();

	m_GUIElements.pWindow = pGUI->CreateGUIFrameWindow();
	m_GUIElements.pWindow->setText("Settings");
	m_GUIElements.pWindow->setSize(CEGUI::UVector2(CEGUI::UDim(0, 520), CEGUI::UDim(0, 390)));
	m_GUIElements.pWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, fWidth/2-260), CEGUI::UDim(0, fHeight/2-190)));
	m_GUIElements.pWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&CSettingsMenu::OnCloseClick, this));
	m_GUIElements.pWindow->setVisible(false);

	m_GUIElements.pTabControl = pGUI->CreateGUITabControl();
	m_GUIElements.pWindow->addChildWindow( m_GUIElements.pTabControl );
	m_GUIElements.pTabControl->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(0.8f, 0)));

	m_GUIElements.pGeneralPane = pGUI->CreateGUITabContentPane();
	m_GUIElements.pGeneralPane->setText("General");
	m_GUIElements.pTabControl->addChildWindow( m_GUIElements.pGeneralPane );
	m_GUIElements.pGeneralPane->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));

	m_GUIElements.pChatPane = pGUI->CreateGUITabContentPane();
	m_GUIElements.pChatPane->setText("Chat");
	m_GUIElements.pTabControl->addChildWindow( m_GUIElements.pChatPane );
	m_GUIElements.pChatPane->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));

	m_GUIElements.pNickStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane);
	m_GUIElements.pNickStaticText->setText("Name");
	m_GUIElements.pNickStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pNickStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.2f, 0)));
	m_GUIElements.pNickStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pNickStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pNickStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pNickEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pGeneralPane);
	m_GUIElements.pNickEditBox->setText(CGUI::AnsiToCeguiFriendlyString(g_pClient->GetNick()));
	m_GUIElements.pNickEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pNickEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.3f, 0)));

	m_GUIElements.pWindowedStaticText= pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane);
	m_GUIElements.pWindowedStaticText->setText("Windowed");
	m_GUIElements.pWindowedStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pWindowedStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.5f, 0)));
	m_GUIElements.pWindowedStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pWindowedStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pWindowedStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pWindowedCheckBox = pGUI->CreateGUICheckBox(m_GUIElements.pGeneralPane);
	CEGUI::Checkbox * pCheckBox = (CEGUI::Checkbox *)m_GUIElements.pWindowedCheckBox;
	pCheckBox->setSelected(g_pClient->IsWindowedMode());
	m_GUIElements.pWindowedCheckBox->setText("");
	m_GUIElements.pWindowedCheckBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pWindowedCheckBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pFPSStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane);
	m_GUIElements.pFPSStaticText->setText("Show FPS");
	m_GUIElements.pFPSStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pFPSStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.6f, 0)));
	m_GUIElements.pFPSStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pFPSStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pFPSStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pFPSCheckBox = pGUI->CreateGUICheckBox(m_GUIElements.pGeneralPane);
	CEGUI::Checkbox * pCheckBox2 = (CEGUI::Checkbox *)m_GUIElements.pFPSCheckBox;
	pCheckBox2->setSelected(g_pClient->GetFPSToggle());
	m_GUIElements.pFPSCheckBox->setText("");
	m_GUIElements.pFPSCheckBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pFPSCheckBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.6f, 0)));


	m_GUIElements.pChatFontSizeStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pChatPane);
	m_GUIElements.pChatFontSizeStaticText->setText("Chatfont/Fontsize");
	m_GUIElements.pChatFontSizeStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatFontSizeStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.2f, 0)));
	m_GUIElements.pChatFontSizeStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pChatFontSizeStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pChatFontSizeStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pChatFontEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatFontEditBox->setText(CVAR_GET_STRING("chatfont").Get());
	m_GUIElements.pChatFontEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatFontEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.3f, 0)));

	m_GUIElements.pChatFontSizeEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatFontSizeEditBox->setText(CVAR_GET_EX("chatsize").Get());
	m_GUIElements.pChatFontSizeEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatFontSizeEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.65f, 0), CEGUI::UDim(0.3f, 0)));

	m_GUIElements.pChatBackgroundStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pChatPane);
	m_GUIElements.pChatBackgroundStaticText->setText("Background (A,R,G,B)");
	m_GUIElements.pChatBackgroundStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBackgroundStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.4f, 0)));
	m_GUIElements.pChatBackgroundStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pChatBackgroundStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pChatBackgroundStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pChatBGColorAEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorAEditBox->setText(CVAR_GET_EX("chatbga").Get());
	m_GUIElements.pChatBGColorAEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorAEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pChatBGColorREditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorREditBox->setText(CVAR_GET_EX("chatbgr").Get());
	m_GUIElements.pChatBGColorREditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorREditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.35f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pChatBGColorGEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorGEditBox->setText(CVAR_GET_EX("chatbgg").Get());
	m_GUIElements.pChatBGColorGEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorGEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pChatBGColorBEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorBEditBox->setText(CVAR_GET_EX("chatbgb").Get());
	m_GUIElements.pChatBGColorBEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorBEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.65f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pSaveButton = pGUI->CreateGUIButton(m_GUIElements.pWindow);
	m_GUIElements.pSaveButton->setText("Save");
	m_GUIElements.pSaveButton->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pSaveButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.8f, 0)));
	m_GUIElements.pSaveButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CSettingsMenu::OnSaveButtonClick, this));

	m_bVisible = false;
}
コード例 #25
0
bool CClient::OnLoad()
{
	// Install the exception handler
	CExceptionHandler::Install();

	// Set our exception handler callback
	CExceptionHandler::SetCallback(ExceptionHandlerCallback);

	// jenksta: wtf?
	// Delete chatlog
	CLogFile::Open("Chatlog.log");
	CLogFile::Printf("New chatlog created!");
	CLogFile::Close();

	// Open the log file
	CLogFile::Open("Client.log");

	// Log the version
	CLogFile::Printf(VERSION_IDENTIFIER "| " __DATE__ " - " __TIME__ "");

	// Open the settings file
	CSettings::Open(SharedUtility::GetAbsolutePath("clientsettings.xml"));

	// Parse the command line
	CSettings::ParseCommandLine(GetCommandLine());

	// Load the global vars from the settings
	m_strHost = CVAR_GET_STRING("ip");
	m_usPort = CVAR_GET_INTEGER("port");
	m_strNick = CVAR_GET_STRING("nick");
	m_strPassword = CVAR_GET_STRING("pass");
	m_bWindowedMode = CVAR_GET_BOOL("windowed");
	m_bFPSToggle = CVAR_GET_BOOL("fps");
	m_strConnectHost = CVAR_GET_STRING("currentconnect_server");
	m_usConnectPort = CVAR_GET_INTEGER("currentconnect_port");

	// IE9 fix - disabled if disableie9fix is set or shift is pressed
	if(!CVAR_GET_BOOL("disableie9fix") || GetAsyncKeyState(VK_SHIFT) > 0)
	{
		// Get the version info
		DWORD dwHandle;
		DWORD dwSize = GetFileVersionInfoSize("wininet.dll", &dwHandle);
		BYTE* byteFileInfo = new BYTE[dwSize];
		GetFileVersionInfo("wininet.dll", dwHandle, dwSize, byteFileInfo);

		unsigned int uiLen;
		VS_FIXEDFILEINFO* fileInfo;
		VerQueryValue(byteFileInfo, "\\", (LPVOID *)&fileInfo, &uiLen);
		delete byteFileInfo;

		// using IE9?
		if(fileInfo->dwFileVersionMS == 0x90000)
		{
			// Try and load a wininet.dll from the iv:mp directory
			if(!LoadLibrary(SharedUtility::GetAbsolutePath("wininet.dll")))
			{
				// Get path to it
				char szFindPath[MAX_PATH] = {0};
				char szWinSxsPath[MAX_PATH] = {0};
				char szBuildVersion[] = "00000";
				GetEnvironmentVariable("windir", szWinSxsPath, sizeof(szWinSxsPath));
				strcat_s(szWinSxsPath, sizeof(szWinSxsPath), "\\WinSxS\\");
				strcpy_s(szFindPath, sizeof(szFindPath), szWinSxsPath);
				strcat_s(szFindPath, sizeof(szFindPath), "x86_microsoft-windows-i..tocolimplementation_31bf3856ad364e35*");

				// try to find a usable wininet.dll in WinSXS (basically any non-9.x version)
				bool bLoaded = false;
				WIN32_FIND_DATA lpFindFileData;
				HANDLE hFindFile = FindFirstFile(szFindPath, &lpFindFileData);
				do
				{
					if(hFindFile == INVALID_HANDLE_VALUE)
						break;

					if(strlen(lpFindFileData.cFileName) > 63)
					{
						if(lpFindFileData.cFileName[62] < '9')
						{
							char szFullPath[MAX_PATH];
							sprintf_s(szFullPath, MAX_PATH, "%s%s\\wininet.dll", szWinSxsPath, lpFindFileData.cFileName);
							if(LoadLibrary(szFullPath))
							{
								CLogFile::Printf("Using %s to address IE9 issue", szFullPath);
								bLoaded = true;
								break;
							}
						}
					}
				}
				while(FindNextFile(hFindFile, &lpFindFileData));

				// Still failed, tell the user
				if(!bLoaded)
				{
					if(MessageBox(0, "Unfortunately, you have Internet Explorer 9 installed which is not compatible with GTA:IV. Do you want proceed anyway (and possibly crash?)", "IV:MP", MB_YESNO | MB_ICONERROR) == IDNO)
					{
						// Doesn't want to continue
						return false;
					}

					// Save the user's choice
					CVAR_SET_BOOL("disableie9fix", true);
				}
			}
		}
	}

	// Initialize the streamer
	m_pStreamer = new CStreamer();

	// Initialize the time
	m_pTime = new CTime();

	// Initialize the traffic lights
	m_pTrafficLights = new CTrafficLights();

	// Initialize the client task manager
	m_pClientTaskManager = new CClientTaskManager();

	// Initialize the game
	CGame::Initialize();

	// Install the XLive hook
	CXLiveHook::Install();

	// Install the Direct3D hook
	CDirect3DHook::Install();

	// Install the DirectInput hook
	CDirectInputHook::Install();

#ifdef IVMP_DEBUG
	// Install the Cursor hook
	CCursorHook::Install();

	// Create our Debug View
	m_pDebugView = new CDebugView();
#endif

	// Initialize the client script manager
	m_pClientScriptManager = new CClientScriptManager();

	// Initialize the events manager
	m_pEvents = new CEvents();

	// Initialize the network module, if it fails, exit
	if(!CNetworkModule::Init())
	{
		CLogFile::Printf("Failed to initialize the network module!\n");
		return false;
	}

	// Initialize the file transfer manager
	m_pFileTransfer = new CFileTransferManager();

	// Initialize the http client
	m_pHttpClient = new CHttpClient();
	m_pHttpClient->SetRequestTimeout(10000);
	m_pHttpClient->SetHost(MASTERLIST_ADDRESS);
	return true;
}
コード例 #26
0
void amx_command()
{
	const char* cmd = CMD_ARGV(1);
		
	if (!strcmp(cmd, "plugins") || !strcmp(cmd, "list"))
	{

		print_srvconsole("Currently loaded plugins:\n");
		print_srvconsole("       %-23.22s %-11.10s %-17.16s %-16.15s %-9.8s\n", "name", "version", "author", "file", "status");

		int plugins = 0;
		int	running = 0;

		CPluginMngr::iterator a = g_plugins.begin();
			
		while (a) 
		{
			++plugins;
			if ((*a).isValid() && !(*a).isPaused()) 
				++running;

			print_srvconsole(" [%3d] %-23.22s %-11.10s %-17.16s %-16.15s %-9.8s\n", plugins, (*a).getTitle(), (*a).getVersion(), (*a).getAuthor(), (*a).getName(), (*a).getStatus());
			++a;
		}

		a = g_plugins.begin();

		int num = 0;
		while (a)
		{
			num++;
			if ((*a).getStatusCode() == ps_bad_load)
			{
				//error
				print_srvconsole("(%3d) Load fails: %s\n", num, (*a).getError());
			} else if ( (*a).getStatusCode() == ps_error) {
				//error
				print_srvconsole("(%3d) Error: %s\n", num, (*a).getError());
			}
			++a;
		}

		print_srvconsole("%d plugins, %d running\n", plugins, running);
	}
	else if (!strcmp(cmd, "pause") && CMD_ARGC() > 2) 
	{
		const char* sPlugin = CMD_ARGV(2);

		CPluginMngr::CPlugin *plugin = g_plugins.findPlugin(sPlugin);

		if (plugin && plugin->isValid()) 
		{
			if (plugin->isPaused())
			{
				if (plugin->isStopped())
				{
					print_srvconsole("Plugin \"%s\" is stopped and may not be paused.\n",plugin->getName());
				}
				else
				{
					print_srvconsole("Plugin \"%s\" is already paused.\n",plugin->getName());
				}
			}
			else
			{
				plugin->pausePlugin();
				print_srvconsole("Paused plugin \"%s\"\n", plugin->getName());
			}
		}
		else 
		{
			print_srvconsole("Couldn't find plugin matching \"%s\"\n", sPlugin);
		}
	}
	else if (!strcmp(cmd, "unpause") && CMD_ARGC() > 2) 
	{
		const char* sPlugin = CMD_ARGV(2);

		CPluginMngr::CPlugin *plugin = g_plugins.findPlugin(sPlugin);

		if (plugin && plugin->isValid() && plugin->isPaused()) 
		{
			if (plugin->isStopped())
			{
				print_srvconsole("Plugin \"%s\" is stopped and may not be unpaused.\n", plugin->getName());
			}
			else
			{
				plugin->unpausePlugin();
				print_srvconsole("Unpaused plugin \"%s\"\n", plugin->getName());
			}
		}
		else if (!plugin)
		{
			print_srvconsole("Couldn't find plugin matching \"%s\"\n", sPlugin);
		} else {
			print_srvconsole("Plugin %s can't be unpaused right now.\n", sPlugin);
		}
	}
	else if (!strcmp(cmd, "cvars")) 
	{
		print_srvconsole("Registered cvars:\n");
		print_srvconsole("       %-24.23s %-24.23s %-16.15s\n", "name", "value", "plugin");

		int ammount = 0;

		if (CMD_ARGC() > 2) // Searching for cvars registered to a plugin
		{
			const char* targetname = CMD_ARGV(2);
			size_t len = strlen(targetname);
			for (CList<CCVar>::iterator a = g_cvars.begin(); a; ++a)
			{
				if (strncmp((*a).getPluginName(), targetname, len) == 0)
				{
					print_srvconsole(" [%3d] %-24.23s %-24.23s %-16.15s\n", ++ammount, (*a).getName(), CVAR_GET_STRING((*a).getName()), (*a).getPluginName());
				}
			}
		}
		else // No search
		{
			for (CList<CCVar>::iterator a = g_cvars.begin(); a; ++a)
			{
				print_srvconsole(" [%3d] %-24.23s %-24.23s %-16.15s\n", ++ammount, (*a).getName(), CVAR_GET_STRING((*a).getName()), (*a).getPluginName());
			}
		}
		
		print_srvconsole("%d cvars\n", ammount);
	}
	else if (!strcmp(cmd, "cmds")) 
	{
		print_srvconsole("Registered commands:\n");
		print_srvconsole("       %-24.23s %-16.15s %-8.7s %-16.15s\n", "name", "access", "type", "plugin");
				
		int ammount = 0;
		char access[32];

		CmdMngr::iterator a = g_commands.begin(CMD_ConsoleCommand);

		if (CMD_ARGC() > 2) // Searching for commands registered to a plugin
		{
			const char* targetname = CMD_ARGV(2);
			size_t len = strlen(targetname);
			while (a)
			{
				if (strncmp((*a).getPlugin()->getName(), targetname, len) == 0)
				{
					UTIL_GetFlags(access, (*a).getFlags());
					print_srvconsole(" [%3d] %-24.23s %-16.15s %-8.7s %-16.15s\n", ++ammount, (*a).getCmdLine(), access, (*a).getCmdType(), (*a).getPlugin()->getName());
				}
				++a;
			}
		}
		else // No search
		{
			while (a)
			{
				UTIL_GetFlags(access, (*a).getFlags());
				print_srvconsole(" [%3d] %-24.23s %-16.15s %-8.7s %-16.15s\n", ++ammount, (*a).getCmdLine(), access, (*a).getCmdType(), (*a).getPlugin()->getName());
				++a;
			}
		}
		print_srvconsole("%d commands\n",ammount);
	}
	else if (!strcmp(cmd, "version")) 
	{
		print_srvconsole("%s %s (%s)\n", Plugin_info.name, Plugin_info.version, Plugin_info.url);
		print_srvconsole("Authors:\n\tDavid \"BAILOPAN\" Anderson, Pavol \"PM OnoTo\" Marko\n");
		print_srvconsole("\tFelix \"SniperBeamer\" Geyer, Jonny \"Got His Gun\" Bergstrom\n");
		print_srvconsole("\tLukasz \"SidLuke\" Wlasinski, Christian \"Basic-Master\" Hammacher\n");
		print_srvconsole("\tBorja \"faluco\" Ferrer, Scott \"DS\" Ehlert\n");
		print_srvconsole("\tRafal \"DarkGL\" Wiecek\n");
		print_srvconsole("Compiled: %s\n", __DATE__ ", " __TIME__);
		print_srvconsole("Build ID: %s\n", SVN_BUILD_ID);
#if defined JIT && !defined ASM32
		print_srvconsole("Core mode: JIT Only\n");
#elif !defined JIT && defined ASM32
		print_srvconsole("Core mode: ASM32 Only\n");
#elif defined JIT && defined ASM32
		print_srvconsole("Core mode: JIT+ASM32\n");
#else
		print_srvconsole("Core mode: Normal\n");
#endif
	}
	else if (!strcmp(cmd, "modules"))
	{
		print_srvconsole("Currently loaded modules:\n");
		print_srvconsole("      %-23.22s %-11.10s %-20.19s %-11.10s\n", "name", "version", "author", "status");

		int running = 0;
		int modules = 0;

		CList<CModule,const char *>::iterator a = g_modules.begin();

		while (a)
		{
			if ((*a).getStatusValue() == MODULE_LOADED)
				++running;
			++modules;

			print_srvconsole(" [%2d] %-23.22s %-11.10s %-20.19s %-11.10s\n", modules, (*a).getName(), (*a).getVersion(), (*a).getAuthor(), (*a).getStatus());
			++a;
		}

		print_srvconsole("%d modules, %d correct\n", modules, running);
	}
	else if (!strcmp(cmd, "gpl"))
	{
		print_srvconsole("AMX Mod X\n");
		print_srvconsole("\n");
		print_srvconsole(" by the AMX Mod X Development Team\n");
		print_srvconsole("  originally developed by OLO\n");
		print_srvconsole("\n");
		print_srvconsole("\n");
		print_srvconsole("  This program is free software; you can redistribute it and/or modify it\n");
		print_srvconsole("  under the terms of the GNU General Public License as published by the\n");
		print_srvconsole("  Free Software Foundation; either version 2 of the License, or (at\n");
		print_srvconsole("  your option) any later version.\n");
		print_srvconsole("\n");
		print_srvconsole("  This program is distributed in the hope that it will be useful, but\n");
		print_srvconsole("  WITHOUT ANY WARRANTY; without even the implied warranty of\n");
		print_srvconsole("  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n");
		print_srvconsole("  General Public License for more details.\n");
		print_srvconsole("\n");
		print_srvconsole("  You should have received a copy of the GNU General Public License\n");
		print_srvconsole("  along with this program; if not, write to the Free Software Foundation,\n");
		print_srvconsole("  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n");
		print_srvconsole("\n");
		print_srvconsole("  In addition, as a special exception, the author gives permission to\n");
		print_srvconsole("  link the code of this program with the Half-Life Game Engine (\"HL\n");
		print_srvconsole("  Engine\") and Modified Game Libraries (\"MODs\") developed by Valve,\n");
		print_srvconsole("  L.L.C (\"Valve\"). You must obey the GNU General Public License in all\n");
		print_srvconsole("  respects for all of the code used other than the HL Engine and MODs\n");
		print_srvconsole("  from Valve. If you modify this file, you may extend this exception\n");
		print_srvconsole("  to your version of the file, but you are not obligated to do so. If\n");
		print_srvconsole("  you do not wish to do so, delete this exception statement from your\n");
		print_srvconsole("  version.\n");
		print_srvconsole("\n");
	}
	else if (!strcmp(cmd, "\x74\x75\x72\x74\x6C\x65"))		// !! Hidden Command :D !!
	{
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2E\x2E\x3A\x3A\x3E\x3E\x3A\x3A\x3B\x3E\x5E\x27\x2E\x27\x27\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x27\x3A\x3A\x3F\x3D\x3E\x3E\x3E\x3E\x3E\x3D\x3F\x3E\x78\x2B\x3F\x3E\x3E\x3E\x3D\x3E\x3F\x2B\x3F\x3E\x3B\x2E\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x2E\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x27\x2C\x3A\x3E\x3B\x3F\x3D\x3E\x3B\x2E\x27\x5E\x5E\x3B\x3B\x2C\x3A\x3F\x3F\x3D\x78\x3F\x3B\x3E\x3A\x3B\x3A\x5E\x3B\x3D\x3E\x2B\x2B\x2B\x2B\x3D\x2C\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x2C\x3E\x37\x24\x24\x78\x3D\x3D\x3D\x3F\x3A\x27\x20\x20\x20\x20\x20\x20\x20\x2E\x3A\x3B\x3D\x3E\x3A\x3A\x3A\x3A\x3F\x3F\x3F\x3E\x5E\x2C\x2E\x2E\x2C\x2C\x2C\x2C\x3A\x3B\x3D\x3D\x3B\x5E\x2C\x2C\x2C\x3A\x5E\x3A\x3F\x3F\x3E\x3D\x3D\x3E\x3E\x2B\x3B\x27\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x2C\x3D\x2B\x3E\x2C\x5E\x3D\x79\x24\x33\x78\x33\x24\x5A\x24\x3B\x20\x20\x3A\x3E\x2B\x3E\x3D\x3F\x5E\x2C\x2C\x2C\x5E\x5E\x3E\x3D\x3E\x3B\x3B\x3A\x5E\x5E\x3E\x3F\x3D\x2B\x37\x3D\x3F\x3E\x3E\x3E\x3F\x3D\x3F\x3F\x3D\x3D\x3D\x3D\x3E\x3F\x3D\x3E\x3E\x3E\x3D\x5A\x78\x3E\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x3D\x5A\x24\x37\x78\x66\x68\x78\x5A\x5A\x24\x79\x79\x71\x23\x23\x4D\x71\x3B\x3A\x3B\x3A\x3E\x3B\x3B\x2C\x5E\x3E\x3F\x3D\x3F\x3A\x2C\x2C\x3A\x3B\x3B\x3E\x3E\x3D\x2B\x3D\x3E\x3D\x3B\x3A\x3E\x3D\x2B\x3D\x2B\x37\x2B\x3D\x2B\x37\x37\x2B\x2B\x33\x33\x33\x37\x37\x24\x5A\x79\x3A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x5E\x2B\x5A\x2B\x3E\x3D\x37\x5A\x66\x40\x40\x23\x40\x48\x23\x23\x23\x38\x5E\x3B\x3D\x3F\x2B\x3E\x3B\x3E\x5E\x5E\x2C\x27\x2E\x27\x2E\x2E\x5E\x3F\x3D\x3D\x3F\x3A\x3B\x3A\x3A\x3A\x5E\x5E\x3E\x3E\x3F\x3D\x37\x37\x3D\x3D\x37\x2B\x3D\x37\x2B\x37\x78\x24\x79\x38\x68\x45\x48\x79\x3E\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x2C\x3E\x3E\x78\x33\x68\x48\x23\x23\x40\x40\x48\x45\x66\x33\x20\x2C\x3A\x3E\x3E\x3E\x3B\x3B\x3A\x3A\x2C\x2E\x2C\x5E\x3A\x2C\x5E\x3B\x3E\x37\x37\x3F\x3B\x3A\x2E\x3A\x3A\x3B\x3D\x3B\x3B\x3D\x2B\x3D\x78\x33\x37\x3E\x3D\x3D\x2B\x37\x2B\x78\x78\x78\x78\x5A\x66\x71\x68\x38\x45\x27\x20\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x3A\x37\x37\x24\x66\x71\x45\x45\x71\x45\x3A\x3A\x2C\x5E\x3A\x3E\x3A\x3A\x3B\x3B\x5E\x3A\x2C\x5E\x5E\x2C\x2C\x5E\x3A\x3E\x2B\x33\x3D\x3E\x3A\x3A\x3A\x3D\x2B\x2B\x3D\x3F\x3F\x37\x37\x2B\x37\x3D\x3D\x5A\x33\x78\x33\x37\x78\x24\x5A\x33\x37\x38\x40\x71\x38\x66\x40\x2C\x20\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5E\x2B\x5A\x45\x40\x5E\x5E\x5E\x3A\x2C\x3A\x3B\x3E\x3A\x5E\x5E\x2C\x2E\x2E\x2C\x5E\x3B\x3B\x3A\x2B\x3E\x3F\x3B\x3F\x3F\x3F\x3F\x3E\x3F\x3D\x37\x3B\x3B\x3D\x33\x2B\x3D\x3D\x78\x78\x5A\x78\x33\x78\x5A\x5A\x5A\x24\x71\x48\x79\x5A\x24\x79\x45\x3E\x20\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x27\x3B\x2C\x2C\x27\x5E\x5E\x2C\x3A\x5E\x3A\x3A\x5E\x3A\x3B\x3F\x3E\x3F\x3E\x3B\x3E\x3E\x3F\x3D\x2B\x37\x37\x2B\x2B\x3D\x2B\x37\x2B\x37\x37\x2B\x3B\x3D\x33\x2B\x2B\x37\x37\x2B\x3D\x78\x78\x66\x78\x78\x37\x33\x66\x78\x38\x23\x23\x27\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3A\x3F\x3B\x5E\x2C\x3B\x3F\x3D\x3F\x3F\x3B\x3A\x3A\x3A\x3E\x3F\x3E\x3E\x3F\x3A\x3F\x33\x78\x78\x33\x24\x24\x33\x2B\x37\x78\x24\x78\x33\x3D\x2B\x2B\x5A\x24\x78\x24\x78\x33\x33\x24\x5A\x79\x24\x24\x24\x68\x45\x48\x38\x68\x45\x40\x3E\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2C\x3A\x3E\x3F\x37\x3D\x3E\x3F\x2B\x3F\x3F\x3E\x3F\x3F\x3F\x3D\x3F\x3E\x3F\x3D\x37\x2B\x3E\x3E\x2B\x37\x37\x33\x37\x33\x78\x33\x33\x33\x78\x37\x37\x37\x78\x5A\x78\x5A\x79\x79\x5A\x24\x79\x79\x79\x79\x79\x68\x71\x38\x38\x71\x23\x23\x45\x37\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5E\x2B\x2B\x3F\x2B\x78\x40\x38\x3F\x3B\x3E\x3B\x3B\x3E\x3F\x37\x2B\x3F\x3F\x3D\x3D\x3E\x3F\x2B\x37\x37\x37\x37\x33\x33\x78\x78\x33\x37\x24\x5A\x78\x5A\x5A\x78\x24\x33\x3D\x37\x37\x37\x78\x24\x5A\x78\x37\x37\x78\x66\x79\x66\x71\x66\x40\x45\x40\x3A\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2B\x3A\x3F\x2B\x3D\x2B\x79\x23\x79\x3B\x2C\x3A\x3A\x3A\x37\x78\x3F\x3E\x3B\x3E\x3B\x3E\x3D\x37\x24\x33\x37\x33\x37\x78\x78\x33\x24\x68\x79\x33\x24\x78\x2B\x33\x33\x5A\x79\x24\x5A\x79\x24\x5A\x37\x24\x5A\x5A\x66\x38\x66\x79\x66\x40\x71\x45\x48\x5A\x3A\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5E\x37\x3D\x37\x37\x33\x37\x37\x66\x45\x5A\x3F\x5E\x5E\x78\x37\x3D\x3F\x3E\x3B\x3B\x3E\x2B\x2B\x24\x78\x37\x2B\x37\x2B\x37\x78\x78\x71\x79\x33\x33\x24\x24\x78\x24\x5A\x3F\x37\x78\x24\x78\x79\x66\x5A\x78\x79\x66\x79\x68\x79\x66\x5A\x33\x3F\x3D\x3D\x20\x20\x20\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5E\x2B\x3D\x3F\x37\x37\x78\x33\x5A\x4E\x4D\x23\x38\x33\x3F\x3E\x3B\x3E\x3B\x3D\x3D\x33\x66\x24\x78\x33\x2B\x78\x24\x5A\x24\x5A\x71\x79\x78\x33\x33\x78\x79\x5A\x5A\x33\x66\x24\x78\x78\x24\x79\x5A\x24\x79\x5A\x37\x66\x24\x3D\x3B\x66\x23\x4D\x4D\x4D\x79\x3B\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3A\x33\x37\x37\x24\x78\x66\x79\x48\x4D\x4D\x4D\x4D\x23\x71\x68\x5A\x24\x5A\x79\x68\x68\x5A\x5A\x24\x79\x66\x68\x78\x5A\x4E\x45\x66\x66\x45\x45\x45\x24\x5A\x40\x71\x68\x5A\x68\x5A\x37\x66\x79\x78\x37\x78\x37\x68\x38\x38\x71\x48\x40\x23\x45\x3A\x3D\x37\x45\x27\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x37\x37\x78\x37\x33\x38\x45\x45\x71\x20\x5E\x3D\x2B\x3F\x2B\x2B\x79\x71\x45\x48\x40\x45\x45\x45\x45\x45\x71\x40\x40\x71\x38\x38\x79\x66\x38\x68\x48\x48\x45\x66\x37\x2B\x3A\x37\x3F\x3B\x3A\x2C\x27\x2C\x27\x78\x4D\x23\x48\x48\x48\x79\x2B\x3A\x3F\x79\x27\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3A\x78\x78\x24\x40\x4E\x4E\x4D\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5E\x3E\x3E\x3F\x3E\x3E\x3E\x3E\x3B\x3B\x3B\x3A\x3A\x3F\x3E\x3A\x2E\x2E\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2E\x45\x4D\x40\x45\x78\x5E\x33\x68\x33\x2B\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x24\x48\x45\x48\x78\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2B\x4E\x40\x2B\x66\x33\x78\x20\x20\n");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2B\x2C\x20\x3A\x20\x20\n");
	}
	else if( !strcmp( cmd , "\x64\x61\x72\x6b" ) ){
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x4e\x4d\x5a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3f\x38\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x44\x4d\x4d\x4d\x4d\x3a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x20\x20\x3d\x44\x4d\x4e\x4e\x49\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x2b\x4d\x4d\x4d\x4e\x38\x38\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x37\x4d\x4d\x4d\x4d\x4d\x4d\x4d\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x44\x44\x2b\x3f\x2b\x2b\x3f\x44\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x24\x4f\x3d\x2b\x2b\x3d\x3d\x38\x4d\x4d\x4d\x49\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x37\x3d\x2b\x3f\x2b\x49\x3d\x38\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x3a\x38\x2b\x3d\x2b\x2b\x2b\x2b\x3f\x3f\x2b\x4e\x4d\x4e\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5a\x7e\x2b\x2b\x3f\x2b\x3f\x37\x24\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x37\x49\x2b\x49\x2b\x2b\x2b\x2b\x3f\x3f\x2b\x2b\x2b\x4e\x4d\x7e\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x38\x2b\x2b\x2b\x2b\x3f\x3f\x3f\x4f\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x3a\x4f\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x3f\x3f\x3f\x3f\x49\x4d\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7e\x4f\x3d\x2b\x2b\x37\x38\x49\x49\x38\x20\x20\x20\x20\x2c\x2c\x20\x20\x20\x20\x24\x2b\x2b\x2b\x2b\x2b\x2b\x3f\x3f\x3f\x2b\x2b\x2b\x3f\x4f\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2b\x3d\x2b\x2b\x3d\x4d\x2b\x3f\x4f\x4e\x2b\x3d\x2b\x2b\x2b\x3f\x5a\x44\x44\x3d\x2b\x2b\x2b\x2b\x3f\x3f\x3f\x2b\x2b\x2b\x2b\x5a\x20\x20\x20\x20\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x44\x3d\x4e\x38\x4d\x7e\x3f\x3f\x2b\x2b\x2b\x3f\x3f\x3f\x3f\x3f\x2b\x3f\x3d\x38\x3f\x3f\x3f\x2b\x3f\x3f\x2b\x3f\x3f\x4f\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3f\x3f\x7e\x4d\x44\x3f\x2b\x2b\x2b\x2b\x2b\x2b\x3f\x2b\x49\x3f\x3f\x2b\x2b\x2b\x2b\x3f\x3f\x3f\x3f\x37\x24\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x3a\x4e\x3f\x3d\x7e\x2b\x2b\x2b\x2b\x2b\x2b\x24\x37\x44\x24\x2b\x3f\x3f\x3f\x49\x3f\x2b\x5a\x3f\x2c\x20\x20\x20\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3d\x7e\x4e\x24\x37\x3d\x3d\x2b\x2b\x2b\x44\x20\x2c\x20\x20\x5a\x3d\x3f\x3f\x3d\x44\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3d\x2b\x3a\x7e\x3a\x3d\x3d\x2b\x2b\x2b\x2c\x3f\x20\x20\x20\x2c\x4f\x3f\x3f\x3d\x5a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3d\x2b\x2c\x3d\x2c\x2b\x3f\x2b\x2b\x3d\x20\x24\x4f\x20\x20\x20\x4e\x7e\x3f\x3f\x4e\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x2b\x2c\x4d\x24\x24\x2b\x2b\x2b\x2b\x20\x2c\x44\x44\x4e\x44\x4e\x49\x3f\x2b\x37\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2b\x2c\x38\x44\x38\x2b\x2b\x2b\x2b\x2c\x2b\x2c\x49\x5a\x24\x24\x5a\x3f\x3f\x2b\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x37\x3d\x38\x2b\x38\x24\x49\x3f\x2b\x2b\x7e\x20\x20\x37\x38\x38\x4f\x5a\x3d\x3f\x2b\x4f\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x37\x37\x4f\x7e\x38\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x38\x38\x37\x24\x24\x4e\x38\x2b\x2b\x2b\x24\x4e\x5a\x38\x38\x2b\x2b\x44\x5a\x4f\x44\x4e\x20\x2c\x20\x20\x20\x20\x2c\x2c\x37\x38\x4f\x7e\x3d\x3d\x49\x37\x2c\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x38\x5a\x4e\x2b\x3f\x3d\x3d\x2b\x2b\x3f\x3f\x2b\x3f\x3f\x3f\x3f\x3f\x38\x5a\x5a\x4f\x38\x20\x20\x20\x20\x20\x3a\x4f\x24\x3d\x2b\x2b\x2b\x2b\x3f\x3f\x3f\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x4e\x3d\x3f\x2b\x2b\x3d\x38\x3f\x3f\x2b\x2b\x3f\x3f\x2b\x3f\x3f\x3f\x38\x44\x3a\x2c\x20\x20\x20\x49\x5a\x3d\x2b\x3f\x2b\x3f\x2b\x2b\x2b\x2b\x3f\x5a\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x4f\x37\x3d\x3f\x2b\x2b\x2b\x3f\x3f\x3f\x2b\x3f\x3f\x3f\x38\x3d\x20\x20\x20\x20\x20\x3f\x3f\x2b\x2b\x49\x2b\x2b\x2b\x2b\x2b\x3f\x3f\x2b\x2b\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x37\x38\x5a\x44\x49\x3f\x24\x2b\x2b\x3d\x49\x2b\x3f\x3f\x3f\x3f\x2b\x3f\x2b\x2c\x20\x20\x20\x44\x2b\x2b\x3d\x2b\x3f\x2b\x3f\x3f\x3f\x3f\x3f\x2b\x3d\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x4f\x4f\x4f\x24\x5a\x24\x24\x37\x37\x38\x5a\x24\x2b\x3d\x3f\x3f\x3f\x3f\x2b\x24\x5a\x49\x20\x20\x20\x5a\x3f\x37\x3d\x7e\x3f\x4f\x44\x37\x3d\x2b\x3d\x38\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5a\x24\x4f\x38\x5a\x37\x5a\x44\x7e\x3d\x2b\x3d\x2b\x2b\x2b\x2b\x3f\x3f\x2b\x3d\x3f\x4f\x37\x5a\x24\x38\x49\x3f\x44\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x44\x5a\x24\x5a\x4f\x5a\x4f\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x3f\x2b\x3f\x2b\x2b\x2b\x3f\x3f\x3f\x5a\x4f\x3f\x7e\x24\x20\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x38\x4f\x5a\x24\x24\x24\x3f\x3f\x2b\x2b\x2b\x2b\x2b\x2b\x3f\x3f\x2b\x3f\x3f\x3f\x3f\x49\x2b\x4f\x4e\x3d\x20\x2c\x20\x20\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3d\x38\x5a\x4f\x5a\x38\x5a\x44\x2b\x2b\x2b\x3f\x3d\x3d\x2b\x2b\x3d\x2b\x2b\x3f\x3f\x3f\x2b\x2b\x5a\x3f\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x4d\x5a\x24\x49\x4e\x37\x2b\x2b\x2b\x2b\x3d\x2b\x2b\x2b\x3d\x2b\x2b\x3f\x3f\x3f\x3f\x3f\x3f\x44\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x38\x7e\x3f\x2b\x2b\x2b\x2b\x3d\x2b\x2b\x2b\x2b\x3d\x2b\x2b\x3f\x3f\x3f\x3f\x3f\x2b\x49\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x44\x3d\x3f\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x2b\x3f\x3f\x2b\x2b\x3f\x3f\x3f\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x20\x4d\x44\x7e\x7e\x2b\x2b\x3f\x2b\x2b\x2b\x2b\x2b\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x2b\x2b\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x38\x3f\x2b\x3f\x24\x4f\x4f\x5a\x3f\x3f\x3f\x3d\x3d\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3d\x38\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x4f\x2b\x2b\x2b\x2b\x3f\x3f\x2b\x4f\x5a\x20\x20\x2c\x7e\x44\x37\x3d\x3f\x2b\x2b\x3f\x2b\x3f\x38\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x3a\x3a\x3a\x3a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x38\x3d\x2b\x3f\x2b\x3f\x3f\x7e\x49\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x44\x3d\x2b\x3d\x3f\x3f\x3f\x4f\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2b\x38\x7e\x2b\x2b\x2b\x44\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0d\x0a");
		print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2c\x3a\x2c\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20");
	} 
	else {
		print_srvconsole("Usage: amxx < command > [ argument ]\n");
		print_srvconsole("Commands:\n");
		print_srvconsole("   version                - display amxx version info\n");
		print_srvconsole("   gpl                    - print the license\n");
		print_srvconsole("   plugins                - list plugins currently loaded\n");
		print_srvconsole("   modules                - list modules currently loaded\n");
		print_srvconsole("   cvars [ plugin ]       - list cvars registered by plugins\n");
		print_srvconsole("   cmds [ plugin ]        - list commands registered by plugins\n");
		print_srvconsole("   pause < plugin >       - pause a running plugin\n");
		print_srvconsole("   unpause < plugin >     - unpause a previously paused plugin\n");
	}
}
コード例 #27
0
ファイル: CServer.cpp プロジェクト: Rukenshia/IV-Network
bool CServer::Startup()
{
	// Register our RPCs before set the NetServer´s rpc handler
	CEvents* pEvents = new CEvents();

	// Create all the managers
	m_pPlayerManager = new CPlayerManager();
	m_pVehicleManager = new CVehicleManager();
	m_pActorManager = new CActorManager();
	m_pObjectManager = new CObjectManager();
	m_pFireManager = new CFireManager();
	m_pPickupManager = new CPickupManager();
	m_p3DLabelManager = new C3DLabelManager();
	m_pBlipManager = new CBlipManager();
	m_pCheckpointManager = new CCheckpointManager();

	// Open the settings file
	if(!CSettings::Open(SharedUtility::GetAbsolutePath("settings.xml"), true, false))
	{
		CLogFile::Print("Failed to open settings.xml..");
#ifdef _WIN32
		Sleep(3000);
#else
		sleep(3);
#endif
		return false;
	}

#ifdef _WIN32
		 // Color stuff
        CONSOLE_SCREEN_BUFFER_INFO csbiScreen;
        WORD wOldColAttr;       // For input process.

        GetConsoleScreenBufferInfo((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), &csbiScreen);
        wOldColAttr = csbiScreen.wAttributes;

        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), wOldColAttr | FOREGROUND_INTENSITY);

        // Print message to console.
        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_INTENSITY);

#endif
	CLogFile::Print("");
	CLogFile::Print("====================================================================");

#ifdef _WIN32
	SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), wOldColAttr | FOREGROUND_INTENSITY);
#endif


	CLogFile::Print(" " VERSION_IDENTIFIER " " OS_STRING " Server");
	CLogFile::Print(" Copyright (C) 2013 GTA-Network Team");
	CLogFile::Printf(" Port: %d", CVAR_GET_INTEGER("port"));
	CLogFile::Printf(" HTTP Port: %d", CVAR_GET_INTEGER("httpport"));
	CLogFile::Printf(" Query Port: %d", (CVAR_GET_INTEGER("queryport")));

	if(CVAR_GET_STRING("hostaddress").IsNotEmpty())
		CLogFile::Printf(" Host Address: %s", CVAR_GET_STRING("hostaddress").Get());

	if(CVAR_GET_STRING("httpserver").IsNotEmpty())
		CLogFile::Printf(" HTTP Server: %s", CVAR_GET_STRING("httpserver").Get());

	CLogFile::Printf(" Max Players: %d", CVAR_GET_INTEGER("maxplayers"));

#ifdef _WIN32
        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_INTENSITY);
        CLogFile::Print("====================================================================");
        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), wOldColAttr | FOREGROUND_INTENSITY);
#else
        CLogFile::Print("====================================================================");
#endif
	
	// Load modules
	// Note: modules not implemented yet coming soon
	auto modules = CVAR_GET_LIST("module");
	if(modules.size() > 0)
	{
		CLogFile::Print("");
		CLogFile::Print("========================== Loading Modules =========================");

		for(auto strModule : modules)
		{
			CLogFile::Printf("Loading module %s.", strModule.Get());
			if(!strModule.ToLower().EndsWith(".so") && !strModule.ToLower().EndsWith(".dll"))
			{
				// If no extension specified in module name string, load SO for linux and DLL for Win
#ifdef _WIN32
				strModule.Append(".dll");
#else
				strModule.Append(".so");
#endif		
			}
			//CModule * pModule = g_pModuleManager->LoadModule(strModule);

			//if(!pModule)
				CLogFile::Printf("Warning: Failed to load module %s.", strModule.Get());
		}

		CLogFile::Print("");
	}
	m_pResourceManager = new CResourceManager("resources");
	m_pResourceManager->SetCreateVMCallback(OnCreateVM);

	// Loading resources
#ifdef _WIN32
        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_INTENSITY);
        CLogFile::Print("");
        CLogFile::Print("============ Loading Resources ===========");
		CLogFile::Print("");
        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), wOldColAttr | FOREGROUND_INTENSITY);
#else
        CLogFile::Print("");
        CLogFile::Print("============ Loading Resources ===========");
		CLogFile::Print("");
#endif


	auto resources = CVAR_GET_LIST("resource");

	int iResourcesLoaded = 0;
	int iFailedResources = 0;

	for(auto strResource : resources)
	{
		if(!strResource.IsEmpty())
		{
			CLogFile::Printf("Loading resource (%s)", strResource.C_String());
			if(CResource* pResource = m_pResourceManager->Load(SharedUtility::GetAbsolutePath(m_pResourceManager->GetResourceDirectory()),strResource))
			{
				m_pResourceManager->StartResource(pResource);
				iResourcesLoaded++;
			} else {
				CLogFile::Printf("Warning: Failed to load resource %s.", strResource.Get());
				iFailedResources++;
			}
		}
	}

	CLogFile::Printf("Successfully loaded %d resources (%d failed).", iResourcesLoaded, iFailedResources);

#ifdef _WIN32
        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_INTENSITY);
        CLogFile::Print("");
        CLogFile::Print("====================================================================");
        CLogFile::Print("");
        SetConsoleTextAttribute((HANDLE)GetStdHandle(STD_OUTPUT_HANDLE), wOldColAttr | FOREGROUND_INTENSITY);
#else
        CLogFile::Print("");
        CLogFile::Print("====================================================================");
        CLogFile::Print("");
#endif

	m_pNetworkModule->Startup();

	return true;
}
コード例 #28
0
ファイル: CServerBrowser.cpp プロジェクト: DarkKlo/maf2mp
void CServerBrowser::SetupUI( float fX, float fY, float fWidth, float fHeight )
{
	// Create the gui tab panel
	m_pTabs = m_pGUI->CreateTabPanel();
	m_pTabs->SetPosition( Vector2( fX, fY ) );
	m_pTabs->SetSize( Vector2( (fWidth - 260), fHeight ) );
	m_pTabs->SetAlwaysOnTop( true );

	// Create the players list
	m_pPlayers = m_pGUI->CreateTabPanel();
	m_pPlayers->SetPosition( Vector2( ((fX + fWidth) - 250), fY ) );
	m_pPlayers->SetSize( Vector2( 250, fHeight ) );
	m_pPlayers->SetAlwaysOnTop( true );

	// Create the status label
	m_pStatusLabel = m_pGUI->CreateLabel ( "", m_pGUI->GetDefaultFont( true ) );
	m_pStatusLabel->SetSize ( Vector2 ( (fWidth - 260), 30 ) );
	m_pStatusLabel->SetPosition ( Vector2 ( fX, (fY + fHeight + 10) ) );

	// Create the players list tabs
	m_pPlayersTab = m_pPlayers->CreateTab( "Players" );
	m_pRulesTab = m_pPlayers->CreateTab( "Rules" );

	// Create the players grid list
	m_pPlayersGridList = m_pGUI->CreateGridList( m_pPlayersTab );
	m_pPlayersGridList->SetPosition( Vector2( 1, 1 ) );
	m_pPlayersGridList->SetSize( Vector2( 247, (fHeight - 26) ) );
	m_pPlayersGridList->AddColumn ( "Name", 0.65f );
	m_pPlayersGridList->AddColumn ( "Ping", 0.30f );

	// Create the locked image
	m_pLockedImage = m_pGUI->CreateStaticImage();
	m_pLockedImage->SetVisible( false );
	m_pLockedImage->LoadFromFile( "locked.png", SharedUtility::GetAbsolutePath( "data\\gui\\images" ) );
	m_pLockedImage->SetSize ( Vector2 ( 12, 12 ) );

	// Create the tabs
	CreateTab( INTERNET, "Internet", (fWidth - 262), (fHeight - 26) );
	CreateTab( HOSTED, "Hosted", (fWidth - 262), (fHeight - 26) );

	// Hide the server browser
	SetVisible( false );

	// Create the message box window
	m_pMessageBox = m_pGUI->CreateMessageBox ( "", "", "Close" );
	m_pMessageBox->SetVisible ( false );
	m_pMessageBox->GetWindow()->SetAlwaysOnTop ( true );
	m_pMessageBox->SetButtonClickHandler ( 0, Button1ClickHandler, this );

	// Create the quick connect window
	m_pQuickConnectWindow = m_pGUI->CreateWnd ( "Quick Connect" );
	m_pQuickConnectWindow->SetSize ( Vector2 ( 260, 155 ) );
	m_pQuickConnectWindow->SetPosition ( Vector2 ( (m_pGUI->GetResolution().fX / 2) - 150, (m_pGUI->GetResolution().fY / 2) - 77.5 ) );
	m_pQuickConnectWindow->SetVisible ( false );
	m_pQuickConnectWindow->SetAlwaysOnTop ( true );
	m_pQuickConnectWindow->SetSizingEnabled ( false );
	m_pQuickConnectWindow->SetAlpha ( 1.0f );

	// Create the quick connect label
	m_pQuickConnectLabel = m_pGUI->CreateLabel ( "Enter the server IP, Port and Password:"******"last-server-ip")) != 0);

	// Create the quick connect IP input
	m_pQuickConnectAddress = m_pGUI->CreateEdit ( (bRestoreInformation ? CVAR_GET_STRING ( "last-server-ip" ) : "127.0.0.1"), m_pQuickConnectWindow );
	m_pQuickConnectAddress->SetSize ( Vector2( 160, 24 ) );
	m_pQuickConnectAddress->SetPosition ( Vector2 ( 18, 50 ) );
	m_pQuickConnectAddress->SetClickHandler ( GUI_CALLBACK ( &CServerBrowser::Event_QuickConnectInputFocus, this ) );

	// Create the quick connect port input
	m_pQuickConnectPort = m_pGUI->CreateEdit ( (bRestoreInformation ? String ( "%d", CVAR_GET_INTEGER ( "last-server-port" ) ) : "27015"), m_pQuickConnectWindow );
	m_pQuickConnectPort->SetSize ( Vector2( 55, 24 ) );
	m_pQuickConnectPort->SetPosition ( Vector2 ( 183, 50 ) );
	m_pQuickConnectPort->SetClickHandler ( GUI_CALLBACK ( &CServerBrowser::Event_QuickConnectInputFocus, this ) );

	// Create the quick connect password input
	m_pQuickConnectPassword = m_pGUI->CreateEdit ( (bRestoreInformation ? CVAR_GET_STRING ( "last-server-password" ) : ""), m_pQuickConnectWindow );
	m_pQuickConnectPassword->SetSize ( Vector2( 220, 24 ) );
	m_pQuickConnectPassword->SetPosition ( Vector2( 18, 85 ) );
	m_pQuickConnectPassword->SetClickHandler ( GUI_CALLBACK ( &CServerBrowser::Event_QuickConnectInputFocus, this ) );
	m_pQuickConnectPassword->SetMasked ( true );

	// Create the quick connect submit button
	m_pQuickConnectSubmit = m_pGUI->CreateButton ( "Connect", m_pQuickConnectWindow );
	m_pQuickConnectSubmit->SetSize ( Vector2 ( 75, 20 ) );
	m_pQuickConnectSubmit->SetPosition ( Vector2 ( 18, 120 ) );
	m_pQuickConnectSubmit->SetClickHandler ( GUI_CALLBACK( &CServerBrowser::Event_QuickConnectSubmitClick, this ) );

	// Create the quick connect cancel button
	m_pQuickConnectCancel = m_pGUI->CreateButton ( "Cancel", m_pQuickConnectWindow );
	m_pQuickConnectCancel->SetSize ( Vector2 ( 75, 20 ) );
	m_pQuickConnectCancel->SetPosition ( Vector2 ( 100, 120 ) );
	m_pQuickConnectCancel->SetClickHandler ( GUI_CALLBACK( &CServerBrowser::Event_QuickConnectCancelClick, this ) );
}
コード例 #29
0
ファイル: menu_touchoptions.cpp プロジェクト: Tox86/xash3d
/*
=================
UI_TouchOptions_Callback
=================
*/
static void UI_TouchOptions_Callback( void *self, int event )
{
	menuCommon_s	*item = (menuCommon_s *)self;

	switch( item->id )
	{
	case ID_ENABLE:
	case ID_GRID:
	case ID_IGNORE_MOUSE:
		if( event == QM_PRESSED )
			((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
		else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
		break;
	}

	if( event == QM_CHANGED )
	{
		// Update cvars based on controls
		UI_TouchOptions_SetConfig();

		if( item->id == ID_PROFILELIST )
		{
			char curprofile[256];
			int isCurrent;
			COM_FileBase( CVAR_GET_STRING( "touch_config_file" ), curprofile );
			isCurrent = !strcmp( curprofile, uiTouchOptions.profileDesc[ uiTouchOptions.profiles.curItem ]);

			// Scrolllist changed, update availiable options
			uiTouchOptions.remove.generic.flags |= QMF_GRAYED;
			if( ( uiTouchOptions.profiles.curItem > uiTouchOptions.firstProfile ) && !isCurrent )
				uiTouchOptions.remove.generic.flags &= ~QMF_GRAYED;

			uiTouchOptions.apply.generic.flags &= ~QMF_GRAYED;
			if( uiTouchOptions.profiles.curItem == 0 || uiTouchOptions.profiles.curItem == uiTouchOptions.firstProfile -1 )
				uiTouchOptions.profiles.curItem ++;
			if( isCurrent )
				uiTouchOptions.apply.generic.flags |= QMF_GRAYED;
		}
		return;
	}

	if( event != QM_ACTIVATED )
		return;

	switch( item->id )
	{
	case ID_DONE:
		UI_TouchOptions_SetConfig();
		UI_PopMenu();
		break;
	case ID_RESET:
		uiTouchOptions.save.generic.flags |= QMF_INACTIVE; 
		uiTouchOptions.remove.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.enable.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.profiles.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.moveX.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.moveY.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.lookX.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.lookY.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.reset.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.profilename.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.done.generic.flags |= QMF_INACTIVE;


		uiTouchOptions.msgBox.generic.flags &= ~QMF_HIDDEN;
		uiTouchOptions.promptMessage.generic.flags &= ~QMF_HIDDEN;
		uiTouchOptions.no.generic.flags &= ~QMF_HIDDEN;
		uiTouchOptions.yes.generic.flags &= ~QMF_HIDDEN;
		strcpy( uiTouchOptions.dialogText, "Reset all buttons?" );
		uiTouchOptions.dialogAction = UI_ResetButtons;
		break;
	case ID_DELETE:
		uiTouchOptions.save.generic.flags |= QMF_INACTIVE; 
		uiTouchOptions.remove.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.enable.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.profiles.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.moveX.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.moveY.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.lookX.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.lookY.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.reset.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.profilename.generic.flags |= QMF_INACTIVE;
		uiTouchOptions.done.generic.flags |= QMF_INACTIVE;


		uiTouchOptions.msgBox.generic.flags &= ~QMF_HIDDEN;
		uiTouchOptions.promptMessage.generic.flags &= ~QMF_HIDDEN;
		uiTouchOptions.no.generic.flags &= ~QMF_HIDDEN;
		uiTouchOptions.yes.generic.flags &= ~QMF_HIDDEN;
		strcpy( uiTouchOptions.dialogText, "Delete selected profile?" );
		uiTouchOptions.dialogAction = UI_DeleteProfile;
		break;
	case ID_YES:
	if( uiTouchOptions.dialogAction )
		uiTouchOptions.dialogAction();
	case ID_NO:
		uiTouchOptions.save.generic.flags &= ~QMF_INACTIVE; 
		uiTouchOptions.remove.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.enable.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.profiles.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.moveX.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.moveY.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.lookX.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.lookY.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.reset.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.profilename.generic.flags &= ~QMF_INACTIVE;
		uiTouchOptions.done.generic.flags &= ~QMF_INACTIVE;

		uiTouchOptions.msgBox.generic.flags |= QMF_HIDDEN;
		uiTouchOptions.promptMessage.generic.flags |= QMF_HIDDEN;
		uiTouchOptions.no.generic.flags |= QMF_HIDDEN;
		uiTouchOptions.yes.generic.flags |= QMF_HIDDEN;
		break;
	case ID_SAVE:
		{
			char name[256];
			if( uiTouchOptions.profilename.buffer[0] )
			{
				snprintf( name, 256, "touch_profiles/%s.cfg", uiTouchOptions.profilename.buffer );
				CVAR_SET_STRING("touch_config_file", name );
			}
			CLIENT_COMMAND( 1, "touch_writeconfig\n" );
		}
		UI_TouchOptions_GetProfileList();
		uiTouchOptions.profilename.buffer[0] = 0;
		uiTouchOptions.profilename.cursor = uiTouchOptions.profilename.scroll = 0;
		break;
	case ID_APPLY:
		{

			int i = uiTouchOptions.profiles.curItem;

			// preset selected
			if( i > 0 && i < uiTouchOptions.firstProfile - 1 )
			{
				char command[256];
				char *curconfig = CVAR_GET_STRING( "touch_config_file" );
				snprintf( command, 256, "exec \"touch_presets/%s\"\n", uiTouchOptions.profileDesc[ i ] );
				CLIENT_COMMAND( 1,  command );

				while( FILE_EXISTS( curconfig ) )
				{
					char copystring[256];
					char filebase[256];

					COM_FileBase( curconfig, filebase );

					if( snprintf( copystring, 256, "touch_profiles/%s (new).cfg", filebase ) > 255 )
						break;

					CVAR_SET_STRING( "touch_config_file", copystring );
					curconfig = CVAR_GET_STRING( "touch_config_file" );
				}
			}
			else if( i == uiTouchOptions.firstProfile )
				CLIENT_COMMAND( 1,"exec touch.cfg\n" );
			else if( i > uiTouchOptions.firstProfile )
			{
				char command[256];
				snprintf( command, 256, "exec \"touch_profiles/%s\"\n", uiTouchOptions.profileDesc[ i ] );
				CLIENT_COMMAND( 1,  command );
			}

			// try save config
			CLIENT_COMMAND( 1,  "touch_writeconfig\n" );

			// check if it failed ant reset profile to default if it is
			if( !FILE_EXISTS( CVAR_GET_STRING( "touch_config_file" ) ))
			{
				CVAR_SET_STRING( "touch_config_file", "touch.cfg" );
				uiTouchOptions.profiles.curItem = uiTouchOptions.firstProfile;
			}
			UI_TouchOptions_GetProfileList();
			UI_TouchOptions_GetConfig();
		}
	}
}