SA-MP Forums Archive
GetPlayerIp... - 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)
+--- Thread: GetPlayerIp... (/showthread.php?tid=361355)



GetPlayerIp... - mrsamp - 20.07.2012

It's supposed to show the connecting players ip for admins lvl 1 and higher... but nothing is happening but no errors or warnings..
Please help?

Код:
public OnPlayerConnect(playerid)
{
  new dialog[128],string[128],ip[16],name[MAX_PLAYER_NAME];
    format(string, 35, Player_File, GetName(playerid));

    if(!INI_Exists(string))
    {
        format(dialog, sizeof(dialog),""COL_BLUE"Name "COL_WHITE"%s "COL_YELLOW"isn't registered\n\nPlease typepassword", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_RED"Welcome on my server", dialog, "Register", "Exit");
    }
    else
    {
        format(dialog, sizeof(dialog),""COL_YELLOW"Name "COL_WHITE"%s "COL_YELLOW"is registered\n\nPlease login", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""COL_YELLOW"Welcome on my server",dialog, "Login", "Exit");
 }
 SetPVarInt(playerid, "Join", 1);

 if(P_Data[playerid][pAdmin] >= 1)
 {
 GetPlayerName(playerid,name,sizeof(name));
 GetPlayerIp(playerid,ip,sizeof(ip));
 format(string, 150, "%s has Connected with ip: %s.", name, ip);
 SCMToAll(COLOR_RED,string);
 }
 return 1;
 }



Re: GetPlayerIp... - tyler12 - 20.07.2012

nub we fixed it.


Re: GetPlayerIp... - mrsamp - 20.07.2012

Yea ik

EDIT: no rly its showing for all players not only admins...


Re: GetPlayerIp... - tyler12 - 20.07.2012

Quote:
Originally Posted by mrsamp
Посмотреть сообщение
Yea ik

EDIT: no rly its showing for all players not only admins...
we fixed it again xD

stay on skype!!


Re: GetPlayerIp... - mrsamp - 20.07.2012

It's not even showing ip for admins now...


Re: GetPlayerIp... - EV007 - 20.07.2012

....... You are checking if the connected player is an admin, then checking his IP and sending it to EVERYONE...

Код:
new ip[16],name[20],string[150];
GetPlayerIp(playerid, ip, sizeof(ip));
GetPlayerName(playerid,name,sizeof(name));
format(string, 150, "%s has Connected with ip: %s.", name, ip);

for(new i=0;i<MAX_PLAYERS;i++)
{
  if(P_Data[i][pAdmin] >= 1)
 {
SCM(i,COLOR_RED,string);
 }
}



Re: GetPlayerIp... - mrsamp - 20.07.2012

Thank you it's working.

P.S I'm new. :P