Created
December 30, 2018 20:18
-
-
Save DemmyDemon/12c3dd426e90269ec3963fb9bd01269e to your computer and use it in GitHub Desktop.
The salient bits of the stop zone stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeStopZone(heap,player) | |
if heap.stopZones[player] then | |
local zone = heap.stopZones[player] | |
local success = RemoveSpeedZone(zone.id) | |
if success then | |
log('Speed zone',zone.id,'removed') | |
else | |
log('Failed to remove speed zone',zone.id) | |
end | |
if DoesBlipExist(zone.centerBlip) then | |
RemoveBlip(zone.centerBlip) | |
else | |
log('Failed to remove centerBlip',zone.centerBlip) | |
end | |
if DoesBlipExist(zone.rangeBlip) then | |
RemoveBlip(zone.rangeBlip) | |
else | |
log('Failed to remove rangeBlip',zone.rangeBlip) | |
end | |
heap.stopZones[player] = nil | |
end | |
end | |
function createStopZone(heap,player,place,size,speed) | |
removeStopZone(heap,player) | |
local location | |
local found, Z = GetGroundZFor_3dCoord(place.x,place.y,place.z,true) | |
if found then | |
location = vector3(place.x,place.y,Z) | |
else | |
location = vector3(place.x,place.y,place.z) | |
end | |
local zone = AddSpeedZoneForCoord(location,size,speed,false) | |
local center,range = blipLocation(location,size) | |
log('Stop zone',zone,'created with blips',center,range) | |
heap.stopZones[player] = { | |
id = zone, | |
centerBlip = center, | |
rangeBlip = range, | |
location = location, | |
speed = speed, | |
size = size, | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment