Problem with login -
ShoortyFl - 22.06.2014
So im re-desinging a ban system, and now i got a problem.
When I check on OnPlayerConnect if player is banned it should redirect me to Thread_BanInfo but it doesn't.
This the system for these two.
This is under OnPlayerConnect
Код:
format(gQuery, sizeof(gQuery), "SELECT * FROM `Banovi` WHERE `Name` = '%s'", Name(playerid));
mysql_tsquery(gQuery, THREAD_BANINFO, playerid, konekt);
this is the thread.
pawn Код:
case THREAD_BANINFO:
{
if(szRows > 0)
{
new query[512], szValue[65], hIme[MAX_PLAYER_NAME], hRazlog[65], istice, vrsta, str[650];
cache_get_field_content(0, "Ime", hIme, konekt, MAX_PLAYER_NAME);
cache_get_field_content(0, "Razlog", hRazlog, konekt, 64);
cache_get_field_content(0, "Istice", szValue, konekt); istice = strval(szValue);
cache_get_field_content(0, "Vrsta", szValue, konekt); vrsta = strval(szValue);
if(gettime() - istice > 0 && vrsta == BAN_VREMENSKI)
{
SCM(extraid, LIGHTBLUE, " (info) {FFFFFF}Vas ban je istekao, mozete nastaviti sa igrom na serveru !");
format(query, sizeof(query), "DELETE * FROM `Banovi` WHERE `Name` = '%s'", Name(extraid));
mysql_tsquery(query, THREAD_OSTALO, extraid, konekt);
format(query, sizeof(query), "UPDATE `Igraci` SET `Banovan` = '0' WHERE `Name` = '%s'", Name(extraid));
mysql_tsquery(query, THREAD_OSTALO, extraid, konekt);
format(query, sizeof(query), "SELECT * FROM `Igraci` WHERE `Name` = '%s'", Name(extraid));
mysql_tsquery(query, THREAD_NALOGPROVERA, extraid, konekt);
}
else
{
format(str, sizeof(str), "Vi ste banovani sa Roleplay Factory Servera !\n\nVase Ime: %s\nRazlog: %s.\nVrsta Bana: %s.\nIstice: %s.", ImeIgraca(extraid), hRazlog, GetBanType(vrsta), gettimestamp(istice, 3));
SPD(extraid, 0, DIALOG_STYLE_MSGBOX, "Ban Informacije", str, "Uredu", "");
}
}
else
{
new squery[600];
format(squery, sizeof(squery), "SELECT * FROM `Igraci` WHERE `Name` = '%s'", Name(extraid));
mysql_tsquery(squery, THREAD_NALOGPROVERA, extraid, konekt);
}
}
Re: Problem with login -
ShoortyFl - 22.06.2014
Now i managed it to work but it wont load the ban, even thought it saves the variables, this is the OnPlayerConnect
pawn Код:
format(gQuery, sizeof(gQuery), "SELECT * FROM `Banovi` WHERE `IP_Adresss` = '%s'", ImeIgraca(playerid));
mysql_function_query(konekt, gQuery, true, "OnQueryFinish", "ii", THREAD_BANINFO, playerid);
pawn Код:
switch(resultid)
{
case THREAD_BANINFO:
{
if(szRows)
{
new query[512], szValue[65], hIme[MAX_PLAYER_NAME], hRazlog[65], istice, vrsta, str[650];
cache_get_field_content(0, "Ime", hIme, konekt, MAX_PLAYER_NAME);
cache_get_field_content(0, "Razlog", hRazlog, konekt, 64);
cache_get_field_content(0, "Istice", szValue, konekt); istice = strval(szValue);
cache_get_field_content(0, "Vrsta", szValue, konekt); vrsta = strval(szValue);
if(gettime() - istice > 0 && vrsta == BAN_TIME)
{
SCM(extraid, LIGHTBLUE, " (info) {FFFFFF}You are now unbanned !");
format(query, sizeof(query), "DELETE * FROM `Banovi` WHERE `Name` = '%s'", Name(extraid));
mysql_function_query(konekt, query, true, "OnQueryFinish", "i", THREAD_OSTALO);
format(query, sizeof(query), "UPDATE `Igraci` SET `Banovan` = '0' WHERE `Name` = '%s'", Name(extraid));
mysql_function_query(konekt, query, true, "OnQueryFinish", "i", THREAD_OSTALO);
format(gQuery, sizeof(gQuery), "SELECT * FROM `Igraci` WHERE `Name` = '%s'", Name(extraid));
mysql_function_query(konekt, gQuery, true, "OnQueryFinish", "ii", THREAD_NALOGPROVERA, extraid);
}
else
{
format(str, sizeof(str), "You are banned from this server!\n\nVase Ime: %s\nRazlog: %s.\nVrsta Bana: %s.\nIstice: %s.", ImeIgraca(extraid), hRazlog, GetBanType(vrsta), gettimestamp(istice, 3));
SPD(extraid, 0, DIALOG_STYLE_MSGBOX, "Ban Informacije", str, "Uredu", "");
Kick(extraid);
}
}
else
{
format(gQuery, sizeof(gQuery), "SELECT * FROM `Igraci` WHERE `Name` = '%s'", Name(extraid));
mysql_function_query(konekt, gQuery, true, "OnQueryFinish", "ii", THREAD_NALOGPROVERA, extraid);
}
}