Banned user message bug -
Nathan_Taylor - 06.03.2013
So, I have the following code in onPlayerConnect();
pawn Код:
if(pInfo[playerid][Banned] == 0){
ShowDialog(playerid, DIALOG_EXISTINGPLAYER);
} else {
new banstring[128];
new allmessage[128];
format(banstring, sizeof(banstring), "You were banned from this server for: %s", pInfo[playerid][Reason]);
format(allmessage, sizeof(allmessage), "%s tried to login but is banned!", pInfo[playerid][Name]);
SendClientMessage(playerid, COLOR_RED, banstring);
SendClientMessageToAllBut(playerid, COLOR_RED, allmessage);
Kick(playerid);
}
However, when the banned user logs in, it kicks them before the sending them the message. If I comment out the line "Kick(playerid);", The "banstring" message is displayed to the banned user. I know a timer would probably do the trick, but I don't know how to set one up, have never used one. Any ideas guys?
Re: Banned user message bug -
DaRk_RaiN - 06.03.2013
pawn Код:
if(pInfo[playerid][Banned] == 0){
ShowDialog(playerid, DIALOG_EXISTINGPLAYER);
} else {
new banstring[128];
new allmessage[128];
format(banstring, sizeof(banstring), "You were banned from this server for: %s", pInfo[playerid][Reason]);
format(allmessage, sizeof(allmessage), "%s tried to login but is banned!", pInfo[playerid][Name]);
SendClientMessage(playerid, COLOR_RED, banstring);
SendClientMessageToAllBut(playerid, COLOR_RED, allmessage);
SetTimerEx("Kicks",1000,false,"i",playerid);
}
Put this under the command (not in it)
pawn Код:
forward Kicks(playerid);
public Kicks(playerid)
{
Kick(playerid);
}
Re: Banned user message bug -
SilverKiller - 06.03.2013
Simple :
Change this
To :
pawn Код:
SetTimerEx("KickPlayer", 1000, false, "i", playerid);
In the bottom of your GameMode :
pawn Код:
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}
EDIT : I just realized i'm stupid in writing fast
Re: Banned user message bug -
Falcon. - 06.03.2013
pawn Код:
banEx(playerid, const reason[])
{
SendClientMessage(playerid, -1, reason);
SetTimerEx("call_banEx", 200, false, "i", playerid);
return 0x01;
}
forward call_banEx(p_); public call_banEx(p_) return Ban(p_);
pawn Код:
if(pInfo[playerid][Banned] == 0) ShowDialog(playerid, DIALOG_EXISTINGPLAYER);
else
{
new banstring[128];
format(banstring, sizeof(banstring), "You were banned from this server for: %s", pInfo[playerid][Reason]);
banEx(playerid, banstring);
format(banstring, sizeof(banstring), "%s tried to login but is banned!", pInfo[playerid][Name]);
SendClientMessageToAllBut(playerid, COLOR_RED, banstring);
}
Re: Banned user message bug -
Nathan_Taylor - 06.03.2013
Thanks all