Unban Command
#1

Hello, this is how i ban a user:

Код:
pInfo[targetid][pBanned] = 1;
			BanPlayer(targetid,reason,PlayerName(playerid));
How to make with that an unban cmd which unban an offline player or an online player?
Reply
#2

Check out my Tutorial

https://sampforum.blast.hk/showthread.php?tid=388612

How to ban and unban an offline player.
Reply
#3

Thanks and i have a question is timeban possible with YINI?
Reply
#4

Yep. I've done it before, you'll have to create your own ban file and ban functions though. Quite easy really.

In other words, you're creating your own custom ban system away from sa-mp's original one.
Reply
#5

I have an custom ban system and my ban command is so:

Код:
new targetid,reason[105],string[256];
			if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /ban [playerid] [reason]");
			if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat""COL_RED" Player is not online.");
			if(pInfo[targetid][pAdminLevel] > 0) return SendClientMessage(playerid,-1,""chat""COL_RED" You cannot ban an admin!");

			format(string, sizeof(string), ""chat""COL_RED" %s %s has banned %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
			SendClientMessageToAll(-1,string);
            pInfo[targetid][pBanned] = 1;
			BanPlayer(targetid,reason,PlayerName(playerid));
Can you make me the unban command for that, please? i dont have any idea how to do it that with pbanned = 0; wont work.
Reply
#6

Show me your BanPlayer function. It should only kick the player. Then under OnPlayerConnect you load his files and check if banned = 1. If so, we kick him.

What the unban command will do is just open the user's (banned) file and set Banned to 0. Thus 'unbanning' him.
Reply
#7

Try my newest include, will save you some time. Link in my signature.
Reply
#8

Ah i understand now what i have to do thanks but i have a question with offline ban:

Код:
new INI:File = INI_Open(UserPath(filestring));
i got a error:

Код:
argument type mismatch (argument 1)
Reply
#9

UserPath's first argument must be an integer. For example: UserPath(playerid).
Reply
#10

So all working, but how to make an timeban command?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)