I've tried some tries and couldn't make it, can someone help?
<?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
?>
8/23/2024 9:36:25 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:37:44 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:38:56 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:40:04 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:40:54 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:41:09 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:43:56 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:45:05 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
8/23/2024 9:50:44 PM -> Var not defined on file: ".\default\LFSLapper.lpr" at line #174
$StoreOfflineData = 0; #storedvalue.dbs Store Offline data , even when the player doesnt exist in the database.