Problem with an unban cmd
#8

I don't really know how to use non threaded queries so this code is a threaded query example:

pawn Код:
CMD:aunban(playerid, params[])
{
    if(pInfo[playerid][Admin] < 70)
        return SendClientMessage(playerid, Rouge,"La commande entrйe est inconnue !");
       
    new nom[24], string[128], 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 `Bannis` = '1' AND `Username` = '%s' LIMIT 1", nom);
    mysql_tquery(mysql, query, "OnPlayerRequestUnbanData","is",playerid,nom);
    return 1;
}

forward OnPlayerRequestUnbanData(playerid,nom[]);
public OnPlayerRequestUnbanData(playerid,nom[])
{
    new string[128], query[128];
    if(!cache_get_row_count())
    {
        SendClientMessage(playerid, Rouge, "Ce joueur n'est pas bannis !");
        return 1;
    }

    mysql_format(mysql, query, sizeof(query),"UPDATE `joueurs` SET `Bannis` = '0' WHERE `Username` = '%e'", nom);
    mysql_tquery(mysql, query, "","");
    GetPlayerName(playerid, joueuremetteur, sizeof(joueuremetteur));
    format(string, sizeof(string), "%s a unban %s.", joueuremetteur, nom);
    ChannelAdmin(Rouge, string);
    return 1;
}
Reply


Messages In This Thread
Problem with an unban cmd - by anou1 - 08.02.2014, 16:05
Re: Problem with an unban cmd - by CuervO - 08.02.2014, 16:26
Re: Problem with an unban cmd - by anou1 - 08.02.2014, 16:35
Re: Problem with an unban cmd - by CuervO - 08.02.2014, 16:39
Re: Problem with an unban cmd - by anou1 - 08.02.2014, 17:26
Re: Problem with an unban cmd - by CuervO - 08.02.2014, 17:41
Re: Problem with an unban cmd - by anou1 - 08.02.2014, 18:28
Re: Problem with an unban cmd - by CuervO - 08.02.2014, 20:05
Re: Problem with an unban cmd - by anou1 - 08.02.2014, 20:10

Forum Jump:


Users browsing this thread: 4 Guest(s)