Advertisement
Guest User

Untitled

a guest
Aug 15th, 2011
548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.05 KB | None | 0 0
  1. #include <a_samp>
  2. #include <a_http>
  3.  
  4. #define HostURL "yu-ki-ko.com/fsns/Host.php?IP=" // Leave it like this if you ain't hosting the php file
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.     print("GetPlayerHost by [L3th4l] loaded.");
  9.     return 1;
  10. }
  11.  
  12. public OnFilterScriptExit()
  13. {
  14.     print("GetPlayerHost by [L3th4l] unloaded.");
  15.     return 1;
  16. }
  17.  
  18. public OnPlayerConnect(playerid)
  19. {
  20.     new
  21.         pIP[16];
  22.  
  23.     GetPlayerIp(playerid, pIP, sizeof(pIP));
  24.  
  25.     new
  26.         iStr[150];
  27.  
  28.     format(iStr, sizeof(iStr), ""HostURL"%s", pIP);
  29.  
  30.     HTTP(playerid, HTTP_GET, iStr, "", "OnHostResponse");
  31.     return 1;
  32. }
  33.  
  34. forward OnHostResponse(iIndex, response_code, const Data[]);
  35. public OnHostResponse(iIndex, response_code, const Data[])
  36. {
  37.     new
  38.         szBuffer[128];
  39.  
  40.     if(response_code == 200)
  41.     {
  42.         format(szBuffer, sizeof(szBuffer), "Your host is {7EB339}%s", Data);
  43.         SendClientMessage(iIndex, -1, szBuffer);
  44.     }
  45.     else
  46.     {
  47.         format(szBuffer, sizeof(szBuffer), "Can't send your request. {C21F1F}Response_Code: %i", response_code);
  48.         SendClientMessage(iIndex, -1, szBuffer);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement