Problem -
C0oL3r - 17.02.2018
hey, i want to check if a user is banned, but when i send the messages it will send me "0" to all values and to Banned by message it's "Banned by: 7"
but in the database is all correct.
And after a server restart, if i connect, it will spawn me if i am banned.
Код:
public CheckUser(playerid)
{
new CheckBanQuery[255], rows;
mysql_format(Database, CheckBanQuery, sizeof(CheckBanQuery), "SELECT * FROM `bans` WHERE `Username`='%s'", pInfo[playerid][pName]);
mysql_tquery(Database, CheckBanQuery);
cache_get_row_count(rows);
if(rows)
{
new string[255];
cache_get_value_name(0, "Admin", bInfo[playerid][bAdmin], MAX_PLAYER_NAME);
cache_get_value_int(0, "ExpireOn", bInfo[playerid][bExpireOn]);
cache_get_value_name(0, "Reason", bInfo[playerid][bReason], 255);
cache_get_value_int(0, "Date", bInfo[playerid][bDate]);
cache_get_value_int(0, "Time", bInfo[playerid][bTime]);
format(string, sizeof(string), "This account (%s) is banned.", pInfo[playerid][pName]);
SCM(playerid, COLOR_BAN, string);
format(string, sizeof(string), "Banned by: %s on %d %d, reason: %s", bInfo[playerid][bAdmin], bInfo[playerid][bDate], bInfo[playerid][bTime], bInfo[playerid][bReason]);
SCM(playerid, COLOR_DEFAULT, string);
if(strcmp(bInfo[playerid][bExpireOn], "permanent", true) == 0)
{
SCM(playerid, COLOR_DEFAULT, "This is a permanent ban");
}
else
{
format(string, sizeof(string), "Ban will expire on %d %d", bInfo[playerid][bExpireOn], bInfo[playerid][bTime]);
SCM(playerid, COLOR_DEFAULT, string);
}
SCM(playerid, COLOR_DEFAULT, "Poti face o cerere de unban pe **PANEL**, daca consideri ca ai luat ban degeaba.");
KickEx(playerid);
return 1;
}
else
{
Loadingdata and spawn player......
}
}
Re: Problem -
Mugala - 17.02.2018
pInfo[playerid][pName] <-- where does it takes a code from?
Re: Problem -
C0oL3r - 17.02.2018
l found, i changed
to
, now it's take name correct, but the date no, how can i make to retreive date from database, when in database is like 17/02/2018, server it's returning 17 14
Re: Problem -
Mugala - 17.02.2018
it depends how u placed times in database, for example I'm using strings for times.
Re: Problem -
OneDay - 17.02.2018
Save a Unix timestamp in the database.