22.02.2014, 09:04
pawn Код:
command(banex, playerid, params[]) // Offline ban command
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
SendClientMessage(playerid, COLOR_LIGHTRED, " You are now allowed to use this command!");
}
else
{
new giveplayername[24], reason[32];
if(sscanf(params, "s[24]s[32]", giveplayername, reason)) return SendClientMessage(playerid, COLOR_WHITE, " USAGE: /banex [player name] [reason]");
mysql_format(sqldb, query, sizeof(query), "SELECT * FROM accounts WHERE accname ='%e' LIMIT 0, 1", giveplayername);
mysql_tquery(sqldb, query, "BanExCB", "ss", giveplayername, reason);
}
return 1;
}
pawn Код:
forward BanExCB(playerid, giveplayername[], reason[]);
public BanExCB(playerid, giveplayername[], reason[])
{
new rows = mysql_num_rows();
if(!rows)
{
SendClientMessage(playerid, COLOR_LIGHTRED, " That player doesn't exists!");
}
else if(rows == 1)
{
if(cache_get_row_int(0, 4, sqldb) == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, " That player is allready banned!");
else if(cache_get_row_int(0, 4, sqldb) == 0)
{
mysql_format(sqldb, query, sizeof(query), "UPDATE accounts SET banvar ='1' WHERE accname ='%e'", giveplayername);
mysql_tquery(sqldb, query);
printf("DOSO DO STRINGA!");
new string[128];
printf("DOSO DO FORMATA!");
format(string, sizeof(string), " AdmCmd: Admin %s banned(Offline) %s Reason: %s", GetName(playerid), giveplayername, reason);
SendClientMessageToAll(COLOR_LIGHTRED, string);
printf(string);
}
}
return 1;
}
By that I mean it doesn't print "AdmCmd: Admin aName banned(Offline) banname, Reason: reason" it prints "AdmCmd: Admin banned(Offline) reason, Reason: