Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char g_sIp[32];
- int g_iPort;
- public Action Timer_CallSingleFunction(Handle timer, DataPack data)
- {
- data.Reset();
- Call_StartFunction(INVALID_HANDLE, data.ReadFunction());
- Call_Finish();
- delete data;
- }
- void GetIp()
- {
- PrintToServer("Attempt to get public IP...");
- int ipaddress[4];
- SteamWorks_GetPublicIP(ipaddress);
- if (!ipaddress[0] && !ipaddress[1] && !ipaddress[2] && !ipaddress[3])
- {
- DataPack data = new DataPack(); data.WriteFunction(GetIp);
- CreateTimer(1.0, Timer_CallSingleFunction, data);
- return;
- }
- Format(g_sIp, 32, "%d.%d.%d.%d", ipaddress[0], ipaddress[1], ipaddress[2], ipaddress[3]);
- g_iPort = GetConVarInt(FindConVar("hostport"));
- PrintToServer("Debug -> Hey what up! I found the public IP %s:d!", g_sIp, g_iPort);
- }
Advertisement
Add Comment
Please, Sign In to add comment