IP of Player? -
Blackazur - 12.09.2012
How can i scripting, that, Admins can see the IP of a Player? So when he type the Tab list, and click of a Player, so that Admins can see the IP?
Re: IP of Player? -
clarencecuzz - 12.09.2012
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(!IsPlayerAdmin(playerid) || AdminVariable[playerid] < 1) return 0;
new IPSTRING[20], PlayersName[MAX_PLAYER_NAME];
GetPlayerName(clickedplayerid, PlayersName, MAX_PLAYER_NAME);
GetPlayerIp(clickedplayerid, IPSTRING, sizeof(IPSTRING));
new string[50];
format(string,sizeof(string),"%s | IP: %s",PlayersName, IPSTRING);
SendClientMessage(playerid, 0xFFFF00FF, string);
return 1;
}
NOTE: Untested
Re: IP of Player? -
Roach_ - 12.09.2012
Try this:
pawn Код:
public OnPlayerClickPlayer( playerid, clickedplayerid, source )
{
new String[ 15 ];
GetPlayerIp(clickedplayerid, String, 15);
SendClientMessage(playerid, -1, String);
return ( 1 );
}
PS: You must add your Admin Variable to work, you know
EDIT: Too late..
Re: IP of Player? -
RedJohn - 12.09.2012
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "You are not allowed to do that");
new PlayerIP[16], string[20], id;
GetPlayerIp(id, PlayerIP, sizeof(PlayerIP));
format(string, sizeof(string), "Player IP is:%s", PlayerIP);
SendClientMessage(playerid, YELLOW, string);
return 1;
}
AW: Re: IP of Player? -
Blackazur - 12.09.2012
Quote:
Originally Posted by clarencecuzz
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source) { if(!IsPlayerAdmin(playerid) || AdminVariable[playerid] < 1) return 0; new IPSTRING[20], PlayersName[MAX_PLAYER_NAME]; GetPlayerName(clickedplayerid, PlayersName, MAX_PLAYER_NAME); GetPlayerIp(clickedplayerid, IPSTRING, sizeof(IPSTRING)); new string[50]; format(string,sizeof(string),"%s | IP: %s",PlayersName, IPSTRING); SendClientMessage(playerid, 0xFFFF00FF, string); return 1; }
NOTE: Untested
|
When i make that, i have 4 Errors:
error 055: start of function body without function header
error 010: invalid function or declaration
error 021: symbol already defined: "GetPlayerName"
error 021: symbol already defined: "format"
Re: IP of Player? -
RedJohn - 12.09.2012
Try mine! Fully working!
Re: IP of Player? -
clarencecuzz - 12.09.2012
Quote:
Originally Posted by RedJohn
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "You are not allowed to do that"); new PlayerIP[16], string[20], id; GetPlayerIp(id, PlayerIP, sizeof(PlayerIP)); format(string, sizeof(string), "Player IP is:%s", PlayerIP); SendClientMessage(playerid, YELLOW, string); return 1; }
|
That wouldn't be very efficient, because if a player decides to double click on a player, they will receive the error message and will be confused by it, because you're basically telling them, "You can't click on player's names."
So just return 0; instead.
@Blackazur I can't really explain this error, but make sure you have a_samp included, make sure you haven't repeated functions such as 'OnPlayerClickPlayer' repeated twice etc.
EDIT: Oh and also, you have new id; so this command would only work on ID 0... you're supposed to use 'clickedplayerid' instead of making your own variable, so no, this wouldn't work.
AW: IP of Player? -
Blackazur - 12.09.2012
@RedJohn
Then i have 1 Warning: error 021: symbol already defined: "OnPlayerClickPlayer"
Please help me. xD
Re: IP of Player? -
RedJohn - 12.09.2012
Somewhere you have like:
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "You are not allowed to do that");
new PlayerIP[16], string[20], id;
GetPlayerIp(id, PlayerIP, sizeof(PlayerIP));
format(string, sizeof(string), "Player IP is:%s", PlayerIP);
SendClientMessage(playerid, YELLOW, string);
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "You are not allowed to do that");
new PlayerIP[16], string[20], id;
GetPlayerIp(id, PlayerIP, sizeof(PlayerIP));
format(string, sizeof(string), "Player IP is:%s", PlayerIP);
SendClientMessage(playerid, YELLOW, string);
return 1;
}
Re: IP of Player? -
clarencecuzz - 12.09.2012
You have 'OnPlayerClickPlayer' in your script twice. Don't use RedJohn's script it won't work properly. Just remove all public OnPlayerClickPlayer codes from your script and paste the code I've given you.