How can I do this?
#1

Hello friends I would like to know how to make an anti ban system by names.

Example: Jhon_Miller can not be banned
Reply
#2

What did you try so far? Because asking for the code isn't the way to go, I will tell you one possible aproach, if you want specific by name then check if the name of the player matches Jhon_Miller, you can use https://sampwiki.blast.hk/wiki/Strcmp if the player's name matches Jhon_Miller then return a message or whatever you want.

You can also check if the player is a higher admin by getting the admin level of the current admin trying to ban the player and the admin level of the player then compare them.

You can do all of this under the /ban command or in a function if you'd like.

Try something and come back with a reply.
Reply
#3

You could just have an array of names that shouldn't be banned like:

new doNotBanList[] = { "Jhon_Miller", "Harry_Potter", "Stephen_Hawking", "Donald_Trump" };

(been a while since I've used PAWN, might not be correct way to create array)

Then in your ban method or wherever you handle that logic, you can just loop through that array and see if the name matches any in the array. If it does match, then don't ban them.
Reply
#4

Sorry if it's in Spanish, I'm Spanish but that's the command.
Reply
#5

Okay well can't you figure out what to do after our comments? You can't just expect us to do it for you because you won't learn that way.
Reply
#6

It is that I have already tried but still I am still banned
Код:
 new NombreP[MAX_PLAYER_NAME]; 
GetPlayerName(giveplayerid, NombreP, sizeof(NombreP));
if(strcmp(NombreP, "Jhon_Miller", true) == 0) return SendClientMessage(playerid, -1, "No puedes banear a ese usuario.");
Reply
#7

Do you mean 'playerid' and not 'giveplayerid' in GetPlayerName(giveplayerid, NombreP, sizeof(NombreP)); ?

You can try printing the value of NombreP to make sure it has got the right player name.
Reply
#8

Name checks the name of the player and if the name is Jhon_Miller Not ban
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)