Как привязать текст на игрока?

Любитель Детройта...

Известный
Автор темы
497
94
Версия MoonLoader
.026-beta
Ку ребят, короче такая дилема.... Нашел скрипт информер об игроке при наведении на него ПКМ
так вот как сделать так что бы инфа отоброжалась не слева от экрана а на игроке:


вот пример до
1634458648443.png


а вот так что бы было
1634458692219.png



пробывал пару способов но отоброжается криво или просто на игроке, так как сделать так что бы отображалось как на 2 скрине? чуть правее от скина...


Скрипт:
script_name("Player info")
script_version_number(1)
script_version("1.1")
script_author("RollUp")

result = true

function main()
while not isSampAvailable() do wait(200) end
x, y = getScreenResolution()
font = renderCreateFont("Arial", 10, 14)
sampRegisterChatCommand('pinfo', pinfo)
    while true do
        wait(0)
        res, handle = getCharPlayerIsTargeting(playerHandle)
        if res and not isKeyDown(119) and result then
              resid, id = sampGetPlayerIdByCharHandle(handle)
               color = sampGetPlayerColor(id)
               name = sampGetPlayerNickname(id)
               weapon = getCurrentCharWeapon(handle)
               weap = getweaponname(weapon)
               health = sampGetPlayerHealth(id)
              armor = sampGetPlayerArmor(id)
               ping = sampGetPlayerPing(id)
               score = sampGetPlayerScore(id)
              renderFontDrawText(font,string.format("Nickname: %s[%d]\nHealth: %d \nArmor: %d\nScore: %d\nPing: %d\nWeapon: %s", name, id, health, armor, score, ping, weap) ,x/35, y/3, color)
        end
    end
end

function pinfo()
    if result then
        result = false
    elseif not result then
        result = true
    end
end


function getweaponname(weapon)
  local names = {
  [0] = "Fist",
  [1] = "Brass Knuckles",
  [2] = "Golf Club",
  [3] = "Nightstick",
  [4] = "Knife",
  [5] = "Baseball Bat",
  [6] = "Shovel",
  [7] = "Pool Cue",
  [8] = "Katana",
  [9] = "Chainsaw",
  [10] = "Purple Dildo",
  [11] = "Dildo",
  [12] = "Vibrator",
  [13] = "Silver Vibrator",
  [14] = "Flowers",
  [15] = "Cane",
  [16] = "Grenade",
  [17] = "Tear Gas",
  [18] = "Molotov Cocktail",
  [22] = "9mm",
  [23] = "Silenced 9mm",
  [24] = "Desert Eagle",
  [25] = "Shotgun",
  [26] = "Sawnoff Shotgun",
  [27] = "Combat Shotgun",
  [28] = "Micro SMG/Uzi",
  [29] = "MP5",
  [30] = "AK-47",
  [31] = "M4",
  [32] = "Tec-9",
  [33] = "Country Rifle",
  [34] = "Sniper Rifle",
  [35] = "RPG",
  [36] = "HS Rocket",
  [37] = "Flamethrower",
  [38] = "Minigun",
  [39] = "Satchel Charge",
  [40] = "Detonator",
  [41] = "Spraycan",
  [42] = "Fire Extinguisher",
  [43] = "Camera",
  [44] = "Night Vis Goggles",
  [45] = "Thermal Goggles",
  [46] = "Parachute" }
  return names[weapon]
end
 

Adrian G.

Известный
Проверенный
521
453
Ку ребят, короче такая дилема.... Нашел скрипт информер об игроке при наведении на него ПКМ
так вот как сделать так что бы инфа отоброжалась не слева от экрана а на игроке:


вот пример до
Посмотреть вложение 118164

а вот так что бы было
Посмотреть вложение 118165


пробывал пару способов но отоброжается криво или просто на игроке, так как сделать так что бы отображалось как на 2 скрине? чуть правее от скина...


Скрипт:
script_name("Player info")
script_version_number(1)
script_version("1.1")
script_author("RollUp")

result = true

function main()
while not isSampAvailable() do wait(200) end
x, y = getScreenResolution()
font = renderCreateFont("Arial", 10, 14)
sampRegisterChatCommand('pinfo', pinfo)
    while true do
        wait(0)
        res, handle = getCharPlayerIsTargeting(playerHandle)
        if res and not isKeyDown(119) and result then
              resid, id = sampGetPlayerIdByCharHandle(handle)
               color = sampGetPlayerColor(id)
               name = sampGetPlayerNickname(id)
               weapon = getCurrentCharWeapon(handle)
               weap = getweaponname(weapon)
               health = sampGetPlayerHealth(id)
              armor = sampGetPlayerArmor(id)
               ping = sampGetPlayerPing(id)
               score = sampGetPlayerScore(id)
              renderFontDrawText(font,string.format("Nickname: %s[%d]\nHealth: %d \nArmor: %d\nScore: %d\nPing: %d\nWeapon: %s", name, id, health, armor, score, ping, weap) ,x/35, y/3, color)
        end
    end
end

function pinfo()
    if result then
        result = false
    elseif not result then
        result = true
    end
end


