Please Help
#1

Ok, So i am wondering if it is possible to make a /unban command which unban's both the player's IP and Name?
Reply
#2

That's of course possible use both variables in the command.
Reply
#3

Yes but say if i had a command of /unban [ID] then that would unban his ip as well? if so is there any chance you could help by posting a command? that would be great if so?
Reply
#4

Show the /ban command, and give me the ipban vaeriable.
Reply
#5

Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 3)
    {
        if(IsPlayerConnected(playerid))
        {
			new targetid,reason[105],string[128];
			if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
That is all i Have and not sure about the ip variable.
Reply
#6

Quote:
Originally Posted by Jivvles
Посмотреть сообщение
Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 3)
    {
        if(IsPlayerConnected(playerid))
        {
			new targetid,reason[105],string[128];
			if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
That is all i Have and not sure about the ip variable.
Could you please tell me where the variable is for the ban? I don't see anyone getting banned in there..
Reply
#7

This is the whole cmd
Код:
CMD:ban(playerid,params[])
{
    if(pInfo[playerid][pAdminLevel] >= 3)
    {
        if(IsPlayerConnected(playerid))
        {
			new targetid,reason[105],string[128];
			if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

            if(!IsPlayerNPC(targetid))
            {
				format(string, sizeof(string), "*"COL_RED" %s %s has banned %s"COL_WHITE" [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
				SendMessageToAllAdmins(string,-1);

				BanPlayer(targetid,reason,PlayerName(playerid));
			}
			else return SendClientMessage(playerid,-1,"*"COL_RED" You cannot ban an NPC, this has been logged and sent to the server emergency log list!");
		}
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" You do not have the right admin permissions for this command!");
	}
	return 1;
}
and I do not understand what variables you're talking about I only have stocks that have the word ban in them
Reply
#8

In your script search for "BanPlayer" and show that. Also do you use ini or mysql?
Reply
#9

I use SQL as a saving system
and this is my stock
Код:
stock BanPlayer(playerid,reason[],admin[])
{
	BanEx(playerid, reason);
	new strs[1];
	format(strs,sizeof(strs), "%s", admin);
	return 1;
}
Reply
#10

Ah okay then it's not that big of a deal. You're basically Rcon banning someone and not using any kinds of saving system for it.

In your unban command you want to do the reverse "spell" of BanEx. That is /rcon unbanip [ip]*in game. To do this in the script you have to send a rcon message and that you do by doing this: https://sampwiki.blast.hk/wiki/SendRconCommand

Example of how to send it:
pawn Код:
new string[128];
format(string, sizeof(string), "unbanip %s", ipToUnban);
SendRconCommand(string);
Just make a sscanf in your command to tell the player to insert a string ipToUnban and you're more or less done, I think this is the way I did it at least. If any questions just ask.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)