/GETIP Errors
#1

I have tried to script this cmd like this but does not work.

pawn Код:
CMD:getip(playerid, params[])
{
    if(Player[playerid] [pAdmin] >=1)
    {
    new targetid;
    new ip[16];
    if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]/getip [ID].");
    GetPlayerIp(targetid,ip,sizeof(ip));
    format(ip, sizeof(ip), "[SERVER]:TargetID IP is: %s ",ip);
    SendClientMessage(playerid,COLOR_YELLOW,ip);
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED, "[SERVER]:You are not allowed to use this command.");
    }
    return 1;
}
Reply
#2

I would simply just rewrite it for you:

PHP код:
CMD:getip(playeridparams[])
{
    if(
Player[playerid] [pAdmin] >=1)
    {
    new 
targetidip[16], string[60];
    if(
sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]/getip [ID].");
    
GetPlayerIp(targetid,ip,sizeof(ip));
    
format(stringsizeof(string), "[SERVER]:TargetID IP is: %s ",ip);
    
SendClientMessage(playerid,COLOR_YELLOW,string);
    }
    else
    {
        
SendClientMessage(playerid,COLOR_RED"[SERVER]:You are not allowed to use this command.");
    }
    return 
1;

I think that should work, all I did really is make a new string because you were getting the player's IP, and then overwriting it with the [SERVER]:TargetID etc message, and then trying to send the user the IP which had already been rewritten over.
Reply
#3

Use This :
pawn Код:
new string[150];
new ipstring[25];
new ID;
GetPlayerIp(ID,ipstring,sizeof(ipstring));
format(string,sizeof(string),"(%d) IP : %s",ID,ipstring);
SendClientMessage(playerid,-1,string);
}
Reply
#4

Here :

pawn Код:
COMMAND:getip(playerid, params[])
{
    if(//Your enumerator variable here)
    {
                new
                    ip[32],
                    target,
                    string[50];
        if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "USAGE: /ip [ip]");
                GetPlayerIp(target, ip, sizeof(ip));
                format(string, sizeof(string), "Player: %s (ID: %d) | IP: %s", GetPlayerName(target), playerid, ip);
                SendClientMessage(playerid, -1, string);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)