Unbanip to unban
#1

Hello i made a command that is unban but you are required to put your ip but i dont know how to transform it to names not ips any idea how i can do it?


pawn Код:
CMD:unban(playerid,params[])
{
    new ip[32], dformat[64];
    if(pInfo[playerid][Adminlevel] >= 4)
    if(sscanf(params,"s[32]",ip)) return SendClientMessage(playerid,COLOR_PINK,"USAGE: /unban [name]");
    format(dformat,sizeof dformat,"unbanip %s",ip);
    SendRconCommand(dformat);
    return 1;
}
Reply
#2

You've to use the "u" parameter.

pawn Код:
CMD:unban(playerid, params[])
{
    new player, pIP[16], string[24];
    if(sscanf(params, "u", player)) return SendClientMessage(playerid, -1, "Usage: /unban [name].");
    if(!IsPlayerConnected(player)) return SendClientMessage(playerid, -1, "Player not connected.");
    GetPlayerIp(player, pIP, sizeof(pIP));
    format(string, sizeof(string), "unbanip %s", pIP);
    SendRconCommand(string);
    return 1;
}
Reply
#3

Quote:
Originally Posted by iNetX
Посмотреть сообщение
You've to use the "u" parameter.

pawn Код:
CMD:unban(playerid, params[])
{
    new player, pIP[16], string[24];
    if(sscanf(params, "u", player)) return SendClientMessage(playerid, -1, "Usage: /unban [name].");
    if(!IsPlayerConnected(player)) return SendClientMessage(playerid, -1, "Player not connected.");
    GetPlayerIp(player, pIP, sizeof(pIP));
    format(string, sizeof(string), "unbanip %s", pIP);
    SendRconCommand(string);
    return 1;
}
No. The 'u' parameter is only for people thats logged ingame but his case is that he wants to unban people outside the game

pawn Код:
CMD:unban(playerid, params[])
{
    new pIP[16], string[128];
    if(pInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid, -1, "You are not level 4 admin to use this command");
    if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, -1, "USAGE: /unban [name]");
    GetPlayerIp(params, pIP, sizeof(pIP));
    format(string, sizeof(string), "unbanip %s", pIP);
    SendRconCommand(string);
    return 1;
}
Reply
#4

Код:
	CMD:unban(playerid, params[])
	{
	    new IP[16], string[128];
		if(pInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid, -1, "You are not level 4 admin to use this command");
		if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, -1, "USAGE: /unban [IP]");
        GetPlayerIp(params, IP, sizeof(IP));
		format(string,sizeof(string),"unbanip %s",IP);
		SendRconCommand(string);
		SendRconCommand("reloadbans");
		return 1;
	}
Reply
#5

Quote:
Originally Posted by xdec0de
Посмотреть сообщение
Код:
	CMD:unban(playerid, params[])
	{
	    new IP[16], string[128];
		if(pInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid, -1, "You are not level 4 admin to use this command");
		if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, -1, "USAGE: /unban [IP]");
        GetPlayerIp(params, IP, sizeof(IP));
		format(string,sizeof(string),"unbanip %s",IP);
		SendRconCommand(string);
		SendRconCommand("reloadbans");
		return 1;
	}
What? if he reload bans then the whole ban log would be cleared out and everyone would be unbanned do not use his code.
Reply
#6

Quote:
Originally Posted by Wizz123
Посмотреть сообщение
What? if he reload bans then the whole ban log would be cleared out and everyone would be unbanned do not use his code.
The ban log doesn't get cleared when you reload it. That would be silly
Reply
#7

Quote:
Originally Posted by Wizz123
Посмотреть сообщение
No. The 'u' parameter is only for people thats logged ingame but his case is that he wants to unban people outside the game
And he mentioned that need command to unban the IP of a player who is not online?

The "GetPlayerIP" function gets the IP of a player he is ON in the game, and want to get an IP of a player who is not connected?

If i'm wrong, correct me.
Reply
#8

Quote:
Originally Posted by iNetX
Посмотреть сообщение
And he mentioned that need command to unban the IP of a player who is not online?

The "GetPlayerIP" function gets the IP of a player he is ON in the game, and want to get an IP of a player who is not connected?

If i'm wrong, correct me.
You are wrong in every possible way.

1) GetPlayerIP can get the player ip even if he is off.

2) You made a command that unbans the player only if he's online.


--
Funextreme who gives a shit it stills unbans everyone.
Reply
#9

Quote:
Originally Posted by Wizz123
Посмотреть сообщение
You are wrong in every possible way.

1) GetPlayerIP can get the player ip even if he is off.

2) You made a command that unbans the player only if he's online.


--
Funextreme who gives a shit it stills unbans everyone.
As u think it's possible to get the IP of a player out of the game? GetPlayerIP is used to get the IP of a player by ID. It is illogical to what u're saying.
Reply
#10

Quote:
Originally Posted by Wizz123
Посмотреть сообщение
You are wrong in every possible way.

1) GetPlayerIP can get the player ip even if he is off.

2) You made a command that unbans the player only if he's online.


--
Funextreme who gives a shit it stills unbans everyone.
You are an idiot, stop posting here until you've done your research.

If you want us to make you a full script on unbanning a player, show us where you are saving a player's ban. (Perhaps your /ban command?)
Reply
#11

All of you here fail to see what he wants..

Quote:
Originally Posted by DarkLored
View Post
Hello i made a command that is unban but you are required to put your ip but i dont know how to transform it to names not ips any idea how i can do it?


