local hook = require 'samp.events' local vector = require 'vector3d' function main()…
- User
local hook = require 'samp.events' local vector = require 'vector3d'
function main() repeat wait(0) until isSampAvailable() while not isSampAvailable() do wait(3500) end sampAddChatMessage("coordmaster loaded", -1) sampRegisterChatCommand('tpc', function() local _, x,y,z = getTargetBlipCoordinates() if not _ then printString("
rcheckpoint not found!",500) else if tp then tp = false sync = false setCharCoordinates(1,charPosX,charPosY,charPosZ) else if _ then charPosX,charPosY,charPosZ = getCharCoordinates(1) metkaX = x metkaY = y metkaZ = z charPosZ = metkaZ tp = true sync = true end end end end) sampRegisterChatCommand('tpm', function() local _, x,y,z = SearchMarker() if not _ then printString("rmarker not found!",500) else if tp then tp = false sync = false setCharCoordinates(1,charPosX,charPosY,charPosZ) else if _ then charPosX,charPosY,charPosZ = getCharCoordinates(1) metkaX = x metkaY = y metkaZ = z charPosZ = metkaZ tp = true sync = true end end end end) while true do wait(0) if tp then if isCharInAnyCar(1) and getDriverOfCar(getCarCharIsUsing(1)) == 1 then if getDistanceBetweenCoords3d(metkaX,metkaY,metkaZ, charPosX, charPosY, charPosZ) >= 10 then koordi = {} sampForceVehicleSync() local distan2 = getDistanceBetweenCoords2d(metkaX,metkaY, charPosX, charPosY) local vectorX = metkaX - charPosX local vectorY = metkaY - charPosY local vectorZ = metkaZ - charPosZ local vec = vector(vectorX, vectorY, vectorZ) vec:normalize() charPosX = charPosX + vec.x * 9 charPosY = charPosY + vec.y * 9 charPosZ = charPosZ + vec.z sendOnfootSync(charPosX, charPosY, charPosZ) setCharCoordinates(1,metkaX,metkaY,metkaZ) printStringNow('wwait', 1000) wait(35) else sendOnfootSync(metkaX , metkaY , metkaZ) setCarCoordinates(storeCarCharIsInNoSave(PLAYER_PED), metkaX , metkaY , metkaZ) setCharCoordinates(1,charPosX,charPosY,charPosZ) printStringNow('wteleportedgsuccessfully', 1000) tp = false end elseif not isCharInAnyCar(1) or getDriverOfCar(getCarCharIsUsing(1)) ~= 1 then tp = false end end end endfunction sendOnfootSync(x, y, z) local data = samp_create_sync_data('vehicle') data.position = {x = x, y = y, z = z} data.moveSpeed = {0.6, 0.6, -0.6} data.keysData = 0 data.send() end
function hook.onSendVehicleSync() if tp then return false end end
function SearchMarker() 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 MarkerStruct = 0xC7F168 + id * 56 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
function samp_create_sync_data(sync_type, copy_from_player) local ffi = require 'ffi' local sampfuncs = require 'sampfuncs' -- from SAMP.Lua local raknet = require 'samp.raknet' --require 'samp.synchronization'
- Assistant
- User
Шаг за шагом перепроверь свой код на неиспользуемые участки, ошибки логики и так далее
- Assistant
- User
по итогу sync не используется и local ret_posX, ret_posY, ret_posZ = 0.0, 0.0, 0.0 тоже
- Assistant