HELP: getip command
#1

Hello!

I have another question for you guys

How can I make /getip command with dini?

Thanks for help!
Reply
#2

Anyone?
Reply
#3

https://sampwiki.blast.hk/wiki/GetPlayerIp >.<
Reply
#4

Try this

Код:
CMD:aka(playerid, params[])
{
	if(!IsCnRAdmin(playerid)) return UnknownCMD(playerid); // replace your own admin variable
	new pID;
	if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /aka (nick/id) - Enter A Valid Nick / ID");
	if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "This Player Is Not Connected.");
 	if(pID == cellmin) return SendClientMessage(playerid, COLOR_RED, "Multiple Players Found. Please Be More Specific.");
	new file[128], string[200], ip[128];
	format(file, sizeof file, "DM/Config/aka.txt");
	GetPlayerIp(pID, ip, sizeof ip);
	if(pID == playerid) format(string, sizeof string, "Your Nicknames [%s]:  %s", ip, dini_Get(file, ip));
	else format(string, sizeof string, "%s (%d)'s Nicknames [%s]:  %s", PlayerName(pID), pID, ip, dini_Get(file, ip));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	return 1;
}
Don't forget to create /rename an folder with another folder inside it named "Config" and a aka.txt in there.
Reply
#5

Quote:
Originally Posted by MonTaNaAa
Посмотреть сообщение
Try this

Код:
CMD:aka(playerid, params[])
{
	if(!IsCnRAdmin(playerid)) return UnknownCMD(playerid); // replace your own admin variable
	new pID;
	if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /aka (nick/id) - Enter A Valid Nick / ID");
	if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "This Player Is Not Connected.");
 	if(pID == cellmin) return SendClientMessage(playerid, COLOR_RED, "Multiple Players Found. Please Be More Specific.");
	new file[128], string[200], ip[128];
	format(file, sizeof file, "DM/Config/aka.txt");
	GetPlayerIp(pID, ip, sizeof ip);
	if(pID == playerid) format(string, sizeof string, "Your Nicknames [%s]:  %s", ip, dini_Get(file, ip));
	else format(string, sizeof string, "%s (%d)'s Nicknames [%s]:  %s", PlayerName(pID), pID, ip, dini_Get(file, ip));
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	return 1;
}
Thanks for help....but I can't use sscanf, because don't work for me
Reply
#6

Maybe this one can help you then, from the ladmin FS

pawn Код:
dcmd_aka(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
        if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /aka [playerid]");
        new player1, playername[MAX_PLAYER_NAME], str[128], tmp3[50];
        player1 = strval(params);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            GetPlayerIp(player1,tmp3,50);
            GetPlayerName(player1, playername, sizeof(playername));
            format(str,sizeof(str),"AKA: [%s id:%d] [%s] %s", playername, player1, tmp3, dini_Get("ladmin/config/aka.txt",tmp3) );
            return SendClientMessage(playerid,blue,str);
        } else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Reply
#7

Quote:
Originally Posted by MonTaNaAa
Посмотреть сообщение
Maybe this one can help you then, from the ladmin FS

pawn Код:
dcmd_aka(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
        if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /aka [playerid]");
        new player1, playername[MAX_PLAYER_NAME], str[128], tmp3[50];
        player1 = strval(params);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            GetPlayerIp(player1,tmp3,50);
            GetPlayerName(player1, playername, sizeof(playername));
            format(str,sizeof(str),"AKA: [%s id:%d] [%s] %s", playername, player1, tmp3, dini_Get("ladmin/config/aka.txt",tmp3) );
            return SendClientMessage(playerid,blue,str);
        } else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
I will try thanks
Reply
#8

Hmmm...I get this error:

Quote:

C:\Users\tadej\Desktop\My Server, Don't touch!\gamemodes\Samp.pwn(547) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Reply
#9

Quote:
Originally Posted by Areax
Посмотреть сообщение
Hmmm...I get this error:
line?

Do you want a command /getip that gets the ip of a player whether he's online or not by his file by using dini?
Do you want a command /getip that gets player's ip who is online by using the SA:MP function?
Reply
#10

Quote:
Originally Posted by Dwane
Посмотреть сообщение
line?

Do you want a command /getip that gets the ip of a player whether he's online or not by his file by using dini?
Do you want a command /getip that gets player's ip who is online by using the SA:MP function?
Here is the line:

PHP код:
    } else return SendClientMessage(playerid,red,"You need to be administrator level 1 to use that command!"); 
I want to get his ip when he is online like: /getip 4 and then like: Player's IP is: blah blah...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)