pawn Code:
CMD:unban(playerid,params[])
{
    new ip[32], dformat[64];
    if(pInfo[playerid][Adminlevel] >= 4)
    if(sscanf(params,"s[32]",ip)) return SendClientMessage(playerid,COLOR_PINK,"USAGE: /unban [name]");
    format(dformat,sizeof dformat,"unbanip %s",ip);
    SendRconCommand(dformat);
    return 1;
}
He want to make the cmd into /unban [PLAYER_NAME]! Not /unban [IP].. He wants to know how he check the .ban file and if the name he typed is in there, check that name's IP and then automaticlly unban the IP of the NAME he typed.
Reply
#12

Quote:
Originally Posted by BenzoAMG
View Post
You are an idiot, stop posting here until you've done your research.

If you want us to make you a full script on unbanning a player, show us where you are saving a player's ban. (Perhaps your /ban command?)
He didn't show us nothing but his cmd which isent so very helpful aswell you stupid malformed prick whore cocksucking retarded son of a bitch.
Reply
#13

Quote:
Originally Posted by Wizz123
View Post
He didn't show us nothing but his cmd which isent so very helpful aswell you stupid malformed prick whore cocksucking retarded son of a bitch.
Take your childish argues somewhere else.. This thread is to help, not curse at each other.
Reply
#14

Yeah i want the ban to check the name and not the ip
Reply
#15

Quote:
Originally Posted by Wizz123
View Post
He didn't show us nothing but his cmd which isent so very helpful aswell you stupid malformed prick whore cocksucking retarded son of a bitch.
Well giving him false information surely isn't going to help him either way.

Again, I will repeat myself. If you are trying to unban a PLAYER from the samp.ban list, which relies solely on IPs, not names... then you must have some sort of system that saves that ip to the player's file (even if it's just a text file...). So that when it comes to unbanning them, you can retrieve the ip, unban it, hence unbanning the player.

Again, it all relates back to the ip. If the ip isn't saved to a place relating to the actual player's name, then there is no way of actually getting the IP to unban unless you want to install some sort of plugin that can read files in the root directory. Which I think is a waste of time for this kind of thing. Do you have ANYTHING at all that saves the player's ip to a file other than samp.ban? Or do we have to write that code for you too?
Reply
#16

I do have the unban file and it does saves their ip but the problem is i dont know how to transform unbanip to unbanname
Reply
#17

Get the ip from the file. Unban that IP through SendRCONCommand. Reloadbans through SendRCONCommand. Delete the file. Done.
Reply
#18

But what i asked is for unbanname not unbanip so how can i do when i type /unbanname exsample then it unbans his ip from the file
Reply
#19

Guys atleast help with this what i wanted to make that if someone offline and he is banned i dont have to type his ip to unban him like /unban [name] not /unban [ip]
Reply
#20

Oh god, it's like explaining algebra to a 2 year old...

This is a quick one that I have made up. Surely you can understand what I'm trying to say now...
pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

public OnPlayerConnect(playerid)
{
    new file[40], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "Bans/%s.txt", name);
    if(fexist(file))
    {
        new ip[16];
        GetPlayerIp(playerid, ip, sizeof(ip));
        new File:banfile = fopen(file, io_append);
        format(file, sizeof(file), "%s\r\n", ip);
        fwrite(banfile, file);
        fclose(banfile);
        return Kick(playerid);
    }
    return 1;
}

CMD:ban(playerid, params[]) //When you ban a player:
{
    if(!IsPlayerAdmin(playerid) /*&& PlayerInfo[playerid][AdminLevel] < 1*/) return SendClientMessage(playerid, 0xFF0000FF, "You must be an admin to use this command.");
    new id, reason[50];
    if(sscanf(params, "uS(No Reason)[50]", id, reason)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /ban [id/name] [Optional: reason]");
    if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected.");
    if(!fexist("Bans/")) return SendClientMessage(playerid, 0xFF0000FF, "You must create a folder called 'Bans' in your scriptfiles before banning a player.");
    new name[MAX_PLAYER_NAME], file[35], str[100], ip[16];
    GetPlayerName(id, name, sizeof(name));
    format(file, sizeof(file), "Bans/%s.txt", name);
    new File:banfile = fopen(file, io_append);
    GetPlayerIp(id, ip, sizeof(ip));
    format(file, sizeof(file), "%s\r\n", ip);
    printf("Written: %s", file);
    fwrite(banfile, file);
    fclose(banfile);
    format(str, sizeof(str), "%s(%d) has been banned | Reason: %s", name, id, reason);
    SendClientMessageToAll(0xFF0000FF, str);
    format(str, sizeof(str), "You have been banned | Reason: %s", reason);
    SendClientMessage(id, 0xFF0000FF, str);
    SetTimerEx("BanPlayer", 200, false, "i", id);
    return 1;
}

forward BanPlayer(playerid);
public BanPlayer(playerid) return Ban(playerid);

CMD:unban(playerid, params[])
{
    if(!IsPlayerAdmin(playerid) /*&& PlayerInfo[playerid][AdminLevel] < 1*/) return SendClientMessage(playerid, 0xFF0000FF, "You must be an admin to use this command.");
    new unbanname[MAX_PLAYER_NAME];
    if(sscanf(params, "s[24]", unbanname)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /unban [name]");
    new file[40];
    format(file, sizeof(file), "Bans/%s.txt", unbanname);
    if(!fexist(file)) return SendClientMessage(playerid, 0xFF0000FF, "That player is not banned.");
    new File:banfile = fopen(file, io_read);
    new string[16], rcon[25];
    while(fread(banfile, string))
    {
        format(rcon, sizeof(rcon), "unbanip %s", string);
        SendRconCommand(rcon);
    }
    fclose(banfile);
    fremove(file);
    format(file, sizeof(file), "%s is unbanned.", unbanname);
    SendClientMessageToAll(0xFFFF00FF, file);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)