logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Add Friend system

    Scheduled Pinned Locked Moved
    Help and Support
    2
    3
    74
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Hayden
      last edited by

      Hi I need help. I’m trying to figure out how to add a friend system where you can search for a username and add them etc. any help would be appreciated... :)

      1 Reply Last reply Reply Quote 0
      • RobinsonXR
        RobinsonX
        last edited by

        Wow, this is a difficult task...

        If you are doing actual networking using HTTP requests or socket.io, you are going to need to learn a language called PHP and use a PHP server. I use 000filewebhost by Hostinger to create and manage my PHP server. This way, you can actually become friends with real players and interact with them. (You are probably not doing this, so I won't go into detail.)

        If you are just making a simple project with pre-made or generated usernames, you just need to know how to manipulate arrays to get the desired result you want.

        1 Reply Last reply Reply Quote 0
        • RobinsonXR
          RobinsonX
          last edited by

          All usernames should be inside an array, let's call this array Users.

          When searching for a name, you can loop through the entire array and check for usernames containing what you typed.

          For example, if you typed dog, all usernames containing dog should pop up. dog282, somedog and doggy are examples that follow this condition. Note that hyperPad that have a built-in feature to check if a text contains something, so you will need to make your own.

          So searching for dog should check for usernames in Users for keyword dog.

          All results should be placed in an another array, let's call this Results. This is where all the desired usernames will be after a search.

          After looping through Users, now you can loop through Results to get what you want to show. You can use Get Array Count to show the number of results or make a list appear.

          I know you have a lot of questions on what to do, but I don't know which ones you're going to ask. Feel free to ask me any questions! 😁

          1 Reply Last reply Reply Quote 1
          • First post
            Last post