Editable Files

client/editable.lua

RegisterCommand("getgroundhash", function()
    print(GetGroundHash(GetEntityCoords(PlayerPedId())))
end)

server/editable.lua

RegisterNetEvent('tgiann-planting:collectPlant')
AddEventHandler('tgiann-planting:collectPlant', function(name)
    local src = source
    local oldValue = GlobalState.tgiannPlants
    if not oldValue[name] or oldValue[name].growing ~= 100 then
        return
    end
    local xPlayer = tgiCore.getPlayer(src)
    if not xPlayer then 
        return 
    end
    local itemData = oldValue[name].plantData.giveItem
    if tgiCore.addItem(xPlayer, itemData.name, itemData.amount) then
        oldValue[name] = nil
        TriggerClientEvent("tgiann-planting:client:removePlant", -1, name)
    end
    GlobalState.tgiannPlants = oldValue
end)

Last updated