local S
function main()
sampRegisterChatCommand("mar", function()
S = not S
sampAddChatMessage(string.format("state: %s", S and "on" or "off"), -1)
end)
while true do wait(0)
if(S) then
local X, Y, Z = getCharCoordinates(PLAYER_PED)
if(SearchMarker(X, Y, Z)) then
local fX, fY, fZ = SearchMarker(X, Y, Z)
wait(10000)
setCharCoordinates(PLAYER_PED, fX, fY, fZ)
end
end
end
end
function SearchMarker(posX, posY, posZ)
local ret_posX = 0.0
local ret_posY = 0.0
local ret_posZ = 0.0
local isFind = false
for id = 0, 31 do
local MarkerStruct = 0
if isRace then MarkerStruct = 0xC7F168 + id * 56
else MarkerStruct = 0xC7DD88 + id * 160 end
local MarkerPosX = representIntAsFloat(readMemory(MarkerStruct + 0, 4, false))
local MarkerPosY = representIntAsFloat(readMemory(MarkerStruct + 4, 4, false))
local MarkerPosZ = representIntAsFloat(readMemory(MarkerStruct + 8, 4, false))
if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
ret_posX = MarkerPosX
ret_posY = MarkerPosY
ret_posZ = MarkerPosZ
isFind = true
end
end
return isFind, ret_posX, ret_posY, ret_posZ
end