Checking if player is banned -
LeXuZ - 03.12.2014
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"
Re: Checking if player is banned -
iManakoss - 03.12.2014
Код:
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.
Re: Checking if player is banned -
LeXuZ - 03.12.2014
It is now showing up as Unknown Command when i type /banned name
Re: Checking if player is banned -
iManakoss - 03.12.2014
Well, since a player is banned, you cannot type targetid since he cannot join the server, you need to make other configurations.
Re: Checking if player is banned -
Raweresh - 03.12.2014
How the ban's file looks like?
Re: Checking if player is banned -
LeXuZ - 03.12.2014
Couldn't this help ?
Код:
INI_Int("Banned",pInfo[playerid][Banned]);
Re: Checking if player is banned -
Beckett - 03.12.2014
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)
Re: Checking if player is banned -
LeXuZ - 03.12.2014
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
Re: Checking if player is banned -
xCrazyMonkey - 04.12.2014
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.
Re: Checking if player is banned -
LeXuZ - 04.12.2014
Oh, I see I was using playerid in pInfo I will have a look when I am back at my computer, thank you