That's because you've copied the whole function syntax, which is wrong. 
 
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        banPlayer ( source, true, true, true, nil, "Sorry, You have died, To make the game fun, any player that dies gets banned for 5 minutes :)", 300 ) 
    end 
)