ElNelyo / esx_discord_bot

Discord alert for esx server
GNU General Public License v3.0
26 stars 20 forks source link

Add more possibilities #2

Open delduwaht opened 6 years ago

delduwaht commented 6 years ago
Ivannnmmn commented 5 years ago

@LuaDeldu Can you tell me all the places you added in esx_extended? please

-- Add event when a player drop an item -- TriggerEvent("esx:dropitemalert",xPlayer.name,foundItem.label,total) -> ESX_extended

delduwaht commented 5 years ago

TriggerEvent("esx:dropitemalert",xPlayer.name,foundItem.label,total) -- HERE

For example in es_extended/server/main.lua :

RegisterServerEvent('esx:removeInventoryItem')
AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount)

  local _source = source

  if type == 'item_standard' then

    if itemCount == nil or itemCount <= 0 then
      TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_quantity'))
    else

      local xPlayer   = ESX.GetPlayerFromId(source)
      local foundItem = nil

      for i=1, #xPlayer.inventory, 1 do
        if xPlayer.inventory[i].name == itemName then
          foundItem = xPlayer.inventory[i]
        end
      end

      if itemCount > foundItem.count then
        TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_quantity'))
      else

        TriggerClientEvent('esx:showNotification', _source, _U('delete_five_min', foundItem.label))

        SetTimeout(Config.RemoveInventoryItemDelay, function()

          local remainingCount = xPlayer.getInventoryItem(itemName).count
          local total          = itemCount

          if remainingCount < itemCount then
            total = remainingCount
          end

          if total > 0 then
            xPlayer.removeInventoryItem(itemName, total)
            ESX.CreatePickup('item_standard', itemName, total, foundItem.label .. ' [' .. itemCount .. ']', _source)
            TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' ' .. foundItem.label .. ' x' .. total)
            ----------
            TriggerEvent("esx:dropitemalert",xPlayer.name,foundItem.label,total) -- HERE
            ----------
          end

        end)

      end
Ivannnmmn commented 5 years ago

@LuaDeldu Thank you, but your pull request seems to be different from the current esx_extended version. If you have time to update this, it would be great. Thank you again for your help.

delduwaht commented 5 years ago

Just adapt it to the new es_extended script :) Of course this one is outdated, as the PR come from January 2018

pouggis commented 5 years ago

@LuaDeldu I have seen it again, I probably got it.

pouggis commented 5 years ago

@LuaDeldu Excuse me, can you tell me how to add it to ES_extended?

Chxttr commented 4 years ago

@LuaDeldu You forget to add the MySQL to the __resourece.lua for the Twitter logs

SAKIBGAMETUBE commented 4 years ago

How to add this

Chxttr commented 4 years ago

Just add this under the client and server __resource.lua

'@mysql-async/lib/MySQL.lua'