This paper presents a trust value algorithm aimed at enhancing security in wireless ad-hoc networks by addressing packet drop attacks, which are prevalent due to the lack of infrastructure in these networks. It proposes a method for detecting malicious nodes using trust values, with initially zero trust assigned to all nodes, and updates based on packet transmission success or failure. The algorithm reduces the packet drop ratio and improves the overall security by classifying nodes as legitimate or malicious based on their trust levels.