18.10.2017, 05:11
Ok so im trying to improve the ban system, anyways these are the issues that i'm currently having, I want to make it that when a player connects and they are banned it will show the reason why they are banned but when i tried to do it , it doesn't work...
Another issue is why does my unban command creates another line called Ban Reason instead of editing the one which is currently already in the .ini because the banned by edits the old one but the Ban reason creates a new line..
And how can i make it case sensitive.
PHP код:
enum PlayerInfo
{
Banres[200]
}
new pInfo[MAX_PLAYERS][PlayerInfo];
public LoadUser_data(playerid,name[],value[])
{
INI_String("Reason",pInfo[playerid][Banres],200);
return 1;
}
if(pInfo[playerid][Banned] == 1)
{
new reso[128];
SendClientMessage(playerid,red,"=====================================================");
SendClientMessage(playerid,red, "{FF6347}You are banned from this server.");
SendClientMessage(playerid,red,"{FF6347}Make an Ban Appeal on our forums. An Staff member will review it as soon as possible.");
SendClientMessage(playerid,red,"{FF6347}Visit our forums at: "SERVER_FORUMS"");
format(reso,sizeof(reso),"{85BB65}Reason: {f0f000}%s",pInfo[playerid][Banres]);
SendClientMessage(playerid,-1,reso);
SendClientMessage(playerid,red,"=====================================================");
SendClientMessage(playerid,red, "[AdmCmd]:{FF6347}This Account has been banned from the server.");
PHP код:
CMD:unban(playerid, params[])
{
if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 3)
{
new Name[25],file[256];
if(sscanf(params, "s[24]", Name)) return SendClientMessage(playerid, error, "Usage: /unban <Player Name>"); format(file, 100, PATH, Name);
if (!fexist(file)) return SendClientMessage(playerid,error,"Error: This player doesn't have an account!");
new INI:File = INI_Open(file);
INI_SetTag(File,"data");
INI_WriteInt(File,"Banned",0);
INI_WriteString(File,"Bannedby","");
INI_WriteString(File,"Ban Reason","");
INI_Close(File);
format(astring, sizeof(astring),"You have successfully unbanned '%s'",Name);
SendClientMessage(playerid,-1,astring);
format(astring,sizeof(astring),"[UNBAN] %s has UNBANNED Account: %s",GetName(playerid),Name);
WriteToLog(astring,"Unban");
CommandToAdmins(playerid,"unban");
return 1;
}
else return ShowMessage(playerid, error, 1);
}