this code is wrong, it will work if you change it to below code
local total_officers = 0
local all_players = getElementsByType("player")
for num,this_player in ipairs(all_players) do
if getElementData(this_player,"Officer") then
total_officers = total_officers + 1
end
end
dxDrawText(total_officers, x*696, y*230, x*913, y*268, tocolor(240, 240, 240, 200), 0.90, fonte, "center", "center", false, true, true, false, false)