Найти позицию игрока по ID

HomeTown

Новичок
Автор темы
14
1
Версия SA-MP
  1. 0.3DL
Привет, прошу прощения за свой плохой пост.
Как я могу найти позицию игрока (x - y - z) на основе идентификатора игрока, используя только адрес указателя?
Заранее спасибо.
 

CaJlaT

07.11.2024 14:55
Модератор
2,835
2,673
Что за язык? Луа? Плюсы?
На будущее, создавай вопрос в специальном разделе:

Lua:
local result, ped = sampGetCharHandleBySampPlayerId(id)
if result then
    local X, Y, Z = getCharCoordinates(ped)
    print(X, Y, Z)
else
    print('Игрока нет в зоне стрима')
end
 
  • Нравится
Реакции: HomeTown

HomeTown

Новичок
Автор темы
14
1
Что за язык? Луа? Плюсы?
На будущее, создавай вопрос в специальном разделе:

Lua:
local result, ped = sampGetCharHandleBySampPlayerId(id)
if result then
    local X, Y, Z = getCharCoordinates(ped)
    print(X, Y, Z)
else
    print('Игрока нет в зоне стрима')
end
Спасибо за Ваш ответ.
Where can I find the library of functions you are using? (sampGetCharHandleBySampPlayerId (id) and getCharCoordinates (ped))
Нашел, спасибо. (MoonLoader)
 
Последнее редактирование:

HomeTown

Новичок
Автор темы
14
1
Что за язык? Луа? Плюсы?
На будущее, создавай вопрос в специальном разделе:

Lua:
local result, ped = sampGetCharHandleBySampPlayerId(id)
if result then
    local X, Y, Z = getCharCoordinates(ped)
    print(X, Y, Z)
else
    print('Игрока нет в зоне стрима')
end
Я получаю сообщение об ошибке, вы можете помочь?
попытка вызвать глобальный sampGetCharHandleBySampPlayerId (нулевое значение).
Думаю, я не могу найти или добавить библиотеку.
 

CaJlaT

07.11.2024 14:55
Модератор
2,835
2,673
Я получаю сообщение об ошибке, вы можете помочь?
попытка вызвать глобальный sampGetCharHandleBySampPlayerId (нулевое значение).
Думаю, я не могу найти или добавить библиотеку.
Какая версия moonloader?

Я кодирую с помощью Visual Studio C #.
Это lua (moonloader)
 
  • Нравится
Реакции: HomeTown

HomeTown

Новичок
Автор темы
14
1
Я только что установил, должно быть 26.5
Спасибо также за быстрые ответы.
Загрузил на Атом.


Код:
script_name("Test Code")
script_author("CaJlaT && HomeTown")
require "lib.moonloader"

function main()
  wait(5000)
  local result, ped = sampGetCharHandleBySampPlayerId(0)
  if result then
    local X, Y, Z = getCharCoordinates(ped)
    print (X, Y, Z)
  else
    print ('bla bla bla')
  end
end
 
Последнее редактирование:

HomeTown

Новичок
Автор темы
14
1
Moonloader.log

log:
[00:54:46.717277] (debug)    Module handle: 6AEC0000

MoonLoader v.026.5-beta loaded.
Developers: FYP, hnnssy, EvgeN 1137

Copyright (c) 2016, BlastHack Team
https://www.blast.hk/moonloader/

[00:54:46.717277] (info)    Working directory: D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader
[00:54:46.717277] (debug)    FP Control: 0009001F
[00:54:46.717277] (debug)    Game: GTA SA 1.0.0.0 US
[00:54:46.717277] (system)    Installing pre-game hooks...
[00:54:46.721280] (system)    Hooks installed.
[00:54:49.792463] (debug)    Initializing opcode handler table
[00:54:49.792463] (debug)    package.path = D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?\init.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?\init.lua;.\?.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?.luac;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?\init.luac;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?.luac;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?\init.luac;.\?.luac
[00:54:49.792463] (debug)    package.cpath = D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?.dll;
[00:54:49.795464] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\AutoReboot.lua'...
[00:54:49.795464] (debug)    New script: 097F645C
[00:54:49.796465] (system)    ML-AutoReboot: Loaded successfully.
[00:54:49.796465] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\check-moonloader-updates.lua'...
[00:54:49.796465] (debug)    New script: 097F68F4
[00:54:49.798466] (system)    Check MoonLoader Updates: Loaded successfully.
[00:54:49.798466] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\MYTESTCODE.lua'...
[00:54:49.798466] (debug)    New script: 097F6A7C
[00:54:49.799468] (system)    Test Code: Loaded successfully.
[00:54:49.799468] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\reload_all.lua'...
[00:54:49.799468] (debug)    New script: 097F6D8C
[00:54:49.800468] (system)    ML-ReloadAll: Loaded successfully.
[00:54:49.800468] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\SF Integration.lua'...
[00:54:49.800468] (debug)    New script: 097F6C04
[00:54:49.802470] (system)    SF Integration: Loaded successfully.
[00:54:50.534989] (system)    Installing post-load hooks...
[00:54:50.534989] (system)    Hooks installed.
[00:54:55.510561] (error)    Test Code: ...heft Auto San Andreas\moonloader\MYTESTCODE.lua:7: attempt to call global 'sampGetCharHandleBySampPlayerId' (a nil value)
stack traceback:
    ...heft Auto San Andreas\moonloader\MYTESTCODE.lua: in function <...heft Auto San Andreas\moonloader\MYTESTCODE.lua:5>
