OnPlayerClickPlayer
#1

Код:
public OnPlayerClickPlayer(playerid,clickedplayerid,source)
		{
			new IP[128];
			new wstring[256];
		 	if(IsPlayerConnected(playerid))
	 		{
  	 			if(PlayerInfo[playerid][pAdmin] >= 9)
				{
				 	GetPlayerIp(playerid,IP,128);
	    			format(wstring, sizeof(wstring), "[IP-CHECK] You clicked on player ID: %s. IP:%d.",playerid,IP);
	    			SendClientMessage(playerid,COLOR_Tattaglia, wstring);
				}
			}
			return 1;
		}
Can someone tell me wrong with this public? It's don't sohwing the ID of the player and don't showing the whole IP, just the 2 first numbers.
Reply
#2

IP's are 16 characters long, and are read as a string, not an integer.

pawn Код:
public OnPlayerClickPlayer(playerid,clickedplayerid,source)
        {
            new IP[16];
            new wstring[256];
            if(IsPlayerConnected(playerid))
            {
                if(PlayerInfo[playerid][pAdmin] >= 9)
                {
                    GetPlayerIp(playerid,IP,sizeof(IP));
                    format(wstring, sizeof(wstring), "[IP-CHECK] You clicked on player ID: %d. IP:%s.",playerid,IP);
                    SendClientMessage(playerid,COLOR_Tattaglia, wstring);
                }
            }
            return 1;
        }
Reply
#3

You are wasting your resources.

1) change new IP[128]; to new IP[16];
2) IsPlayerConnect check is not needed.
3) Change %d to %s.

It should work!
Reply
#4

THanks !!!!
Reply
#5

Quote:
Originally Posted by Ironboy500[TW]
Посмотреть сообщение
You are wasting your resources.

1) change new IP[128]; to new IP[16];
2) IsPlayerConnect check is not needed.
3) Change %d to %s.

It should work!
Not to mention, wstring should not be 258 cells... such a waste; change it to 128.
Reply
#6

Another question, How I can do that when you clikc on the player it will show from what country he is?
Reply
#7

It should be:
pawn Код:
public OnPlayerClickPlayer(playerid,clickedplayerid,source)
{
    new IP[16], wstring[128];
    if(PlayerInfo[playerid][pAdmin] >= 9)
    {
        GetPlayerIp(clickedplayerid,IP,sizeof(IP));
        format(wstring, sizeof(wstring), "[IP-CHECK] You clicked on player ID: %d. IP:%s.",clickedplayerid,IP);
        SendClientMessage(playerid,COLOR_Tattaglia, wstring);
    }
    return 1;
}
Reply
#8

LOL you didn't change anything. I need it to show from what country the player connecting.
Reply
#9

Quote:
Originally Posted by zxc1
Посмотреть сообщение
LOL you didn't change anything. I need it to show from what country the player connecting.
He was correcting the code you idiot so that it would show the clicked players IP not the player who clicked IP. Read his post next time.
Reply
#10

Can someone help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)