08.02.2014, 20:05
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;
}