[00:54:55.510561] (error)    Test Code: Script died due to an error. (097F6A7C)
 

CaJlaT

07.11.2024 14:55
Модератор
2,835
2,673
Moonloader.log

log:
[00:54:46.717277] (debug)    Module handle: 6AEC0000

MoonLoader v.026.5-beta loaded.
Developers: FYP, hnnssy, EvgeN 1137

Copyright (c) 2016, BlastHack Team
https://www.blast.hk/moonloader/

[00:54:46.717277] (info)    Working directory: D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader
[00:54:46.717277] (debug)    FP Control: 0009001F
[00:54:46.717277] (debug)    Game: GTA SA 1.0.0.0 US
[00:54:46.717277] (system)    Installing pre-game hooks...
[00:54:46.721280] (system)    Hooks installed.
[00:54:49.792463] (debug)    Initializing opcode handler table
[00:54:49.792463] (debug)    package.path = D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?\init.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?\init.lua;.\?.lua;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?.luac;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?\init.luac;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?.luac;D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\?\init.luac;.\?.luac
[00:54:49.792463] (debug)    package.cpath = D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\lib\?.dll;
[00:54:49.795464] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\AutoReboot.lua'...
[00:54:49.795464] (debug)    New script: 097F645C
[00:54:49.796465] (system)    ML-AutoReboot: Loaded successfully.
[00:54:49.796465] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\check-moonloader-updates.lua'...
[00:54:49.796465] (debug)    New script: 097F68F4
[00:54:49.798466] (system)    Check MoonLoader Updates: Loaded successfully.
[00:54:49.798466] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\MYTESTCODE.lua'...
[00:54:49.798466] (debug)    New script: 097F6A7C
[00:54:49.799468] (system)    Test Code: Loaded successfully.
[00:54:49.799468] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\reload_all.lua'...
[00:54:49.799468] (debug)    New script: 097F6D8C
[00:54:49.800468] (system)    ML-ReloadAll: Loaded successfully.
[00:54:49.800468] (system)    Loading script 'D:\Program Files\Steam\steamapps\common\Grand Theft Auto San Andreas\moonloader\SF Integration.lua'...
[00:54:49.800468] (debug)    New script: 097F6C04
[00:54:49.802470] (system)    SF Integration: Loaded successfully.
[00:54:50.534989] (system)    Installing post-load hooks...
[00:54:50.534989] (system)    Hooks installed.
[00:54:55.510561] (error)    Test Code: ...heft Auto San Andreas\moonloader\MYTESTCODE.lua:7: attempt to call global 'sampGetCharHandleBySampPlayerId' (a nil value)
stack traceback:
    ...heft Auto San Andreas\moonloader\MYTESTCODE.lua: in function <...heft Auto San Andreas\moonloader\MYTESTCODE.lua:5>
[00:54:55.510561] (error)    Test Code: Script died due to an error. (097F6A7C)
полный код скрипта покажи
 

HomeTown

Новичок
Автор темы
14
1
полный код скрипта покажи
Код:
script_name("Test Code")
script_author("CaJlaT && HomeTown")
require "lib.moonloader"

function main()
  wait(5000)
  local result, ped = sampGetCharHandleBySampPlayerId(0)
  if result then
    local X, Y, Z = getCharCoordinates(ped)
    print (X, Y, Z)
  else
    print ('bla bla bla')
  end
end
 

CaJlaT

07.11.2024 14:55
Модератор
2,835
2,673
Код:
script_author("CaJlaT && HomeTown")
require "lib.moonloader"

function main()
  wait(5000)
  local result, ped = sampGetCharHandleBySampPlayerId(0)
  if result then
    local X, Y, Z = getCharCoordinates(ped)
    print (X, Y, Z)
  else
    print ('bla bla bla')
  end
end
Lua:
script_author("CaJlaT && HomeTown")
require "lib.moonloader"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    local result, ped = sampGetCharHandleBySampPlayerId(0)
    if result then
        local X, Y, Z = getCharCoordinates(ped)
        print (X, Y, Z)
    else
        print ('bla bla bla')
    end
end
 
  • Нравится
Реакции: HomeTown

HomeTown

Новичок
Автор темы
14
1
Lua:
script_author("CaJlaT && HomeTown")
require "lib.moonloader"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    local result, ped = sampGetCharHandleBySampPlayerId(0)
    if result then
        local X, Y, Z = getCharCoordinates(ped)
        print (X, Y, Z)
    else
        print ('bla bla bla')
    end
end
moonloader.log
[01:34:57.054672] (system) Installing post-load hooks...
[01:34:57.055673] (system) Hooks installed.
[01:34:57.055673] (system) mytestcode.lua: Script terminated. (098E7484)

В качестве версии я использую 0.3DL. Могу ли я использовать SampFuncs?