Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script_name('hBAR')
- script_author('hnnssy and Laine_prikol')
- require("config.hbarcfg")
- local memory = require "memory"
- local weapons = {
- FIST = 0,
- BRASSKNUCKLES = 1,
- GOLFCLUB = 2,
- NIGHTSTICK = 3,
- KNIFE = 4,
- BASEBALLBAT = 5,
- SHOVEL = 6,
- POOLCUE = 7,
- KATANA = 8,
- CHAINSAW = 9,
- PURPLEDILDO = 10,
- WHITEDILDO = 11,
- WHITEVIBRATOR = 12,
- SILVERVIBRATOR = 13,
- FLOWERS = 14,
- CANE = 15,
- GRENADE = 16,
- TEARGAS = 17,
- MOLOTOV = 18,
- COLT45 = 22,
- SILENCED = 23,
- DESERTEAGLE = 24,
- SHOTGUN = 25,
- SAWNOFFSHOTGUN = 26,
- COMBATSHOTGUN = 27,
- UZI = 28,
- MP5 = 29,
- AK47 = 30,
- M4 = 31,
- TEC9 = 32,
- RIFLE = 33,
- SNIPERRIFLE = 34,
- ROCKETLAUNCHER = 35,
- HEATSEEKER = 36,
- FLAMETHROWER = 37,
- MINIGUN = 38,
- SATCHELCHARGE = 39,
- DETONATOR = 40,
- SPRAYCAN = 41,
- FIREEXTINGUISHER = 42,
- CAMERA = 43,
- NIGHTVISION = 44,
- THERMALVISION = 45,
- PARACHUTE = 46
- }
- local id = weapons
- weapons.names = {
- [id.FIST] = 'Fist',
- [id.BRASSKNUCKLES] = 'Brass Knuckles',
- [id.GOLFCLUB] = 'Golf Club',
- [id.NIGHTSTICK] = 'Nightstick',
- [id.KNIFE] = 'Knife',
- [id.BASEBALLBAT] = 'Baseball Bat',
- [id.SHOVEL] = 'Shovel',
- [id.POOLCUE] = 'Pool Cue',
- [id.KATANA] = 'Katana',
- [id.CHAINSAW] = 'Chainsaw',
- [id.PURPLEDILDO] = 'Purple Dildo',
- [id.WHITEDILDO] = 'Dildo',
- [id.WHITEVIBRATOR] = 'Vibrator',
- [id.SILVERVIBRATOR] = 'Silver Vibrator',
- [id.FLOWERS] = 'Flowers',
- [id.CANE] = 'Cane',
- [id.GRENADE] = 'Grenade',
- [id.TEARGAS] = 'Tear Gas',
- [id.MOLOTOV] = 'Molotov Cocktail',
- [id.COLT45] = '9mm',
- [id.SILENCED] = 'Silenced 9mm',
- [id.DESERTEAGLE] = 'Desert Eagle',
- [id.SHOTGUN] = 'Shotgun',
- [id.SAWNOFFSHOTGUN] = 'Sawnoff Shotgun',
- [id.COMBATSHOTGUN] = 'Combat Shotgun',
- [id.UZI] = 'Micro Uzi',
- [id.MP5] = 'MP5',
- [id.AK47] = 'AK-47',
- [id.M4] = 'M4',
- [id.TEC9] = 'Tec-9',
- [id.RIFLE] = 'Country Rifle',
- [id.SNIPERRIFLE] = 'Sniper Rifle',
- [id.ROCKETLAUNCHER] = 'RPG',
- [id.HEATSEEKER] = 'HS Rocket',
- [id.FLAMETHROWER] = 'Flamethrower',
- [id.MINIGUN] = 'Minigun',
- [id.SATCHELCHARGE] = 'Satchel Charge',
- [id.DETONATOR] = 'Detonator',
- [id.SPRAYCAN] = 'Spraycan',
- [id.FIREEXTINGUISHER] = 'Fire Extinguisher',
- [id.CAMERA] = 'Camera',
- [id.NIGHTVISION] = 'Night Vis Goggles',
- [id.THERMALVISION] = 'Thermal Goggles',
- [id.PARACHUTE] = 'Parachute'
- }
- function getAmmoInClip()
- local struct = getCharPointer(playerPed)
- local prisv = struct + 0x0718
- local prisv = memory.getint8(prisv, false)
- local prisv = prisv * 0x1C
- local prisv2 = struct + 0x5A0
- local prisv2 = prisv2 + prisv
- local prisv2 = prisv2 + 0x8
- local ammo = memory.getint32(prisv2, false)
- return ammo
- end
- --- Config
- istate = true
- --- Main
- function main()
- while not isSampAvailable() do wait(1000) end
- initialize()
- while true do
- wait(0)
- if isPlayerPlaying(playerHandle) and istate then
- local posX, posY = getScreenResolution()
- if not isCharInAnyCar(playerPed) then
- drawOnfootBar()
- else
- drawInCarBar()
- end
- end
- end
- end
- function initialize()
- displayHud(false)
- ifont = renderCreateFont(cfg_font_name, 12, cfg_flags)
- fontWeapon = renderCreateFont(cfg_font_name, 9, cfg_flags)
- fontOther = renderCreateFont(cfg_font_name, 8, cfg_flags)
- end
- function drawOnfootBar()
- local playerID, playerName, playerPing, playerHP, playerAP, playerLvl, playerMoney,
- playerWeapon, playerAmmo, playerInterior = getPlayerOnFootInfo()
- local playerposX, playerposY, playerposZ = getCharCoordinates(playerPed)
- local clips = getAmmoInClip()
- local havewant, wantlevel = storeWantedLevel(playerPed)
- local text = string.format("HP: %d | Armor %d", playerHP, playerAP)
- if havewant == true then
- local textMoney = string.format("$%d | Wanted: %d", playerMoney, wantlevel)
- else
- local textMoney = string.format("$%d", playerMoney)
- end
- local textWeapon = string.format("Weapon: %s %d/%d", weapons.names[playerWeapon],clips, playerAmmo)
- local textInfo = string.format("ID: %d | Ping: %d | Score: %d", playerID, playerPing,playerLvl)
- local screenW, screenH = getScreenResolution()
- local fontlen = renderGetFontDrawTextLength(ifont, text)
- local posX = math.ceil((screenW / 2) - (fontlen / 2))
- renderFontDrawText(ifont, text, posX + 460, screenH - 870, cfg_text_color)
- renderFontDrawText(ifont, textMoney, posX + 460, screenH - 850, cfg_text_color)
- renderFontDrawText(fontWeapon, textWeapon, posX + 460, screenH - 830, cfg_text_color)
- renderFontDrawText(fontOther, textInfo, posX + 460, screenH - 810, cfg_text_color)
- end
- function drawInCarBar()
- local playerID, playerName, playerPing, playerHP, playerAP, playerLvl, playerMoney,
- playerWeapon, playerAmmo, vehHP, vehID = getPlayerInCarInfo()
- local playerposX, playerposY, playerposZ = getCharCoordinates(playerPed)
- local havewant, wantlevel = storeWantedLevel(playerPed)
- local clips = getAmmoInClip()
- local text = string.format("HP/Veh: %d/%d | Armor %d", playerHP, vehHP, playerAP)
- local textMoney = string.format("$%d", playerMoney)
- local textWeapon = string.format("Weapon: %s %d/%d", weapons.names[playerWeapon],clips, playerAmmo)
- local textInfo = string.format("ID: %d | Ping: %d | Score: %d | Wanted: %d", playerID, playerPing,playerLvl,wantlevel)
- local screenW, screenH = getScreenResolution()
- local fontlen = renderGetFontDrawTextLength(ifont, text)
- local posX = math.ceil((screenW / 2) - (fontlen / 2))
- renderFontDrawText(ifont, text, posX + 460, screenH - 870, cfg_text_color)
- renderFontDrawText(ifont, textMoney, posX + 460, screenH - 850, cfg_text_color)
- renderFontDrawText(fontWeapon, textWeapon, posX + 460, screenH - 830, cfg_text_color)
- renderFontDrawText(fontOther, textInfo, posX + 460, screenH - 810, cfg_text_color)
- end
- --- Functions
- function getPlayerOnFootInfo()
- local _, playerID = sampGetPlayerIdByCharHandle(playerPed)
- local playerHP = getCharHealth(playerPed)
- local playerWeapon = getCurrentCharWeapon(playerPed)
- return playerID,
- sampGetPlayerNickname(playerID),
- sampGetPlayerPing(playerID),
- playerHP,
- getCharArmour(playerPed),
- sampGetPlayerScore(playerID),
- getPlayerMoney(playerHandle),
- playerWeapon,
- getAmmoInCharWeapon(playerPed, playerWeapon),
- getActiveInterior()
- end
- function getPlayerInCarInfo()
- local _, playerID = sampGetPlayerIdByCharHandle(playerPed)
- local playerHP = getCharHealth(playerPed)
- local playerWeapon = getCurrentCharWeapon(playerPed)
- local playerCar = storeCarCharIsInNoSave(playerPed)
- local _, vehId = sampGetVehicleIdByCarHandle(playerCar)
- return playerID,
- sampGetPlayerNickname(playerID),
- sampGetPlayerPing(playerID),
- playerHP,
- getCharArmour(playerPed),
- sampGetPlayerScore(playerID),
- getPlayerMoney(playerHandle),
- playerWeapon,
- getAmmoInCharWeapon(playerPed, playerWeapon),
- getCarHealth(playerCar),
- vehId
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement