Jump to content
Fivem-DEV.cz
Sign in to follow this  
BzZz

[WEBHOOK ] Log zbraní z frakčního skladu

Recommended Posts

VÝBĚR ZBRANÍ

  1. Otevřete si esx_policejob/server/main.lua
  2. Vyhledejte si event: ESX.RegisterServerCallback('esx_policejob:removeArmoryWeapon'
  3. Hned pod tímto řádkem naleznete tuto část: 
    local xPlayer = ESX.GetPlayerFromId(source)
    xPlayer.addWeapon(weaponName, 500)
  4. Vložte mezi tyto dva řádky kód s webhookem. Nezapomeňte změnit odkaz na váš discord. Kód poté bude vypadat následovně: 
    local xPlayer = ESX.GetPlayerFromId(source)
        local connect = {
                    {
                        ["color"] = "16718105",
                        ["title"] = GetPlayerName(source).." (".. xPlayer.identifier ..")",
                        ["description"] = "📤 Vybral zbraň: **"..weaponName.."** z policejního skladu.",
                        ["footer"] = {
                        ["text"] = os.date('%H:%M - %d. %m. %Y', os.time()),
                        ["icon_url"] = "https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/271/honeybee_1f41d.png",
                        },
                    }
                }
    
    PerformHttpRequest("https://discord.com/api/webhooks/729100729960112345/RL6MlpbFkKSIVeOM1w_FCvKlc2ivPboPAmjSvDzE5UKYh5hl5nzAMHwfr1Q0RE12345", function(err, text, headers) end, 'POST', json.encode({username = "Policie - Zbrojnice - Logger", embeds = connect}), { ['Content-Type'] = 'application/json' })
    
    xPlayer.addWeapon(weaponName, 500)

    _______________________________________________________________________________________________________

ULOŽENÍ ZBRANĚ

  1. Otevřete si např. esx_policejob/server/main.lua
  2. Vyhledejte si event: ESX.RegisterServerCallback('esx_policejob:addArmoryWeapon'
  3. Hned pod tímto řádkem naleznete tuto část:
    local xPlayer = ESX.GetPlayerFromId(source)
    
        if removeWeapon then
            xPlayer.removeWeapon(weaponName)
        end

     

  4. Vložte mezi řádek if removeWeapon then a xPlayer.removeWeapon(weaponName) kód s webhookem. Nezapomeňte změnit odkaz na váš discord. Kód poté bude vypadat následovně:
    local xPlayer = ESX.GetPlayerFromId(source)
            if removeWeapon then
          local connect = {
                    {
                        ["color"] = "628480",
                        ["title"] = GetPlayerName(source).." (".. xPlayer.identifier ..")",
                        ["description"] = "📥 Vložil zbraň: **"..weaponName.."** do policejního skladu.",
                        ["footer"] = {
                        ["text"] = os.date('%H:%M - %d. %m. %Y', os.time()),
                        ["icon_url"] = "https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/271/honeybee_1f41d.png",
                        },
                    }
                }
            PerformHttpRequest("https://discord.com/api/webhooks/729100729960112345/RL6MlpbFkKSIVeOM1w_FCvKlc2ivPboPAmjSvDzE5UKYh5hl5nzAMHwfr1Q0RE12345", function(err, text, headers) end, 'POST', json.encode({username = "Policie - Zbrojnice - Logger", embeds = connect}), { ['Content-Type'] = 'application/json' })
            
    xPlayer.removeWeapon(weaponName)
    end

     

 

Edited by BzZz
  • Like 5
  • Vážně ? řekni nám ještě otom víc. 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

Our partners

rcore.cz
K4mb1
SLTH
×
×
  • Create New...