Franc1sco

Untitled

Jul 20th, 2020
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. char g_sIp[32];
  2. int g_iPort;
  3.  
  4. public Action Timer_CallSingleFunction(Handle timer, DataPack data)
  5. {
  6. data.Reset();
  7. Call_StartFunction(INVALID_HANDLE, data.ReadFunction());
  8. Call_Finish();
  9. delete data;
  10. }
  11.  
  12. void GetIp()
  13. {
  14. PrintToServer("Attempt to get public IP...");
  15. int ipaddress[4];
  16. SteamWorks_GetPublicIP(ipaddress);
  17. if (!ipaddress[0] && !ipaddress[1] && !ipaddress[2] && !ipaddress[3])
  18. {
  19. DataPack data = new DataPack(); data.WriteFunction(GetIp);
  20. CreateTimer(1.0, Timer_CallSingleFunction, data);
  21. return;
  22. }
  23.  
  24. Format(g_sIp, 32, "%d.%d.%d.%d", ipaddress[0], ipaddress[1], ipaddress[2], ipaddress[3]);
  25. g_iPort = GetConVarInt(FindConVar("hostport"));
  26. PrintToServer("Debug -> Hey what up! I found the public IP %s:d!", g_sIp, g_iPort);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment