Help Please :(
#1

pawn Код:
IRCCMD:banname(botid, channel[], user[], host[], params[])
{
    // Check if the user is at least an op in the channel
    if(IRC_IsOp(botid, channel, user) || IRC_IsAdmin(botid, channel, user))
    {



        // If the user did not enter a player ID, then the command will not be processed
        if(isnull(params))
            return IRC_Say(gGroupID, channel, "02USAGE: !banname <PlayerName>");

        // If the player is not connected, then nothing will be done
        if(!udb_Exists(params))
        return IRC_Say(gGroupID,channel,"4*** Error: This PlayerName Is Not In Our Database");

            new
                msg[128];
        if(udb_Exists(params))
        {
            format(msg, sizeof(msg), "02*** %s has been banned by %s on IRC. (Cheater)", params, user);
            IRC_GroupSay(gGroupID, channel, msg);
            format(msg, sizeof(msg), "BAN: %s has been banned by IRC. (Cheater)", params);
            SendClientMessageToAll(0x0000FFFF, msg);
            new playerip;
            new banmsg[128];
            dUserSetINT(params).("nameban",1);
            playerip = dUserINT(params).("playerIP");
            format(banmsg,sizeof(banmsg),"banip %s",playerip);
            SendRconCommand(banmsg);
            }
        }
    return 1;
}
i did this command for irc when i go and type it its all work work good and nice but the RconCommand doesnt work so the playername i ban dose not get to samp.ban
but the line to set nameban=1 works good but why the RconCommand Doesnt ?
Reply
#2

pawn Код:
new playerip[16];
GetPlayerIp(playerid, playerip, sizeof(playerip));
Reply
#3

but i dont want playerip because in the command i dont type any playerid i type player name
Reply
#4

Use this to get the IP instead

pawn Код:
stock GetIpFromName(name[])
{
    new ip[20], tName[MAX_PLAYER_NAME];
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i))
            continue;

        GetPlayerName(i, tName, sizeof(tName));
        if(!strcmp(tName, name, true))
        {
            GetPlayerIP(i, ip, sizeof(ip));
            return ip;
        }  
    }
    return 0;  
}
Untested, but should work.
Reply
#5

IP is a string

pawn Код:
format(banmsg,sizeof(banmsg),"banip %s",dUser(params).("playerIP"));
SendRconCommand(banmsg);
Reply
#6

thnx all that useful works

i rep++
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)