public void Start() { Client = new API_ZloClient(); SubscribeEvents(); Client.Connect(); Client.SubToServerList(ZloBFGame.BF_3); Client.SubToServerList(ZloBFGame.BF_4); Client.GetItems(ZloBFGame.BF_3); Client.GetItems(ZloBFGame.BF_4); Client.GetStats(ZloBFGame.BF_3); Client.GetStats(ZloBFGame.BF_4); }
public static void Main(string[] args) { //This is your starting point of the application //first[After making sure ZClient.exe is open],you have to initialize the API and/or any other instances you are going to use in your implmentation Client = new API_ZloClient(); MyBF4ServerList = new List <MyBF4Server>(); //second, subscribe to the events, if you are too lazy you can copy them from down below SubscribeToEvents(); //third, connect to Zclient Client.Connect(); //from this point you have full control over the api, and you can call whatever methods you like //Subscripe to servers list //only call it ONCE Client.SubToServerList(ZloBFGame.BF_3); Client.SubToServerList(ZloBFGame.BF_4); ////Client.SubToServerList(ZloGame.BF_HardLine); Client.RunnableGameListReceived += Client_RunnableGameListReceived; Client.RefreshRunnableGamesList(); ////call this right before closing the application ////Client.Close() ////this property is updated everytime you reconnect with zclient,it represents the id of the player using the API ////Client.CurrentPlayerID ////same for player name ////Client.CurrentPlayerName ////use it as an indicator whether the API is connected to zclient or not ////Client.IsConnectedToZCLient ////Client.BF3Servers //a list of all bf3 servers ////Client.BF4Servers //a list of all bf4 servers ////Client.BFHServers //not implmented yet ////get items such as unlocks,battlepacks ////Client.GetItems(ZloGame.BF_3); Bf3 has no items //Client.GetItems(ZloGame.BF_4); ////Client.GetItems(ZloGame.BF_HardLine); not implmented yet //Client.GetStats(ZloGame.BF_3); //Client.GetStats(ZloGame.BF_4); ////Client.GetStats(ZloGame.BF_HardLine); not implmented yet ////no need to use it as the UserInfoReceived event is raised after connecting to zclient ////Client.GetUserInfo(); ////to join an offline game //Client.JoinOfflineGame(OfflinePlayModes.BF3_Single_Player); //Client.JoinOfflineGame(OfflinePlayModes.BF4_Single_Player); //Client.JoinOfflineGame(OfflinePlayModes.BF4_Test_Range); ////Client.JoinOfflineGame(OfflinePlayModes.BFH_Single_Player); not implmented yet ////note : COOP in all games isn't yet implmented //Client.JoinOnlineGame(OnlinePlayModes.BF4_Multi_Player , 0); ////Client.JoinOnlineGame(OnlinePlayModes.BF4_COOP , 0); //Client.JoinOnlineGame(OnlinePlayModes.BF4_Spectator , 0); ////joining Commander doesn't work yet //Client.JoinOnlineGame(OnlinePlayModes.BF4_Commander , 0); ////same as the above, but with extra password parameter ////note: you can check if server has a password using the IsPasswordProtected property of the server (more on that later) ////Client.JoinOnlineGameWithPassWord([play mode],[server id],[password]) ////will stop sending server updates ////Client.UnSubServerList([game]); Console.WriteLine("Press any key to Close the application ..."); Console.ReadKey(); //the end of the application Client.Dispose(); }