Код:
YCMD:offban(playerid, params[])
{
new ime[24], razlog[64];
if(Ulogovan[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Niste ulogovani!");
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_RED, "(Greska!) {646464}Niste Administrator!");
if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_RED, "(Greska!) {646464}Morate biti Admin level 1337+!");
if(sscanf(params, "s[24]s[64]", ime, razlog)) return SendClientMessage(playerid, COLOR_GREY, "Koristite: /offban [Ime_Prezime igraca] - Unos je osjetljiv na mala i velika slova!");
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
new query[256];
mysql_format(SQL_konekcija, query, sizeof query, "SELECT * FROM `korisnici` WHERE `pNick` = '%s'", ime);
mysql_function_query(SQL_konekcija, query, false, "SendQuery", " ");
mysql_store_result();
if(mysql_num_rows == 0)
{
SendClientMessage(playerid, COLOR_RED, "(Greska!) {646464}Uneseno ime ne postoji u bazi podataka!");
mysql_free_result();
return 1;
}
else if(mysql_num_rows() != 0)
{
new hh, mm, gg, mj, dd, hhs[5], mms[5], dds[5], mjs[5], name[MAX_PLAYER_NAME];
mysql_free_result();
RPIme(playerid, name);
gettime(hh, mm);
getdate(gg, mj, dd);
if(hh < 10) format(hhs, 5, "0%d", hh);
else format(hhs, 5, "%d", hh);
if(mm < 10) format(mms, 5, "0%d", mm);
else format(mms, 5, "%d", mm);
if(dd < 10) format(dds, 5, "0%d", dd);
else format(dds, 5, "%d", dd);
if(mj < 10) format(mjs, 5, "0%d", mj);
else format(mjs, 5, "%d", mj);
new query1[256], vrijeme[16], datum[16], stringa[128], string[128];
format(query1, sizeof(query1), "UPDATE `korisnici` SET `pBanovan` = '1', `pBanRazlog` = '%s', `pBanVrijeme` = '%s', `pBanDatum` = '%s' WHERE `pNick` = '%s'", razlog, vrijeme, datum, ime);
mysql_function_query(SQL_konekcija, query1, false, "SendQuery", " ");
SCMF(playerid, 0xE61E00FF, "Iskljucili/banovali ste igraca %s sa servera. Razlog: %s", ime, razlog);
SCMF(playerid, 0xE61E00FF, "Datum:{FFFFFF} %d - %d - %d{E61E00} | Vrijeme: {FFFFFF}%d:%d {E61E00}", dd, mj, gg, hh, mm);
SendClientMessage(playerid, 0xE61E00FF, "Uslikajte ovo i postavite u temu Popis banova na {FFFFFF}"weburl"!");
format(stringa, sizeof stringa, "BAN | %s | Admin: %s", ime, name);
SendClientMessageToAll(0xE61E00FF, stringa);
format(string, sizeof string, "{E61E00}|BAN| Admin:{FFFFFF} %s {E61E00}| Igrac: {FFFFFF}%s{E61E00} | Razlog: {FFFFFF}%s", name, ime, razlog);
SendAdminMessage(0xE61E00FF, string);
}
}
return 1;
}