Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function searchIllegalCargo()
- local players = getElementsByType("player")
- illegalSearch[localPlayer] = 0
- local x, y, z = getElementPosition(localPlayer)
- --Police output
- if (lawTeam[getTeamName(getPlayerTeam(localPlayer))]) then
- for crim, bool in pairs(crimInMission) do
- if (bool) then
- local mX, mY, mZ = getElementPosition(crim)
- if (getDistanceBetweenPoints2D(x, y, mX, mY) <= 300) then
- illegalSearch[localPlayer] = illegalSearch[localPlayer] + 1
- end
- end
- if (illegalSearch[localPlayer] ~= 0) then
- exports.CIThelp:modTextBar("illegalSearch", "You are near of "..tostring(illegalSearch[localPlayer]).." crim Trucker", 0, 0, 200)
- else
- exports.CIThelp:modTextBar("illegalSearch", "")
- end
- end
- --Criminal output
- elseif (crimTeam[getTeamName(getPlayerTeam(localPlayer))] and inTask) then
- illegalSearch[localPlayer] = {}
- for i, pol in pairs(players) do
- if (lawTeam[getTeamName(getPlayerTeam(pol))]) then
- local mX, mY, mZ = getElementPosition(pol)
- local distance = getDistanceBetweenPoints2D(x, y, mX, mY)
- if (distance <= 400) then
- illegalSearch[localPlayer][#illegalSearch[localPlayer] + 1] = distance
- end
- end
- end
- table.sort(illegalSearch[localPlayer], sortMyTable)
- if (illegalSearch[localPlayer][1] ~= 0) then
- exports.CIThelp:modTextBar("illegalSearch", "Run from police before they catch you! Distance: "..math.ceil(illegalSearch[localPlayer][1], 0).." m", 100, 0, 0)
- else
- exports.CIThelp:modTextBar("illegalSearch", "")
- end
- else
- exports.CIThelp:modTextBar("illegalSearch", "")
- end
- end
- setTimer(searchIllegalCargo, 100, 0)
- function sortMyTable(a, b)
- return a < b
- end
Advertisement
Add Comment
Please, Sign In to add comment