Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * =============================================================================
- * Eventscripts
- * Copyright (C) 2012 Eventscripts Development Team. All rights reserved.
- * =============================================================================
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, version 3.0, as published by the
- * Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the Eventscripts Development Team gives you permission
- * to link the code of this program (as well as its derivative works) to
- * "Half-Life 2," the "Source Engine," and any Game MODs that run on software
- * by the Valve Corporation. You must obey the GNU General Public License in
- * all respects for all other code used. Additionally, the Eventscripts
- * Development Team grants this exception to all derivative works.
- */
- //---------------------------------------------------------------------------------
- // Includes
- //---------------------------------------------------------------------------------
- #include "export_main.h"
- #include "core/es_python.h"
- #include "utility/wrap_macros.h"
- #include "iserver.h"
- #include "iclient.h" // Compile fails because IClient is not defined but used as return :P
- //---------------------------------------------------------------------------------
- // Namespaces to use.
- //---------------------------------------------------------------------------------
- using namespace boost::python;
- //---------------------------------------------------------------------------------
- // External variables to use.
- //---------------------------------------------------------------------------------
- extern IServer* iserver;
- //---------------------------------------------------------------------------------
- // Returns the server instance.
- //---------------------------------------------------------------------------------
- IServer* GetServer( void )
- {
- return iserver;
- }
- //---------------------------------------------------------------------------------
- // IServer overloads
- //---------------------------------------------------------------------------------
- DECLARE_CLASS_METHOD_OVERLOAD(IServer, BroadcastMessage, 1, 3)
- //---------------------------------------------------------------------------------
- // Wraps game server related structures.
- //---------------------------------------------------------------------------------
- DECLARE_ES_MODULE(server)
- {
- // ----------------------------------------------------------
- // The server interface.
- // ----------------------------------------------------------
- BOOST_ABSTRACT_CLASS( IServer )
- CLASS_METHOD(IServer,
- GetNumClients,
- "returns current number of clients"
- )
- CLASS_METHOD(IServer,
- GetNumProxies,
- "returns number of attached HLTV proxies"
- )
- CLASS_METHOD(IServer,
- GetNumFakeClients,
- "returns number of fake clients/bots"
- )
- CLASS_METHOD(IServer,
- GetMaxClients,
- "returns current client limit"
- )
- CLASS_METHOD(IServer,
- GetClient,
- reference_existing_object_policy(),
- "returns interface to client",
- args("index")
- )
- CLASS_METHOD(IServer,
- GetClientCount,
- "returns number of clients slots (used & unused)"
- )
- CLASS_METHOD(IServer,
- GetUDPPort,
- "returns current used UDP port"
- )
- CLASS_METHOD(IServer,
- GetTime,
- "returns game world time"
- )
- CLASS_METHOD(IServer,
- GetTick,
- "returns game world tick"
- )
- CLASS_METHOD(IServer,
- GetTickInterval,
- "returns tick interval in seconds"
- )
- CLASS_METHOD(IServer,
- GetTimescale,
- "returns the game time scale (multiplied in conjunction with host_timescale)"
- )
- CLASS_METHOD(IServer,
- GetName,
- "returns public server name"
- )
- CLASS_METHOD(IServer,
- GetMapName,
- "current map name (BSP)"
- )
- CLASS_METHOD(IServer,
- GetSpawnCount,
- "TODO"
- )
- CLASS_METHOD(IServer,
- GetNumClasses,
- "TODO"
- )
- CLASS_METHOD(IServer,
- GetClassBits,
- "TODO"
- )
- CLASS_METHOD(IServer,
- GetNetStats,
- "total net in/out in bytes/sec",
- args("avgIn","avgOut")
- )
- CLASS_METHOD(IServer,
- GetNumPlayers,
- "TODO"
- )
- CLASS_METHOD(IServer,
- GetPlayerInfo,
- "TODO",
- args("ClientIndex","Player_Info_T")
- )
- CLASS_METHOD(IServer,
- IsActive,
- "TODO"
- )
- CLASS_METHOD(IServer,
- IsLoading,
- "TODO"
- )
- CLASS_METHOD(IServer,
- IsDedicated,
- "TODO"
- )
- CLASS_METHOD(IServer,
- IsPaused,
- "TODO"
- )
- CLASS_METHOD(IServer,
- IsMultiplayer,
- "TODO"
- )
- CLASS_METHOD(IServer,
- IsPausable,
- "TODO"
- )
- CLASS_METHOD(IServer,
- IsHLTV,
- "TODO"
- )
- CLASS_METHOD(IServer,
- IsReplay,
- "TODO"
- )
- CLASS_METHOD(IServer,
- GetPassword,
- "returns the password or NULL if none set"
- )
- CLASS_METHOD(IServer,
- SetPaused,
- "TODO",
- args("bPaused")
- )
- CLASS_METHOD(IServer,
- SetTimescale,
- "TODO",
- args("flTimescale")
- )
- CLASS_METHOD(IServer,
- SetPassword,
- "set password (NULL to disable)",
- args("szPassword")
- )
- /*CLASS_METHOD_OVERLOAD(IServer,
- BroadcastMessage,
- "TODO",
- args("msg", "onlyactive", "reliaable")
- )
- CLASS_METHOD(IServer,
- BroadcastMessage,
- "TODO",
- args("msg", "filter")
- )*/
- CLASS_METHOD(IServer,
- DisconnectClient,
- "TODO",
- args("client", "reason")
- )
- BOOST_END_CLASS()
- // ----------------------------------------------------------
- // Expose the global interface to the event manager.
- // ----------------------------------------------------------
- BOOST_FUNCTION(GetServer, reference_existing_object_policy());
- }
Add Comment
Please, Sign In to add comment