Try this... It's the only way I can think of to shorten it.
Code:
function CanInvite()
return (GetNumRaidMembers() > 1 and IsRaidLeader()) or (GetNumPartyMembers() > 0 and IsPartyLeader()) or (GetNumPartyMembers() <= 0 and GetNumRaidMembers() <= 1);
end
What this does is turn all of the conditions into a single boolean comparison statement. If any of the conditions are true, it'll return so, else it'll be false.
Note: I corrected a couple things, mainly GetNumRaidMembers() does include the player as well, so you need to check if this is greater than 1, not 0.
Edit: Also to note the last condition checking if not in a party or raid has been corrected as well.