SA-MP Forums Archive
Help Please :( - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Please :( (/showthread.php?tid=337406)



Help Please :( - ColdRain - 26.04.2012

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 ?


Re: Help Please :( - shitbird - 26.04.2012

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



Re: Help Please :( - ColdRain - 26.04.2012

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


Re: Help Please :( - PrawkC - 26.04.2012

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.


Re: Help Please :( - MadeMan - 26.04.2012

IP is a string

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



Re: Help Please :( - ColdRain - 26.04.2012

thnx all that useful works

i rep++