Why are you doing local jailed = FreezeEntityPosition. Then you’re doing jailed = true. I know Lua doesn’t have types like other languages but, this is just taking the mick 
Anyways, the native you’re trying to use doesn’t have a return type so, you don’t need to do jailed = freezeEntityPosition. See here.
As other have said, you should not be trying to call the client function from the server code unless it’s through an event. So, let’s see if we can make this a bit cleaner. Let’s assume you’re using a command to jail someone, you would need to first get the closest player to jail from the cop. So, you could do something like this on the server (when the command is executed).
Note: this is pseudocode and won’t work out-of-the-box.
On command do {
TriggerClientEvent("jail:jailClosestPlayer", source)
}
Then, on the client you would have to register and handle the event. In the handler you could either write the logic inside it or, you could call your jail function.
RegisterNetEvent("jail:jailClosestPlayer")
AddEventHandler("jail:jailClosestPlayer", function()
JailClosest()
end)
-- or
RegisterNetEvent("jail:jailClosestPlayer")
AddEventHandler("jail:jailClosestPlayer", function()
t, distance = GetClosestPlayer()
if(distance ~= -1 and distance < 3) then
TriggerServerEvent("jail:jailPlayer", GetPlayerServerId(t)) -- send server Id to freeze
end
end)
Then you would have to handle that event on the server, probably triggering yet another client event (i don’t know if its possible but, you might be able to do TriggerClientEvent("event", GetPlayerServerId(t)) but, I’m not too sure). Looking something like
On event "jail:jailPlayer" (int target) {
TriggerClientEvent("jail:jailPlayerClient", target)
}
The your final event would handle freezing the player and doing other stuff. E.g.
local isInJail = false; -- is player in jail?
On event "jail:jailPlayerClient"{
isInJail = not isInJail
FreezeEntityPosition(GetPlayerPed(-1), isInJail)
}
Phew. That was a lot of text
. I’m on phone so, code won’t be good and there will almost certainly be typos.