The South Australian government is giving farmers and their communities $18 million in grants and other programs in a bid to guard against the effects of drought.