/ip gives error, /mute doesn't works correctly
#1

HEre is /ip.. When i do /ip 0 it says always: ERROR: Player is not connected..

pawn Code:
CMD:ip(playerid, params[])
{
    new target;
    if(PlayerInfo[playerid][pAdmin] >=3)
    {
        if (!IsPlayerConnected(target))
        {
            if(sscanf(params, "u", target)) return SendClientMessage(playerid, DEEPPINK, "USAGE: /ip <id>");
            {
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(target, tname, sizeof(tname));
                new pstr[128];
                new tping = GetPlayerIp(target, pstr, sizeof(pstr));
                format(pstr, sizeof(pstr), "{FFFFFF}%s's {00FF66}IP {FFFFFF}is:{00FF66}%s", tname, tping);
                SendClientMessage(playerid, -1, pstr);
                return 1;
            }
        }
        else return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
    }
    else return SendClientMessage(playerid, DEEPPINK, "ERROR: You must be level 3 to use that command!");
}
OnPlayerText of /mute

pawn Code:
public OnPlayerText(playerid, text[])
{
    if(muted[playerid] == 1)
    {
        SendClientMessage(playerid, ORANGE, "ERROR: You have been muted you can't talk. Use /paymute to get unmuted. (Costs 5000$)");
        return 1;
    }
When i return 1 it appears the thing but i can't chat, and when i put return 0 it doesn't appears anything..

help pls..
Reply
#2

pawn Code:
CMD:ip(playerid, params[])
{
    new target;
    if(PlayerInfo[playerid][pAdmin] >=3)
    {
        if(sscanf(params, "u", target)) return SendClientMessage(playerid, DEEPPINK, "USAGE: /ip <id>");
        {
            if(IsPlayerConnected(target))
            {
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(target, tname, sizeof(tname));
                new pstr[128];
                GetPlayerIp(target, pstr, sizeof(pstr));
                format(pstr, sizeof(pstr), "{FFFFFF}%s's {00FF66}IP {FFFFFF}is:{00FF66}%s", tname, pstr);
                SendClientMessage(playerid, -1, pstr);
                return 1;
            }
            else return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
        }
    }
    else return SendClientMessage(playerid, DEEPPINK, "ERROR: You must be level 3 to use that command!");
}
pawn Code:
public OnPlayerText(playerid, text[])
{
    if(muted[playerid] == 1)
    {
        SendClientMessage(playerid, ORANGE, "ERROR: You have been muted you can't talk. Use /paymute to get unmuted. (Costs 5000$)");
        return 0;
    }
Reply
#3

At the On IsPlayerConnected part, you put an ! at the IsPlayerConnected, which caused the error.

pawn Code:
CMD:ip(playerid, params[])
{
    new target;
    if(PlayerInfo[playerid][pAdmin] >=3)
    {
        if (IsPlayerConnected(target))
        {
            if(sscanf(params, "u", target)) return SendClientMessage(playerid, DEEPPINK, "USAGE: /ip <id>");
            {
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(target, tname, sizeof(tname));
                new pstr[128];
                new tping = GetPlayerIp(target, pstr, sizeof(pstr));
                format(pstr, sizeof(pstr), "{FFFFFF}%s's {00FF66}IP {FFFFFF}is:{00FF66}%s", tname, tping);
                SendClientMessage(playerid, -1, pstr);
                return 1;
            }
        }
        else return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
    }
    else return SendClientMessage(playerid, DEEPPINK, "ERROR: You must be level 3 to use that command!");
}
Reply
#4

pawn Code:
CMD:ip(playerid, params[])
{
    new target;
    if(PlayerInfo[playerid][pAdmin] >=3)
    {
        if (!IsPlayerConnected(target))
        {
            if(sscanf(params, "u", target)) return SendClientMessage(playerid, DEEPPINK, "USAGE: /ip <id>");
            {
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(target, tname, sizeof(tname));
                new pstr[128];
                new tping = GetPlayerIp(target, pstr, sizeof(pstr));
                format(pstr, sizeof(pstr), "{FFFFFF}%s's {00FF66}IP {FFFFFF}is:{00FF66}%d", tname, tping); //error..
                SendClientMessage(playerid, -1, pstr);
                return 1;
            }
        }
        else return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
    }
    else return SendClientMessage(playerid, DEEPPINK, "ERROR: You must be level 3 to use that command!");
}
You had IP Defined with %s(string) instead %d(Integer(whole number))
Reply
#5

Quote:
Originally Posted by Strier
View Post
pawn Code:
CMD:ip(playerid, params[])
{
    new target;
    if(PlayerInfo[playerid][pAdmin] >=3)
    {
        if (!IsPlayerConnected(target))
        {
            if(sscanf(params, "u", target)) return SendClientMessage(playerid, DEEPPINK, "USAGE: /ip <id>");
            {
                new tname[MAX_PLAYER_NAME];
                GetPlayerName(target, tname, sizeof(tname));
                new pstr[128];
                new tping = GetPlayerIp(target, pstr, sizeof(pstr));
                format(pstr, sizeof(pstr), "{FFFFFF}%s's {00FF66}IP {FFFFFF}is:{00FF66}%d", tname, tping); //error..
                SendClientMessage(playerid, -1, pstr);
                return 1;
            }
        }
        else return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
    }
    else return SendClientMessage(playerid, DEEPPINK, "ERROR: You must be level 3 to use that command!");
}
You had IP Defined with %s(string) instead %d(Integer(whole number))
Thats wrong. An IP address is a string, not an integar.
Reply
#6

why would it be an string if it's not a text?

PS. It's a question, not trying to be smart.
Reply
#7

Quote:
Originally Posted by Strier
View Post
why would it be an string if it's not a text?

PS. It's a question, not trying to be smart.
It has dots in it, which integars can't have, so that makes it a string.

And it was not a question without a question mark. (?)
Reply
#8

it is a string, an integer wont work, cauz it has dots (.)
Reply
#9

Well.. i have this code on my test server

pawn Code:
new JoinFA[100], pIP[15];
     GetName(playerid);
     GetPlayerIp(playerid, pIP, sizeof(pIP));
     format(JoinFA,sizeof(JoinFA), " * %s joined the server [%d]",GetName(playerid), pIP);
     MessageToAdmins(grey, JoinFA);
And it works perfectly.
Reply
#10

I edited my First post. Should work this way now, I've overseen two things, sorry. xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)