SA-MP Forums Archive
OnPlayerClickPlayer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerClickPlayer (/showthread.php?tid=261293)



OnPlayerClickPlayer - zxc1 - 12.06.2011

Код:
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.


Re: OnPlayerClickPlayer - Skylar Paul - 12.06.2011

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;
        }



Re: OnPlayerClickPlayer - Ironboy500[TW] - 12.06.2011

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!


Re: OnPlayerClickPlayer - zxc1 - 12.06.2011

THanks !!!!


Re: OnPlayerClickPlayer - Skylar Paul - 12.06.2011

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.


Re: OnPlayerClickPlayer - zxc1 - 14.06.2011

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


Re: OnPlayerClickPlayer - HyperZ - 14.06.2011

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;
}



Re: OnPlayerClickPlayer - zxc1 - 14.06.2011

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


Re: OnPlayerClickPlayer - Steven82 - 14.06.2011

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.


Re: OnPlayerClickPlayer - zxc1 - 14.06.2011

Can someone help?