14.04.2016, 08:57
My ban command :
OnPlayerConnect
But when player logs in he gets the login dialog. He doesn't get kicked as he is banned and he don't receives msg. let me know my mistake here. Thanks
Код:
CMD:ban(playerid,params[]) { if(pInfo[playerid][pAdmin] < 0 && pInfo[playerid][pRedeemedAdmin] <= 5) return 0; new id,reason,str[80],pname[MAX_PLAYER_NAME],pname2[MAX_PLAYER_NAME]; if(sscanf(params,"ds",id,reason)) return SendClientMessage(playerid,colorexit," /ban <playerid> <reason>"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,colorexit,"Invalid playerid."); if(id == playerid) return SendClientMessage(playerid,colorexit," Invalid playerid."); if(pInfo[playerid][pAdmin] < pInfo[id][pAdmin]) return SendClientMessage(playerid,colorexit,"[ ! ] You cannot ban this player."); if(pInfo[playerid][pRedeemedAdmin] == 6) { if(pInfo[id][pAdmin] >= 1) { return SendClientMessage(playerid,colorexit," You cannot ban this player."); } } GetPlayerName(playerid,pname,sizeof(pname)); GetPlayerName(id,pname2,sizeof(pname2)); new INI:File = INI_Open(UserPath(id)); INI_SetTag(File,"data"); INI_WriteInt(File,"Banned",1); INI_Close(File); pInfo[id][pIsBan] = 1; Ban(id); format(str,sizeof(str),"%s(%d) has been banned by %s(%d) for %d",pname2,id,pname2,playerid,reason); SendClientMessageToAll(admincolor,str); return 1; }
Код:
if(pInfo[playerid][pIsBan] == 1) { SendClientMessage(playerid,colorenter,"You are banned from the server!"); return Kick(playerid); } if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","{09B086}Type your password below to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"REGISTER","{09B086}asdffadsfadf.","Register","Quit"); }