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"); }
pInfo[id][pIsBan] = 1; new INI:File = INI_Open(UserPath(id)); INI_SetTag(File,"data"); INI_WriteInt(File,"Banned", pInfo[id][pIsBan]); INI_Close(File);
forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Banned",pInfo[playerid][pIsBan]); return 1; }
if(sscanf(params,"[COLOR="Red"]ds[/COLOR]",id,reason)) return SendClientMessage(playerid,colorexit," /ban <playerid> <reason>");
if(sscanf(params,"us[80]",id,reason)) return SendClientMessage(playerid,colorexit," /ban <playerid> <reason>");
PHP код:
Try it: PHP код:
|
printf("Userid:%i", id);
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");
}
if(pInfo[playerid][pIsBan] == 1)
{
SendClientMessage(playerid,colorenter,"You are banned from the server!");
return Kick(playerid);
}
INI_ParseFile(UserPath(playerid), "BanLoad_%s", .bExtra = true, .extra = playerid); if(fexist(UserPath(playerid))) { if(pInfo[playerid][pIsBan] == 1) { SendClientMessage(playerid,0xFF0000FF,"Banned, Good Byy); SetTimerEx("Kicksz",20,false,"d",playerid); return 1; } 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"); }
forward BanLoad_data(playerid,name[],value[]); public BanLoad_data(playerid,name[],value[]) { INI_Int("Banned",pInfo[playerid][pIsBan]); return 1; } forward Kicksz(playerid); public Kicksz(playerid) { Kick(playerid); return 1; }