SA-MP Forums Archive
Can anyone fix my /ban CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can anyone fix my /ban CMD (/showthread.php?tid=405496)



Can anyone fix my /ban CMD - The.Game - 06.01.2013

Код:
CMD:ban(playerid, params[])
{
	if(pInfo[playerid][Adminlevel] >= 3)
	{
	    if(PlayerLogged[playerid] == 1)
		{
		    new Target;
		    new Reason[100];
		    if(!sscanf(params, "us[50]", Target,Reason))
		    {
		    	if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Error:{FFFFFF} Invalid ID");
		    	if(Target == playerid) return SendClientMessage(playerid,red,"Error:{FFFFFF} You cannot ban yourself");
				if(pInfo[Target][Adminlevel] >= pInfo[playerid][Adminlevel]) return SendClientMessage(playerid,red,"Error:{FFFFFF} You cannot use this command on this admin");
				new tname[MAX_PLAYER_NAME];
				GetPlayerName(Target,tname,sizeof(tname));
				new pname[MAX_PLAYER_NAME];
				GetPlayerName(playerid,pname,sizeof(pname));
				new MyString[256];
				new TargetString[256];
				new bandate[3];
				getdate(bandate[0], bandate[1], bandate[2]);
				format(MyString,sizeof(MyString),"You have banned %s(%d) (Reason: %s)",tname,Target,Reason);
    format(TargetString,sizeof(TargetString),"{FF0000}Your name: {FFFFFF}%s\n{FF0000}Banned by: {FFFFFF}%s\n{FF002B}Reason: {FFFFFF}%s\n\n{FF002B}Date: {FFFFFF}%02d/%02d/%04d\n\n{FFFFFF}if you banned wrongly make unbann application at our website", tname, pname, playerid,Reason, bandate[2], bandate[1], bandate[0]);
				ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FF002B}You have been banned from this server", TargetString, "OK", "");
				SendClientMessage(playerid,red,MyString);
				new AdminsString[256];
				format(AdminsString,sizeof(AdminsString),"Administrator %s banned %s(%d) (Reason: %s)",pname,tname,Target,Reason);
				MessageToAdmins(red,AdminsString);
				BanEx(Target,Reason);
			}
		    else SendClientMessage(playerid, red, "{FFBB22}USAGE:{FFFFFF} /ban [ID] [Reason]");
    	}
		else SendClientMessage(playerid,red,"Error:{FFFFFF} You must be logged in to perform this command");
	}
	else AdminErrors(playerid, 3);
	return 1;
}
it works good
but the "Reason:" at the dialog dosnt show the reason
and it type wrong date


Re: Can anyone fix my /ban CMD - elcid7772 - 06.01.2013

format(TargetString,sizeof(TargetString),"{FF0000} Your name: {FFFFFF}%s\n{FF0000}Banned by: {FFFFFF}%s\n{FF002B}Reason: {FFFFFF}%s\n\n{FF002B}Date: {FFFFFF}%02d/%02d/%04d\n\n{FFFFFF}if you banned wrongly make unbann application at our website", tname, pname,Reason, bandate[2], bandate[1], bandate[0]);


You added "playerid" needlessly.