it seems like you've missed one "end"
every if, for, while and there sub-statements must be closed with end, just like IIYAMA said, Here is the code with the missing end, you just compare it and you will know which one you've missed.
function eventDeath(killer)
local killed = getPlayerName (source)
if ( killer ) then
local killerPerson = getPlayerName (killer)
if ( getElementData(killer,"Prison") == true ) or ( getElementData(source,"Prison") == true ) then
for index,player in ipairs (getElementsByType("player")) do
if ( getElementData(player,"Police") == true ) or ( getElementData(player,"AdminRank") >= 5 ) then
outputChatBox(""..killerPerson.." Killed "..killed.." while he/she was in jail! ",player,255,255,255,true)
end
end
end
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), eventDeath )