IP of Player?
#1

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?
Reply
#2

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
Reply
#3

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..
Reply
#4

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;
}
Reply
#5

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"
Reply
#6

Try mine! Fully working!
Reply
#7

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.
Reply
#8

@RedJohn

Then i have 1 Warning: error 021: symbol already defined: "OnPlayerClickPlayer"

Please help me. xD
Reply
#9

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;
}
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)