Помощь от знатаков. Пишу скрипт на тп с помощю ChatGPT. Teleport arizona rp

pajeloi_barbux

Новичок
Автор темы
7
0
Версия SA-MP
  1. 0.3.7 (R1)
  2. 0.3.7-R2
  3. 0.3.7-R3
  4. 0.3.7-R4
  5. Любая
Короче пишу скрипт с помощю чат chatjpt что бы он просто работал на аризоне (Ясен пень он будет кикать мне просто интересно что бо заработал хоть как то)
Вот -
function main()
sampRegisterChatCommand("tpm", toggleTeleport)
sampRegisterChatCommand("tpsp", setTeleportSpeed)
sampAddChatMessage("[tp by pajeloi_barebux] loaded", 0x00FF00)
end

function toggleTeleport()
teleportEnabled = not teleportEnabled
if teleportEnabled then
sampAddChatMessage("[tp by pajeloi_barebux] Teleport mode enabled", 0x00FF00)
else
sampAddChatMessage("[tp by pajeloi_barebux] Teleport mode disabled", 0xFF0000)
end
end

function setTeleportSpeed(arg)
local speed = tonumber(arg)
if speed ~= nil and speed >= 1 and speed <= 10 then
teleportSpeed = speed
sampAddChatMessage("[tp by pajeloi_barebux] Teleport speed set to " .. speed, 0x00FF00)
else
sampAddChatMessage("[tp by pajeloi_barebux] Invalid speed. Must be a number between 1 and 10.", 0xFF0000)
end
end

function teleportToMarker()
local success, x, y, z = getActiveInteriorInfo()
if not success then
x, y, z = getActiveCameraCoordinates()
end
local marker = getActiveCharWeapon() == 46 and getCharTarget(PLAYER_PED) or nil
if marker ~= nil then
local destX, destY, destZ = getMarkerPosition(marker)
if destX ~= 0.0 and destY ~= 0.0 and destZ ~= 0.0 then
local curX, curY, curZ = getCharCoordinates(PLAYER_PED)
local dist = getDistanceBetweenCoords3d(curX, curY, curZ, destX, destY, destZ)
local time = math.floor(dist / teleportSpeed * 1000)
sampAddChatMessage("[tp by pajeloi_barebux] Teleporting to marker...", 0x00FF00)
wait(time)
setCharCoordinates(PLAYER_PED, destX, destY, destZ)
sampAddChatMessage("[tp by pajeloi_barebux] Teleported to marker", 0x00FF00)
else
sampAddChatMessage("[tp by pajeloi_barebux] No marker found", 0xFF0000)
end
else
sampAddChatMessage("[tp by pajeloi_barebux] No marker found", 0xFF0000)
end
end

function wait(ms)
local start = os.clock()
while os.clock() - start < ms / 1000 do end
end

teleportEnabled = false
teleportSpeed = 5

main()

function onScriptTerminate(script, quitGame)
end
Вот ошибка которю скопировал с логов монлодаера
[23:16:53.473183] (system) Loading script 'H:\Ariozna\moonloader\teleportik.lua'...
[23:16:53.473183] (debug) New script: 3179E684
[23:16:53.486854] (error) teleportik.lua: opcode '0AF8' call caused an unhandled exception
stack traceback:
[C]: in function 'sampAddChatMessage'
H:\Ariozna\moonloader\teleportik.lua:4: in function 'main'
H:\Ariozna\moonloader\teleportik.lua:58: in main chunk
[23:16:53.486854] (error) teleportik.lua: Script died due to an error. (3179E684)
 
  • Bug
Реакции: YarikVL и paccvetov