How could I ? [mysql]
#4

I don't understand why are u speaking about ban someone^^
I just want to return something if a Username doesn't exist in the database. I did this. Now it work.


But even if the player is not banned, it say that he has been unbanned.


Код:
public OnEssaiUnban(playerid, nom[])
{
    new string[128], query[128];
    if(!cache_get_row_count())
    {
        SendClientMessage(playerid, Rouge, "Ce joueur n'existe pas !");
        return 1;
    }

	mysql_format(mysql, query, sizeof(query), "SELECT * FROM `joueurs` WHERE `Bannis`='1' AND `Username`='%s' LIMIT 1", nom);
	mysql_tquery(mysql, query, "", "");
	if(!cache_get_row_count()) // This part doesn't work. It should return that the player isnt banned when I try to unban someone who isn't banned.
    {
        SendClientMessage(playerid, Rouge, "Ce joueur n'est pas bannis !");
        return 1;
    }
    mysql_format(mysql, query, sizeof(query),"UPDATE `joueurs` SET `Bannis` = '0', `RaisonBan`='' WHERE `Username` = '%e'", nom);
    mysql_tquery(mysql, query, "", "");
    GetPlayerName(playerid, joueuremetteur, sizeof(joueuremetteur));
    format(string, sizeof(string), "[Admin]:%s a unban %s.", joueuremetteur, nom);
    ChannelAdmin(Rouge, string);
    return 1;
}
Код:
CMD:aunban(playerid, params[])
{
    if(pInfo[playerid][Admin] >= 70)
	{
		new nom[24], query[128];
		if(sscanf(params,"s[24]", nom)) return SendClientMessage(playerid, Gris, "/aunban [Nom_Prйnom du joueur]");
		format(query, sizeof(query), "SELECT * FROM `joueurs` WHERE `Username` = '%s' LIMIT 1", nom);
		
		mysql_tquery(mysql, query, "OnEssaiUnban","is", playerid, nom);
		return 1;
	}
	return SendClientMessage(playerid, Rouge,"La commande entrйe est inconnue !");
}
Reply


Messages In This Thread
How could I ? [mysql] - by anou1 - 09.02.2014, 20:31
Re: How could I ? [mysql] - by anou1 - 10.02.2014, 07:34
Re: How could I ? [mysql] - by Yashas - 10.02.2014, 08:16
Re: How could I ? [mysql] - by anou1 - 10.02.2014, 08:48
Re: How could I ? [mysql] - by SwisherSweet - 10.02.2014, 08:52
Re: How could I ? [mysql] - by anou1 - 10.02.2014, 09:03
Re: How could I ? [mysql] - by SwisherSweet - 10.02.2014, 09:04
Re: How could I ? [mysql] - by anou1 - 10.02.2014, 09:08
Re: How could I ? [mysql] - by SwisherSweet - 10.02.2014, 09:10
Re: How could I ? [mysql] - by Konstantinos - 10.02.2014, 09:51

Forum Jump:


Users browsing this thread: 1 Guest(s)