SA-MP Forums Archive
[Ajuda] NГO APARECE O MOTIVO DO BAN - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] NГO APARECE O MOTIVO DO BAN (/showthread.php?tid=506158)



NГO APARECE O MOTIVO DO BAN - lekinho911 - 12.04.2014

Eu boto o motivo que a pessoa foi banida e nгo aparece alguem sabe ageitar ?
Код:
dcmd_tempban(playerid,params[])
{
	if(Player[playerid][pAdmin] < 1)
		return 0; // idx
	else
	{
		new tmp[256],tmp2[256],Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		new tmp3[256];
		tmp3 = strtok(params,Index);

		if(!strlen(tmp)||!strlen(tmp2) || !strlen(tmp3))
			return SendClientMessage(playerid,COR_USOCORRETO,"Uso: /tempban [id] [dias] [motivo]");

		new id;

		if(!IsNumeric(tmp))
			id = ReturnPlayerID(tmp);
		else
			id = strval(tmp);

		if(strval(tmp2) > 999)
		    return SendClientMessage(playerid, COR_ERRO, "ERRO: Mбximo de dias: 999");

        if(Player[playerid][DelayBan] == true)
		    return SendClientMessage(playerid, COR_ERRO, "ERRO: Aguarde um instante para poder banir alguйm novamente.");

		if(!IsPlayerConnected(id) && id != INVALID_PLAYER_ID)
			return SendClientMessage(playerid,COR_ERRO,"ERRO: Jogador nгo conectado.");
		else
		{
		  	BanExtend(playerid, id,  params[strlen(tmp3)+strlen(tmp2)+2], strval(tmp2));

            Player[playerid][DelayBan] = true;
			SetTimerEx("TimerBan", 1000, 0, "i", playerid);

			return 1;
		}
	}
}



Re: NГO APARECE O MOTIVO DO BAN - Stroon - 12.04.2014

Peguei aqui da minha GM, Tenta adaptar!
pawn Код:
new reason[64];
new str[128];
pawn Код:
format(str, sizeof(str), "[Admin] O(a) administrador(a) %s baniu o(a) jogador(a) %s  (Motivo: %s) ",  aname,pname, reason);



Re: NГO APARECE O MOTIVO DO BAN - lekinho911 - 12.04.2014

Nгo pegou olha a public
Код:
forward BanExtend(playerid,id, reason[], days);  //funзгo de ban
public BanExtend(playerid,id, reason[], days)
{
new reason[64];
	if(Player[playerid][pAdmin] < 1)
	    return 0;

	Server[Bans] += 1;
	//if(strlen(reason) > 30 || InvalidBanCharacters(reason))
	format(reason, strlen(reason),"N/A");

	new string[256];

	if(!days)
		format(string, 256,"-GFInfo-: %s foi banido pelo %s %s | Motivo: %s",getPName(id), AccountName(playerid), getPName(playerid),reason);
	else
		format(string, 256,"-GFInfo-: %s foi banido pelo %s %s | Tempo: %d dias | Motivo: %s",getPName(id), AccountName(playerid), getPName(playerid), days, reason);


	SendClientMessageToAll(COR_RED,string);


	new playerip[24];
	GetPlayerIp(id, playerip, sizeof(playerip));
	new banfile[256];

	banfile = GetBannedFile(id);

	new hour, minute, second, day, month, year;
	gettime(hour, minute, second);
	getdate(year, month, day);

	DOF2_CreateFile(banfile);

	DOF2_SetString(banfile,"PlayerName", getPName(id));
	if(days)
	{
		DOF2_SetInt(banfile,"BanTime", Now()+ONE_DAY*days);
 		DOF2_SetInt(banfile,"BanDays", days);
	}

	new str[52];
	format(str,52,"Admin %s", getPName(playerid));
	DOF2_SetString(banfile,"AdminName", str);


	DOF2_SetString(banfile,"Motivo", reason);

	format(string, sizeof(string), "%02d/%02d аs %02d:%02d", day, month, hour, minute);
	DOF2_SetString(banfile,"Data", string);
    DOF2_SaveFile();

	if(Player[id][pLogged]) // se o jogador tiver uma conta
	{
		new banfile2[256];
		format(banfile2,256,BANIDOS(getPName(id)));
		DOF2_CreateFile(banfile2);
		if(days)
		{
			DOF2_SetInt(banfile2,"BanTime", Now()+ONE_DAY*days);
   			DOF2_SetInt(banfile2,"BanDays", days);
		}
	 	DOF2_SetString(banfile2,"AdminName", str);
		DOF2_SetString(banfile2,"Motivo", reason);
		DOF2_SetString(banfile2,"Data", string);
		DOF2_SaveFile();
	}

	SendClientMessage(id,COR_BARRAS,"-GF- Informaзхes importantes sobre o Ban:");
	format(string, 128,"-GF- Nick: %s - Admin: %s - Motivo: %s", getPName(id), getPName(playerid), reason);
	SendClientMessage(id, COR_ORANGE,string);
	format(string, 128,"-GF- Data: %02d/%02d/%d - IP: %s  (Salve Esses Dados)",day, month, year, playerip);
	SendClientMessage(id, COR_ORANGE,string);
	return Kick(id);
}