[Ajuda] Comando /ban e sscanf
#1

Tф com uma dъvida chata que nгo consigo encontrar jeito para solucionar nunca.

Criei o cуdigo de ban do meu servidor porйm quando eu coloco um id que nгo estб on ele nгo cai na mensagem "O jogador nгo estб conectado. Para banir o nick....
Код:
CMD:ban(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] < 5 && !IsPlayerAdmin(playerid))
		return SendClientMessage(playerid, COR_ERRO,"[ERRO] Vocк nгo estб permitido a utilizar este comando.");

	new motivo, giveid;
    if (sscanf(params, "u[25]s[25]", giveid, motivo))
		return SendClientMessage(playerid, COR_CINZA, "[USO] /ban [id/nome] [motivo]");

   	if(PlayerInfo[giveid][pAdmin] > 0)
    	return SendClientMessage(playerid, COR_ERRO, "[ERRO] Vocк nгo pode banir administradores.");

	if(playerid == giveid)
		return SendClientMessage(playerid, COR_ERRO, "[ERRO] Vocк nгo pode se banir.");;

	if(!IsPlayerConnected(giveid))
		return SendClientMessage(playerid, COR_ERRO, "[ERRO] Jogador nгo estб conectado. Para banir nick utilize '/bannick'.");;
			
	new ip[128], string[128], strdate[128], strtime[128];
	GetPlayerIp(giveid, ip, sizeof(ip));
	new ano, mes, dia, hora, minuto, segundo; getdate(ano, mes, dia); gettime(hora,minuto,segundo);
	format(string,sizeof(string),"[BAN] %s foi banido pelo administrador %s | Motivo: %s | Data: %d/%d/%d | Hora: %d:%d:%d.", PlayerInfo[giveid][pNome], PlayerInfo[playerid][pNome], params[2], dia, mes, ano, hora, minuto, segundo);
	SendClientMessageToAll(COR_VERMELHO, string);
	print(string);
	format(strdate, sizeof(strdate), "%d/%d/%d", dia, mes, ano);
	format(strtime, sizeof(strtime), "%d:%d:%d", hora, minuto, segundo);
	new DB_Query[250];
    mysql_format(TRBCmysql, DB_Query, sizeof(DB_Query), "INSERT INTO `bans` (`Nome`, `Admin`, `IP`, `Motivo`, `DataBan`, `HoraBan`)\
    VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", PlayerInfo[giveid][pNome], PlayerInfo[playerid][pNome], ip, params[2], strdate, strtime);
   	mysql_tquery(TRBCmysql, DB_Query);
   	SetTimerEx("KickPlayer", 500, false, "i", giveid);
	return 1;
}
Reply


Messages In This Thread
Comando /ban e sscanf - by Galhardo - 02.06.2017, 23:32
Re: Comando /ban e sscanf - by DarkBr - 03.06.2017, 00:13
Re: Comando /ban e sscanf - by Galhardo - 03.06.2017, 13:04
Re: Comando /ban e sscanf - by Laarky - 03.06.2017, 13:23
Re: Comando /ban e sscanf - by Galhardo - 03.06.2017, 14:18
Re: Comando /ban e sscanf - by GuilhermeNunes - 04.06.2017, 08:15

Forum Jump:


Users browsing this thread: 1 Guest(s)