Need help with ban command -
Biess - 01.02.2013
pawn Код:
public OnPlayerConnect(playerid) {
{
if(PInfo[playerid][Banned] == 1){
SendClientMessage(playerid, 0xFF444499, "You are banned from this server if this is a mistake appeal at our forums");
Kick(playerid);
}
}
SendClientMessage(playerid,red,"Welcome to United Kingdom TDM! Dont forget to check /updates ! ");
SendClientMessage(playerid,GREEN,"Remember to /buyrank to buy a rank ");
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "** %s has joined United Kingdom TDM", name);
IsOnAdminDuty[playerid] = false;
PInfo[playerid][Money] = 0;
PInfo[playerid][Score] = 0;
PInfo[playerid][Kills] = 0;
PInfo[playerid][Deaths] = 0;
PInfo[playerid][Level] = 0;
PInfo[playerid][Rank] = 0;
SendClientMessageToAll(-1, string);
PMEnabled[playerid] = 1;
IsMuted[playerid] = 0;
TogglePlayerSpectating(playerid, false);
new file[64],PlayerName[25];//Creating a variable where we can store the file path, and the variable to store the player's name.
GetPlayerName(playerid,PlayerName,sizeof PlayerName);//Storing the players name in the PlayerName variable.
format(file,sizeof file,"Admin/%s.ini",PlayerName);//Storing the file path with the players name.
if(fexist(file)) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login Below", "Enter Your Password To Login!", "Login", "Quit");
} else {
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register Below", "Enter A Password To Register And Play!", "Register", "Quit");
}
return 1;
}
I'm having trouble with the ban command when i use /ban it works fine it sets the variable to 1 and when i connect it says you are banned but then when i set the variable 0 in my charachter file and reconnect it still shows that message.
Re: Need help with ban command -
Alternative112 - 01.02.2013
You aren't getting the person's ban information yet - you need to open the person's character file and assign something to PInfo[playerid][Banned] before you check it to see if they're banned or not.
Код:
new filename[64], name[24];
GetPlayerName(playerid, name, sizeof(name));
format(filename, sizeof(fiilename), "/scriptfiles/players/%s.txt", name);
if(fexist(filename)) {
new lines_read = 0;
new File:f = fopen(filename, io_read); //open file
while(fread(f, line)) //read from file {
switch(lines_read) {
case 0: //This is the first line in the file, change it to whatever the line number the ban number is on. {
PInfo[playerid][Banned] =
}
}
}
fclose(f);
}
if(PInfo[playerid][Banned] == 1){
SendClientMessage(playerid, 0xFF444499, "You are banned from this server if this is a mistake appeal at our forums");
Kick(playerid);
}
I'll let you figure out the rest.
Re: Need help with ban command -
Biess - 02.02.2013
That doesn't work at ALL i had to figure out thousand of errors.. please post something simulair to my script btw i use SII include
INI_Open(file);
INI_Save();
INI_Close();
Re: Need help with ban command -
iDrEaMzZxo - 02.02.2013
Hmm, What Alternative said you fix the problem, but it didn't there is no other solution i guess.
Re: Need help with ban command -
Biess - 02.02.2013
What?
Re: Need help with ban command - T0pAz - 02.02.2013
Put this code when you (un)ban the player.
pawn Код:
SendRconCommand("reloadbans");
Re: Need help with ban command -
Biess - 02.02.2013
The ban doesn't save in the samp.ban file..
It sets the player variable banned to 1 and kicks the player.
However i want it to return a message like
"You have been banned from this server if this is a mistake appeal at our forums."
But when i set the variable to 0 in the charachter file it still shows the message unless i restart the server.
Second i dont have a unban command.
Re: Need help with ban command -
Biess - 03.02.2013
Bumb
Re: Need help with ban command -
Biess - 04.02.2013
Bumb
Re: Need help with ban command -
Threshold - 04.02.2013
Well first of all, you should really be LOADING the player variables BEFORE you start using them... as for setting the variables in the player's file, in some cases, it will require you to restart the server before any changes are actually made.