<?php
# LFSLapper Script for Speed Radar (Only for Cops)
# List of usernames that should work for the radar
$CopUsernames = array("CopUser1", "CopUser2", "CopUser3");
Event OnInterval(1000) # Check every second
$Players = GetListOfPlayers();
foreach($Players as $Player) {
$UserName = GetCurrentPlayerVar("UserName", $Player);
$Speed = GetCurrentPlayerVar("Speed", $Player);
$Heading = GetCurrentPlayerVar("Heading", $Player);
$Distance = GetCurrentPlayerVar("Distance", $Player);
# Check if the player is a cop
$IsCop = in_array($UserName, $CopUsernames);
if($IsCop) {
# Check if there's a car in front within a certain distance (e.g., 50 meters)
$CarInFront = false;
foreach($Players as $OtherPlayer) {
if($Player != $OtherPlayer) {
$OtherDistance = GetCurrentPlayerVar("Distance", $OtherPlayer);
$OtherHeading = GetCurrentPlayerVar("Heading", $OtherPlayer);
if($OtherDistance < 50 && abs($Heading - $OtherHeading) < 10) { # Adjust distance and heading tolerance as needed
$CarInFront = true;
$OtherSpeed = GetCurrentPlayerVar("Speed", $OtherPlayer);
break;
}
}
}
if($CarInFront) {
if($OtherSpeed > 100) { # Speed limit (adjust as needed)
btnCreate("^1Speed Radar", 5, 5, 50, 10, 1, "^1Speeding car detected at " . $OtherSpeed . " km/h!");
} else {
btnCreate("^1Speed Radar", 5, 5, 50, 10, 1, "^2Car in front is within speed limit.");
}
} else {
btnCreate("^1Speed Radar", 5, 5, 50, 10, 1, "^2No car in front.");
}
}
}
EndEvent
?>