You need to read the entire story in Numbers 22 to get a complete idea of the situation. Balaam was in the first instance forbidden to go. That answer should have been sufficient for Balaam, but when the princes came with alluring offers of gifts and office and honors, he bade them remain to see whether there might be any fresh instructions. He obviously hoped that permission would be given. He showed his ignorance of God's ways in supposing that Barak's gifts and promises could make any difference to God's decision. His answers to the men also showed that he would like to comply if God would let him. Probably, too, God read in his mind an intention to pronounce the curse for which Barak was willing to pay. Hence the warning by the way, which would brace up his wavering resolution to utter the word of the Lord even if it was disagreeable to Barak.