Player movement script like in FPS

I have 2 scripts, which make player move like in the FPS game. But it don’t move to that direction, to which player are looking - it always move to the same direction, regardless of the direction of the camera…

mouselook.cs

float yRotation;
float xRotation;
float lookSensitivity = 5;
float currentXRotation;
float currentYRotation;
float yRotationV;
float xRotationV;
float lookSmoothnes = 0.1f; 

void Update ()
{
    yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
    xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;
    xRotation = Mathf.Clamp(xRotation, -80, 100);
    currentXRotation = Mathf.SmoothDamp(currentXRotation, xRotation, ref xRotationV, lookSmoothnes);
    currentYRotation = Mathf.SmoothDamp(currentYRotation, yRotation, ref yRotationV, lookSmoothnes);
    transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
}

playermovement.cs

public float walkSpeed = 6.0F;
public float jumpSpeed = 8.0F;
public float runSpeed = 8.0F;
public float gravity = 20.0F;

private Vector3 moveDirection = Vector3.zero;
private CharacterController controller;

void Start()
{
    controller = GetComponent<CharacterController>();
}

void Update()
{
    if (controller.isGrounded)
    {
        moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        moveDirection = transform.TransformDirection(moveDirection);
        moveDirection *= walkSpeed;
        if (Input.GetButton("Jump"))
            moveDirection.y = jumpSpeed;
    }
    moveDirection.y -= gravity * Time.deltaTime;
    controller.Move(moveDirection * Time.deltaTime);
}

Your issue lies in this line:

moveDirection = transform.TransformDirection(moveDirection);

Rather than pass in moveDirection to the function TransformDirection, you want to pass in the forward vector for camera.

if you put both codes in a same script, it basically works, the only issue is that the player LITERALLY moves to the direction of the camera, so i guess you would have to implement some dampening lines after the vector3 part

For the camera part i did some editing to fix it for the new unity versions but im getting a error saying No overload for method ‘SmoothDamp’ takes 3 arguments

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class mouselook : MonoBehaviour
{
float yRotation;
float xRotation;
float lookSensitivity = 5f;
float currentXRotation;
float currentYRotation;
float yRotationV;
float xRotationV;

void Update()
{
    yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
    xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;
    xRotation = Mathf.Clamp(xRotation, -80, 100);
    currentXRotation = Mathf.SmoothDamp(currentXRotation, xRotation, ref xRotationV);
    currentYRotation = Mathf.SmoothDamp(currentYRotation, yRotation, ref yRotationV);
    transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
}

}***