Script
#1

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

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(-1string);
    return 
1;
}
forward MessageToAdmins(color,const string[]);
public 
MessageToAdmins(color,const string[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 1/* <<<<< your admin promise */  SendClientMessage(icolorstring);
    }
    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(playeridplnamesizeof(plname));
  return 
plname;

Reply
#3

will it crash if i use instead of
Код:
if(IsPlayerAdmin(playerid))
=>
Код:
 if (PlayerData[playerid][pAdmin] >= 1)
Reply
#4

Quote:
Originally Posted by TheDarkBlade
Посмотреть сообщение
will it crash if i use instead of
Код:
if(IsPlayerAdmin(playerid))
=>
Код:
 if (PlayerData[playerid][pAdmin] >= 1)
Nop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)