esx-community / esx_thief

FXServer ESX Thief
GNU General Public License v3.0
32 stars 22 forks source link

Support for esx 1.2 #32

Open toddy617 opened 4 years ago

toddy617 commented 4 years ago

maybe someone can add support for esx 1.2 many thanks

giannistsitsis97 commented 3 years ago

i am looking for this too ..

BartukyGames commented 3 years ago

Replace in esx_thief/main/server.lua: For Steal ITEMS: Lines 35 to 53 Last Code: l local label = sourceXPlayer.getInventoryItem(itemName).label local itemLimit = sourceXPlayer.getInventoryItem(itemName).limit local sourceItemCount = sourceXPlayer.getInventoryItem(itemName).count local targetItemCount = targetXPlayer.getInventoryItem(itemName).count

if amount > 0 and targetItemCount >= amount then
    if itemLimit ~= -1 and (sourceItemCount + amount) > itemLimit then
        TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('ex_inv_lim_target'))
        TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('ex_inv_lim_source'))
    else
        targetXPlayer.removeInventoryItem(itemName, amount)
        sourceXPlayer.addInventoryItem(itemName, amount)

        TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' ~g~x' .. amount .. ' ' .. label .. ' ~w~' .. _U('from_your_target') )
        TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' ~r~x'  .. amount .. ' ' .. label )
    end
else
    TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
end

New Code:

local label = sourceXPlayer.getInventoryItem(itemName).label

if amount > 0 then
    if sourceXPlayer.canCarryItem(itemName, amount) then
        targetXPlayer.removeInventoryItem(itemName, amount)
        sourceXPlayer.addInventoryItem(itemName, amount)
        TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' ~g~x' .. amount .. ' ' .. label .. ' ~w~' .. _U('from_your_target') )
        TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' ~r~x'  .. amount .. ' ' .. label )
    else 
        sourceXPlayer.showNotification("No puedes con tanto peso", sourceXPlayer.name)
    end
else
    TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
end
BartukyGames commented 3 years ago

Replace in esx_thief/main/server.lua: For MONEY: Lines 56 to 66 Last Code:

if amount > 0 and targetXPlayer.get('money') >= amount then
    targetXPlayer.removeMoney(amount)
    sourceXPlayer.addMoney(amount)

    TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' ~g~$' .. amount .. ' ~w~' .. _U('from_your_target') )
    TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' ~r~$'  .. amount )
else
    TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount'))
end

New Code: if amount > 0 and targetXPlayer.getAccount("money").money >= amount then targetXPlayer.removeMoney(amount) sourceXPlayer.addMoney(amount) TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' g$' .. amount .. ' w' .. _U('from_your_target') ) TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' r$' .. amount ) else TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) end