OnPlayerConnect Ban kicker. -
zionx08 - 04.12.2012
i scripted a account ban kicker but didn't works.can help me solve to make this works.
And i put this under my OnPlayerConnect
pawn Код:
if(PlayerInfo[playerid][pBan] >= 1)
{
new id,string2[124], string1[125];
format(string2, sizeof(string2), "SERVER:You Have been kicked.Reason:Account Still Banned.");
SendClientMessage(playerid,COLOR_RED,string2);
format(string1, sizeof(string1), "SERVER:%s Have been kicked.Reason:Account Still Banned.", GetPlayerNameEx(id));
SendClientMessageToAll(COLOR_RED,string1);
Kick(id);
return 1;
}
Re: OnPlayerConnect Ban kicker. -
Bicentric - 04.12.2012
Probably because the 'pBan' variable is set to 0, are you getting a value from the player file first?
Re: OnPlayerConnect Ban kicker. -
RajatPawar - 04.12.2012
This may work..
pawn Код:
if(PlayerInfo[playerid][pBan] == 1)
{
new string[128];new pname[MAX_PLAYER_NAME];
SendClientMessage(playerid,COLOR_RED,"SERVER: You have been kicked! Reason: Your account is still banned.);
format(string, sizeof(string), "SERVER: %s Have been kicked. REASON: Account Still Banned.", GetPlayerName(playerid,pname,sizeof(pname)));
SendClientMessageToAll(COLOR_RED,string);
Kick(playerid);
}
Re: OnPlayerConnect Ban kicker. -
Nirzor - 04.12.2012
first get the players name variable then you have to do BanEx(); then Kick the player with the message or just
get names and bla bla and kick then it should work perfectly or there must be something wrong with the ini write or
yours which can't get to the ban oh almost forgot If(FoundInBanDatabase) you have varible write your ban database
name in it to search for bans so it detects if the ban is running or not and if player is ban on your command give
pBan[playerid] = 1; hope it helped you
Re: OnPlayerConnect Ban kicker. -
zionx08 - 04.12.2012
Quote:
Originally Posted by Bicentric
Probably because the 'pBan' variable is set to 0, are you getting a value from the player file first?
|
Yeah im getting value from user file.
Re: OnPlayerConnect Ban kicker. -
zionx08 - 04.12.2012
Quote:
Originally Posted by Rajat_Pawar
This may work..
pawn Код:
if(PlayerInfo[playerid][pBan] == 1) { new string[128];new pname[MAX_PLAYER_NAME]; SendClientMessage(playerid,COLOR_RED,"SERVER: You have been kicked! Reason: Your account is still banned.); format(string, sizeof(string), "SERVER: %s Have been kicked. REASON: Account Still Banned.", GetPlayerName(playerid,pname,sizeof(pname))); SendClientMessageToAll(COLOR_RED,string); Kick(playerid); }
|
I add that in OnPlayerConnect and the result is it doesnt works.
Or Any idea to put it in other place ?
Re: OnPlayerConnect Ban kicker. -
cosbraa - 04.12.2012
Where does the players file get loaded?
Do this after the players file is loaded.
Re: OnPlayerConnect Ban kicker. -
zionx08 - 04.12.2012
Quote:
Originally Posted by Nirzor
first get the players name variable then you have to do BanEx(); then Kick the player with the message or just
get names and bla bla and kick then it should work perfectly or there must be something wrong with the ini write or
yours which can't get to the ban oh almost forgot If(FoundInBanDatabase) you have varible write your ban database
name in it to search for bans so it detects if the ban is running or not and if player is ban on your command give
pBan[playerid] = 1; hope it helped you
|
Can give me an example? Because i'm still confused about what you typed.
Re: OnPlayerConnect Ban kicker. -
zionx08 - 04.12.2012
Quote:
Originally Posted by cosbraa
Where does the players file get loaded?
Do this after the players file is loaded.
|
you mean load from this?
pawn Код:
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPassword]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Ban",PlayerInfo[playerid][pBan]);
INI_Int("Warnings",PlayerInfo[playerid][pWarns]);
INI_Int("SkinID", PlayerInfo[playerid][pSkin]);
return 1;
}
Re: OnPlayerConnect Ban kicker. -
Bicentric - 04.12.2012
Quote:
Originally Posted by zionx08
Yeah im getting value from user file.
|
By this I mean you're probably checking if they're banned before you're actually loading their data, therefore the value is set to 0.