Giter Site home page Giter Site logo

nbk_blips's Introduction

Credits: Negbook

installtion : server.cfg

start nbk_blips 

exports :

exports.nbk_blips:GetBlips() 
exports.nbk_blips:GetClosestBlip()
exports.nbk_blips:GetClosestBlip(ped)
exports.nbk_blips:GetClosestBlipByCoords(coords)
exports.nbk_blips:GetOnScreenBlips()
exports.nbk_blips:GetOnScreenClosestBlip()
exports.nbk_blips:GetOnScreenClosestBlipByCoords(coords)
exports.nbk_blips:GetBlipsBySprite(spriteid)
exports.nbk_blips:GetClosestBlipBySprite(spriteid)
exports.nbk_blips:GetClosestBlipBySprite(spriteid,ped)
exports.nbk_blips:GetOnScreenBlipsBySprite(spriteid)
exports.nbk_blips:GetOnScreenClosestBlipBySprite(spriteid)
exports.nbk_blips:GetOnScreenClosestBlipBySpriteByCoords(spriteid,coords)
exports.nbk_blips:RegisterHook_ClosestBlipBySprite(spriteid)
exports.nbk_blips:RequestClosestBlipBySpriteUpdate(spriteid,cbfunc(blip,spriteid))
exports.nbk_blips:RequestOnScreenClosestBlipBySpriteUpdate(spriteid,cbfunc(blip,spriteid,isonscreen))

triggering events :

OnBlipOnScreen(spriteid,blipid,blipcoords)
OnBlipFirstOnScreen(spriteid,blipid,blipcoords)
OnBlipOutScreen(spriteid,blipid,blipcoords)

triggering events(after RegisterHook_ClosestBlipBySprite(spriteid)) :

OnClosestBlipBySpriteUpdate(newclosestblipid,oldclosestblipid) 
OnOnScreenClosestBlipBySpriteUpdate(newclosestblipid,oldclosestblipid) 

example :

Citizen.CreateThread(function()
    while true do 
        local blips = exports.nbk_blips:GetClosestBlipBySprite(277)
        local coords = GetBlipCoords(blips) 
        print("The Closest ATM Blips:"..blips.." x:".. coords.x  .. "y:"..coords.y  .."z:"..coords.z )
        Citizen.Wait(330)
    end 
end)

example2:

CurrentBlip = nil 

Citizen.CreateThread(function()
    while true do 
        local blip = exports.nbk_blips:GetOnScreenClosestBlipBySprite(434)
        local coords = GetBlipCoords(blip) 
        local x = coords.x 
        local y = coords.y 
        local z = coords.z 
        CurrentBlip = {x=x,y=y,z=z}
        TriggerEvent('localmessage',"The OnScreen Closest ATM Blips:"..blip.."x:".. x .. "y:"..y .."z:"..z)
        Citizen.Wait(330)
    end 
end)

Citizen.CreateThread(function()
    while true do 
        if CurrentBlip then 
        DrawMarker(1, CurrentBlip.x, CurrentBlip.y, CurrentBlip.z-1.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.0, 1.0, 1.0, 0, 0, 255, 100, false, false, 2, true--[[旋轉]], false--[[dict]], false--[[txd]], false)
        end 
        Citizen.Wait(0)
    end 
end )

example3:

Citizen.CreateThread(function() 
    --get closest street nearby closest blip of random position
    local x = GetRandomFloatInRange(-2000.0,2000.0) 
    local y = GetRandomFloatInRange(-2000.0,2000.0) 
    local z = GetRandomFloatInRange(-2000.0,2000.0) 
    local blip = exports.nbk_blips:GetClosestBlipByCoords(vector3(x,y,z))
    if DoesBlipExist(blip) then 
        local fincoords = GetBlipCoords(blip)
        local _, target = GetNthClosestVehicleNodeWithHeading(fincoords.x, fincoords.y, fincoords.z, math.random(5, 10), 0, 0, 0)
        local tarX, tarY, tarZ, tarH = table.unpack(target)
        local bool, street1, street2 = GetClosestRoad(tarX, tarY, tarZ, 1.0, 1, false)
        if bool then 
            print(street1, street2)
        end 
    end 
end)

Github: nbk_blips

nbk_blips's People

Contributors

negbook avatar malagebe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.