13.06.2014, 23:45
So i've created a offline ban system, now i wonder how can i create something that will sheck if the value `Banovan` is already at 1 and if it is command will not proceed.
pawn Код:
public OfflineBan(resultid, extraid, name[], razlog[])
{
new szRows, szFields, query[178], ip[17], str[128];
cache_get_data(szRows, szFields);
switch(resultid)
{
case THREAD_OFFBAN:
{
if(szRows)
{
format(query, sizeof(query), "UPDATE `Igraci` SET `Banovan` = '1' WHERE `Ime` = '%s'", name);
mysql_function_query(konekt, query, true, "OnQueryFinish", "i", THREAD_OSTALO);
GetPlayerIp(extraid, ip, sizeof(ip));
format(query, sizeof(query), "INSERT INTO `Banovi` (`Igrac`, `Admin`, `Razlog`, `Vreme`, `IP`) VALUES ('%s', '%s', '%s', '%s', '%s')", name, ImeIgraca(extraid), razlog, TimeDate(), ip);
mysql_function_query(konekt, query, true, "OnQueryFinish", "ii", THREAD_OSTALO, extraid);
format(str, sizeof(str), "Server: Admin %s je banovao(offline) racun igraca %s", ImeIgraca(extraid), name);
SAM(TOMATO, str);
}
else
{
format(query, sizeof(query), "Racun igraca '%s' ne postoji, proverite da li ste upisali ime pravilno !", name);
SCM(extraid, TOMATO, query);
}
}
}
return 1;
}