function getweaponname(weapon)
  local names = {
  [0] = "Fist",
  [1] = "Brass Knuckles",
  [2] = "Golf Club",
  [3] = "Nightstick",
  [4] = "Knife",
  [5] = "Baseball Bat",
  [6] = "Shovel",
  [7] = "Pool Cue",
  [8] = "Katana",
  [9] = "Chainsaw",
  [10] = "Purple Dildo",
  [11] = "Dildo",
  [12] = "Vibrator",
  [13] = "Silver Vibrator",
  [14] = "Flowers",
  [15] = "Cane",
  [16] = "Grenade",
  [17] = "Tear Gas",
  [18] = "Molotov Cocktail",
  [22] = "9mm",
  [23] = "Silenced 9mm",
  [24] = "Desert Eagle",
  [25] = "Shotgun",
  [26] = "Sawnoff Shotgun",
  [27] = "Combat Shotgun",
  [28] = "Micro SMG/Uzi",
  [29] = "MP5",
  [30] = "AK-47",
  [31] = "M4",
  [32] = "Tec-9",
  [33] = "Country Rifle",
  [34] = "Sniper Rifle",
  [35] = "RPG",
  [36] = "HS Rocket",
  [37] = "Flamethrower",
  [38] = "Minigun",
  [39] = "Satchel Charge",
  [40] = "Detonator",
  [41] = "Spraycan",
  [42] = "Fire Extinguisher",
  [43] = "Camera",
  [44] = "Night Vis Goggles",
  [45] = "Thermal Goggles",
  [46] = "Parachute" }
  return names[weapon]
end
Получаешь координаты того, кто под прицелом, потом с помощью функции convert3DCoordsToScreen переводишь игровые координаты в экранные, вставляешь эти координаты в рендер и к X-координате прибавляешь какое-то число, для отступа вправо.
 

Shishkin

Известный
491
250
Ку ребят, короче такая дилема.... Нашел скрипт информер об игроке при наведении на него ПКМ
так вот как сделать так что бы инфа отоброжалась не слева от экрана а на игроке:


вот пример до
Посмотреть вложение 118164

а вот так что бы было
Посмотреть вложение 118165


пробывал пару способов но отоброжается криво или просто на игроке, так как сделать так что бы отображалось как на 2 скрине? чуть правее от скина...


Скрипт:
script_name("Player info")
script_version_number(1)
script_version("1.1")
script_author("RollUp")

result = true

function main()
while not isSampAvailable() do wait(200) end
x, y = getScreenResolution()
font = renderCreateFont("Arial", 10, 14)
sampRegisterChatCommand('pinfo', pinfo)
    while true do
        wait(0)
        res, handle = getCharPlayerIsTargeting(playerHandle)
        if res and not isKeyDown(119) and result then
              resid, id = sampGetPlayerIdByCharHandle(handle)
               color = sampGetPlayerColor(id)
               name = sampGetPlayerNickname(id)
               weapon = getCurrentCharWeapon(handle)
               weap = getweaponname(weapon)
               health = sampGetPlayerHealth(id)
              armor = sampGetPlayerArmor(id)
               ping = sampGetPlayerPing(id)
               score = sampGetPlayerScore(id)
              renderFontDrawText(font,string.format("Nickname: %s[%d]\nHealth: %d \nArmor: %d\nScore: %d\nPing: %d\nWeapon: %s", name, id, health, armor, score, ping, weap) ,x/35, y/3, color)
        end
    end
end

function pinfo()
    if result then
        result = false
    elseif not result then
        result = true
    end
end


function getweaponname(weapon)
  local names = {
  [0] = "Fist",
  [1] = "Brass Knuckles",
  [2] = "Golf Club",
  [3] = "Nightstick",
  [4] = "Knife",
  [5] = "Baseball Bat",
  [6] = "Shovel",
  [7] = "Pool Cue",
  [8] = "Katana",
  [9] = "Chainsaw",
  [10] = "Purple Dildo",
  [11] = "Dildo",
  [12] = "Vibrator",
  [13] = "Silver Vibrator",
  [14] = "Flowers",
  [15] = "Cane",
  [16] = "Grenade",
  [17] = "Tear Gas",
  [18] = "Molotov Cocktail",
  [22] = "9mm",
  [23] = "Silenced 9mm",
  [24] = "Desert Eagle",
  [25] = "Shotgun",
  [26] = "Sawnoff Shotgun",
  [27] = "Combat Shotgun",
  [28] = "Micro SMG/Uzi",
  [29] = "MP5",
  [30] = "AK-47",
  [31] = "M4",
  [32] = "Tec-9",
  [33] = "Country Rifle",
  [34] = "Sniper Rifle",
  [35] = "RPG",
  [36] = "HS Rocket",
  [37] = "Flamethrower",
  [38] = "Minigun",
  [39] = "Satchel Charge",
  [40] = "Detonator",
  [41] = "Spraycan",
  [42] = "Fire Extinguisher",
  [43] = "Camera",
  [44] = "Night Vis Goggles",
  [45] = "Thermal Goggles",
  [46] = "Parachute" }
  return names[weapon]
end
int playerId Крепление к игроку по ид (-1 --- отключить)
int vehicleId Крепление к т/с по ид (-1 --- отключить)