Posts: 107
Threads: 33
Joined: Aug 2015
Reputation:
0
hello , can you help me with a script please , i need a script that tells the admins that someone is coonecting and IP
exemple : TheDarkBlade is connecting, IP : x.xx.xx
And a command that admins can get someone's ip
like : /getip (Name/id)
Posts: 1,266
Threads: 6
Joined: Oct 2014
18.08.2015, 23:51
(
Последний раз редактировалось jlalt; 31.08.2015 в 11:44.
)
hope it work o.o
PHP код:
#include a_samp
#include zcmd
#include sscanf2
public OnPlayerConnect(playerid)
{
new IP[128],PlayerName[128],string[138];
GetPlayerIp(playerid,IP,sizeof(IP));
format(string,128,"{00FFFF}*** %s [ID:%d] has joined the server.[IP: %s ] ", PlayerName,playerid,IP);
MessageToAdmins(-1, string);
return 1;
}
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 1) /* <<<<< your admin promise */ SendClientMessage(i, color, string);
}
return 1;
}
/* Example how to send message to rcon if player join
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new playerid;
if(IsPlayerConnected(i) == 1) if (IsPlayerAdmin(playerid)) SendClientMessage(i, color, string);
}
return 1;
}*/
CMD:ip(playerid,params[]) {
if(IsPlayerAdmin(playerid)) {
new giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /ip [playerid]");
new string[128];
if(IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID) {
new tmp3[50]; GetPlayerIp(giveplayerid,tmp3,50);
format(string,sizeof(string),"\"%s's\" ip is '%s'", pName(giveplayerid), tmp3);
return SendClientMessage(playerid,-1,string);
} else return SendClientMessage(playerid,-1,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,-1,"ERROR: You are not a high enough level to use this command");
}
pName(playerid)
{
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
return plname;
}