Try those steps one step at time.
1-Open cmd and type ipconfig /flushdns.
2-Clear your Fivem game cache.
3-Update your gta from steam or epic games.
4-Make sure your pc date and time is matching your irl date and time.
5-Reinstall fivem.
6-Try plant vpn, its a free vpn.
7-Restart your wifi device completely which means unplug it for 1M and plug it back in.
8-Reach to your internet provider asking them to put you on google dns.
9-Reinstall windows 10 which fix it in most cases.