27.06.2012, 20:54
You don't need a plugin to get a players DNS. All you need is some knowledge of PHP, and you must know the basics of using the HTTP function. This is actually extremely easy, lets get this tutorial.
.php File
You are going to need a domain, and a webhost first (that supports PHP of course), and make a page called dnslookup.php on your site). Add this code into it:
Here's how you would handle this later, in your script:
yoursitehere.com/dnslookup.php?ip=2.3.4.5
Pawn Code
Now this is where your server handles this - whether its a command ingame, IRC, or whatever, you can edit this later:
HTTP OnDnsLookup:
Again, this is very simple. You don't need much PHP knowledge, and there is not too much code on it.
The command is coded with zcmd. Any questions, ask below.
Enjoy, i know this will help many people.
.php File
You are going to need a domain, and a webhost first (that supports PHP of course), and make a page called dnslookup.php on your site). Add this code into it:
Код:
<?php $hostname = gethostbyaddr($_GET["ip"]); echo $hostname; ?>
yoursitehere.com/dnslookup.php?ip=2.3.4.5
Pawn Code
Now this is where your server handles this - whether its a command ingame, IRC, or whatever, you can edit this later:
Код:
CMD:dns(playerid,params[]) { if(IsPlayerAdmin(playerid)) { new id; if(sscanf(params,"u",id)) return SendClientMessage(playerid,0xFF0000AA,"Usage: !dns <playerid/playername>"); new str[160],ip[16]; if(IsPlayerConnected(id)) { GetPlayerIp(id,ip,sizeof ip); format(str,sizeof str,"website.com/dnslookup.php?ip=%s",ip); HTTP(playerid,HTTP_GET,str,"","OnDnsLookup"); } else SendClientMessage(playerid,0xFF0000AA,"That player is not connected.."); } return 1; }
Код:
forward OnDnsLookup(index, response_code, data[]); public OnDnsLookup(index, response_code, data[]) { if(response_code == 200) { SendClientMessage(index,0xE0E494FF,data); } else ShowPlayerDialog(index,101,DIALOG_STYLE_MSGBOX,"Tracking Results:","Error Connecting to DNS Tracking Service.\nTry again.","Ok",""); }
The command is coded with zcmd. Any questions, ask below.
Enjoy, i know this will help many people.