Give License with ESX_License

Still new to coding and just testing what I’m capable of. I’m trying to register a new command for lawyers to grant and revoke licenses for other players but I’m getting an error that I’m not seeing even existing.

Client error:

Server error:
ServerError

Client code:

Server code:

Any help would be appreciated!

People, please post screenshots with the side bar with number of lines and post actual code. Anyway,
I see that you have some experience with Python, in Python everything works with enough space and no keywords with ending some functions. In lua you need to start with keyword and end it with end

function CommandaddLicense()
        if ESX.PlayerData.job.name == 'doj' and ESX.PlayerData.job.name == 5 then
                local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
                if closestPlayer ~= nil and closestDistance <= 1.00 then
                        TriggerServerEvent('serp_addWeaponLicense', GetPlayerFromId(closestPlayer))
                else
                        --notification
                end
        end
end

You don’t end you if statement and it throws out an error. Use these white lines that Notepad++ shows to guide you where you should place end’s. In some time you won’t need them.

I appreciate that and sorry for not including the line numbers but when I try to space out the end’s server side I have no luck. Still getting the same error.

ServerError

I’ve fixed client-side of code, server-side is here:

    if xPlayer.job.name == 'doj' and xPlayer.job.grade == '5' then
        TriggerEvent('esx_license:addLicense', target, 'weapon', function()
            --client notification
        end)
    else
        --Client notification
    end

You didn’t have last end that ended your if statement. You should work on spacing a little bit more. It helps, especially for people like you that aren’t advanced yet.

hey man i have just released a working version of this here

givelicense

cant get it to work