18.10.2017, 16:33
PHP код:
CMD:ban(playerid, params[])
{
new targetid, reason[200];
if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 3)
{
if(sscanf(params, "us[24]", targetid, reason)) return SendClientMessage(playerid,error, "Usage: /ban [PlayerName/Playerid] [reason]");
if(strlen(reason) < 1 || strlen(reason) > 200) return SendClientMessage(playerid, error, "Your reason can only contain 1-100 characters.");
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, error, "Player not found.");
{
pInfo[targetid][Banned] = 1;
GetPlayerIp(targetid,pIP,16);
new y,m,d,hour,mint,sec,message[300];
getdate(y,m,d);
gettime(hour,mint,sec);
// pInfo[targetid][Banned] = 1;
pInfo[targetid][Banres] = reason;
new INI:File = INI_Open(UserPath(targetid));
INI_SetTag(File,"data");
//INI_WriteString(File,"Ban Reason",reason);
INI_WriteInt(File,"Banned",1);
INI_WriteString(File,"Bannedby",GetName(playerid));
INI_Close(File);
format(message, sizeof(message), "[AdmCmd]:{FF6347}%s has been Banned from the server. | Reason: %s", GetName(targetid), reason);
SendClientMessageToAll(red, message);
SendClientMessage(targetid,red,"=====================================================");
SendClientMessage(targetid,red,"{FF6347}You have been Banned from Caribbean Mafia Warz.");
format(message, sizeof(message),"{FF6347}Banned by: %s ", GetName(playerid));
SendClientMessage(targetid,red,message);
format(message, sizeof(message),"{FF6347}Banned Reason: %s ", reason);
SendClientMessage(targetid,red,message);
format(message, sizeof(message),"{FF6347}Date: %d/%d/%d || Time: %d:%d:%d",d,m,y,hour,mint,sec );
SendClientMessage(targetid,red,message);
format(message, sizeof(message),"{FF6347}IP Address: %s", pIP);
SendClientMessage(targetid,red,message);
SendClientMessage(targetid,red,"{FF6347}You will need to take a screenshot of this message for your appeal.");
SendClientMessage(targetid,red,"{FF6347}Make an Ban Appeal on our forums. An Staff member will review it as soon as possible.");
SendClientMessage(targetid,red,"{FF6347}Visit our forums at:"SERVER_FORUMS"");
SendClientMessage(targetid,red,"=====================================================");
SendClientMessage(targetid,red,"{FF6347}Server Administrators has been notified.");
SetTimerEx("BanPlayer",200,false,"ud", targetid,2);
CommandToAdmins(playerid,"ban");
}
}
else return ShowMessage(playerid, error, 1);
return 1;
}
Quote:
In regards to the ban reason not showing, is it just the reason that doesn't show or does the entire "You are banned from this server" string not show?
Are you certain you're saving the string accordingly in the INI file? Код:
public LoadUser_data(playerid,name[],value[]) { INI_String("Reason",pInfo[playerid][Banres],200); return 1; } |
IMAGES:
https://ibb.co/i7qTy6
https://ibb.co/d2YdWR