Checking if player is banned
#1

Hey, i've been working on a command to check if a player is banned or not
This is how i have set it out:
pawn Код:
ACMD:banned(playerid, params[])
{
    if (pInfo[playerid][Adminlevel] < 2)return 0;
    new targetid, str[128];
    if(sscanf(params,"u",targetid)) return SCM(playerid, orange, "--- /unban <Name>---");
    new INI:file = INI_Open(Path(targetid));
    INI_SetTag(file, "Player's Data");
    if(pInfo[playerid][Banned]==1)
    format(str, sizeof(str), "%s is banned", GetName(targetid));
    SCM(playerid, red, str);
    return 1;
}
When i type nothing happens, justs puts a blank message on chat, and if you are able to, if possible, add a bit where if player is not banned then it says to the admin, "Player is not banned"
Reply
#2

Код:
ACMD:banned(playerid, params[])
{
    if (pInfo[playerid][Adminlevel] < 2)return 0;
    new targetid, str[128];
    if(sscanf(params,"u",targetid)) return SCM(playerid, orange, "--- /unban <Name>---");
    new INI:file = INI_Open(Path(targetid));
    INI_SetTag(file, "Player's Data");
    if(pInfo[targetid][Banned]==1)
    format(str, sizeof(str), "%s is banned", GetName(targetid));
    SCM(playerid, red, str);
    return 1;
}
Try this out.
Reply
#3

It is now showing up as Unknown Command when i type /banned name
Reply
#4

Well, since a player is banned, you cannot type targetid since he cannot join the server, you need to make other configurations.
Reply
#5

How the ban's file looks like?
Reply
#6

Couldn't this help ?
Код:
INI_Int("Banned",pInfo[playerid][Banned]);
Reply
#7

First of all you are opening a file doing nothing useful, secondly how are you gonna type the banned player ID if he's not even online? (considering he's banned)
Reply
#8

You type the name of the player, it checks if he is banned or not, then sends a message back to the admin, It is possible, I just don't know how to do it
Reply
#9

What if you make a cmd like this:
-/banned (playername)
-Server opens INI file of the playername given by the admin
-checked if banned is true (if it is a boolean)
-returns message to the admin

I bet you have enough scripting knowledge to make something like this? The posters before me already told yo that you cannot use a playerid to execute this command since he's not connected to the server.
Reply
#10

Oh, I see I was using playerid in pInfo I will have a look when I am back at my computer, thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)