Results 1 to 3 of 3
  1. #1
    VizikYundersen's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0

    Post (H1Z1) Vizik's LOCHelper

    Vizik's LOCHelper (For H1Z1)

    This tool will guide you in which direction you should be facing. Select a major city/area, enter x/z coords and try to match the heading it gives you.

    It isn't really accurate, it will give you a vague 90 degrees so there's no absolute guarantee it will give you satisfying results.
    I apologize in advance since I am a beginner but I hope this will be helpful or atleast a little interesting... or something to laugh at. Enjoy




    Code:
    //Vizik's LOCHelper
    
    #include <iostream>
    #include <string>
    using namespace std;
    
    void headingCal(int cityXCoord,int cityYCoord);
    void area(char menuOption);
    
    
    void headingCal(int cityXCoord,int cityYCoord)
    {
    	int xCoord;
    	int yCoord;
    	string SN;// Will be set to North or South and will output
    	string EW;
    	string snHeading; //Gives the proper heading for North/South
    	string ewHeading;
    	cout << "Enter your x: ";
    	cin >> xCoord;
    	cout << "Enter your z; ";
    	cin >> yCoord;
    	if (xCoord >= cityXCoord){
    		SN = "South";
    		snHeading = "-1.5";
    	}
    	else if (xCoord <= cityXCoord){
    		SN = "North";
    		snHeading = "1.5";
    	}
    	if (yCoord >= cityYCoord){
    		EW = "East";
    		ewHeading = "0.0";
    	}
    	else if (yCoord <= cityYCoord){
    		EW = "West";
    		ewHeading = "-3.1";
    	}
    	cout << "Head " << SN << " " << EW << "." << endl;
    	cout << "Your heading should be between " << snHeading << " and " << ewHeading << "." << endl;
    }
    
    void area(char menuOption)
    {
    	int xCoord [5] = {0, 1000, -900, -1900, -1300};
    	int yCoord [5] = {-1000, 2700, 2700, -2200, 1700};
    	switch (menuOption) {
    	
    	case 'P':
    	cout << "PleasantValley:" << endl;
    	headingCal(xCoord[1], yCoord[1]);	
    	break;
    	
    	case 'V':
    	cout << "VillasDevelopment:" << endl;
    	headingCal(xCoord[2], yCoord[2]);	
    	break;
    
    	case 'L':
    	cout << "LonePineDevelopment:" << endl;
    	headingCal(xCoord[3], yCoord[3]);	
    	break;
    
    	case 'H':
    	cout << "HerringTruckStop:" << endl;
    	headingCal(xCoord[4], yCoord[4]);	
    	break;
    
    	case 'T':
    	cout << "Tamatama" << endl;
    	headingCal(xCoord[5], yCoord[5]);
    	break;
    	}
    }
    
    int main()
    {
    	cout << "Vizik's LOCHelper" << endl << endl;
    	bool menuRun = true;
    	
    	cout << "_________[Menu]________" << endl;
    	cout << "|[P]easantValley       |" << endl;
    	cout << "|[V]illasDevelopment   |" << endl;
    	cout << "|[L]onePineDevelopment |" << endl;
    	cout << "|[H]erringTruckstop    |" << endl;
    	cout << "|[T]amatama(Cranberry) |" << endl;
    	cout << "|[E]xit                |" << endl;
    	cout << "|______________________|" << endl;
    	
    	while (menuRun == true){
    	char menuOption;
    	cin >> menuOption; //Takes user's input
    	menuOption = toupper(menuOption);//Sets char to uppercase 
    	
    	if (menuOption == 'E') //If user enters e or E the program will stop
    	{
    		menuRun = false;
    	
    	}
    	area(menuOption);
    	
    }
    	return 0;
    }
    Last edited by VizikYundersen; 02-02-2015 at 07:33 PM.

  2. #2
    InunoTaishou's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    The Internet
    Posts
    446
    Reputation
    20
    Thanks
    951
    My Mood
    Relaxed
    It's not bad for a beginner program. Not something to laugh at when you're using it to better understand what you've learned.

    A few things though:
    if, else if, else if, else if
    stack on top of each other looks bad, look into switch (menuOption) since you're just doing it off of char anyway.

    You can make your user input case insensitive by first making it lowercase or uppercase, look into toupper(var) or tolower(var) (then the user can use P or p, E or e)

    Since you're running your menu and the if statements in the while (menuRun == true) you don't need Start: and else goto start. If your intention is to make it so the cout statements don't show up continuously you can move the while (true) statement to right before cin >> menuOption

    And void (for function type) since you're always returning 0 anyway, you don't really need "int" function.

    There might be a few other things I have overlooked but this would be some good things to look into for you.
    https://www.mpgh.net/forum/signaturepics/sigpic210976_1.gif

  3. The Following User Says Thank You to InunoTaishou For This Useful Post:

    VizikYundersen (02-02-2015)

  4. #3
    VizikYundersen's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by InunoTaishou View Post
    It's not bad for a beginner program. Not something to laugh at when you're using it to better understand what you've learned.

    A few things though:
    if, else if, else if, else if
    stack on top of each other looks bad, look into switch (menuOption) since you're just doing it off of char anyway.

    You can make your user input case insensitive by first making it lowercase or uppercase, look into toupper(var) or tolower(var) (then the user can use P or p, E or e)

    Since you're running your menu and the if statements in the while (menuRun == true) you don't need Start: and else goto start. If your intention is to make it so the cout statements don't show up continuously you can move the while (true) statement to right before cin >> menuOption

    And void (for function type) since you're always returning 0 anyway, you don't really need "int" function.

    There might be a few other things I have overlooked but this would be some good things to look into for you.
    Thanks man! It was pretty fun adding the new improvements and at the same time I decided to rewrite it to make it a little less chunky

Similar Threads

  1. [Info] Status of H1Z1
    By TheFlyingDutchman' in forum H1Z1 Hacks & Cheats
    Replies: 58
    Last Post: 03-08-2020, 05:13 PM
  2. h1z1 vs dayz
    By 2Skillz4You in forum General
    Replies: 10
    Last Post: 07-25-2014, 09:18 PM
  3. New Game : H1Z1! SOE Game! 1000 Player+ Servers!
    By Rance-Llama in forum General Gaming
    Replies: 0
    Last Post: 04-19-2014, 10:54 PM
  4. H1Z1 hype!
    By Polygon in forum General
    Replies: 14
    Last Post: 04-19-2014, 03:10 PM