10.06.2013, 20:08
Im trying to get the last 10 logins to show up, 'Player Name' logged in 'date and time'.
It shows me 'Richie© logged in NULL'. Why?
Field 'PlayerName' is varchar 24, 'Time' is varchar 20 in the DB.
It shows me 'Richie© logged in NULL'. Why?
Field 'PlayerName' is varchar 24, 'Time' is varchar 20 in the DB.
pawn Код:
IRCCMD:lastlogins(botid, channel[], user[], host[], params[])
{
if (IRC_IsOp(botid, channel, user))
{
mysql_function_query(gConnectionhandle, "SELECT DISTINCT `PlayerName` FROM `lol_Players` ORDER BY `Time` DESC LIMIT 10", true, "iLast10Logins", "s", channel);
}
return 1;
}
forward iLast10Logins(channel[]);
public iLast10Logins(channel[])
{
new rows, fields, time[20], user[24], string[60];
cache_get_data(rows, fields);
IRC_GroupSay(gGroupID, channel, "________ Last 10 Logins ________");
for(new i=0; i<rows; i++)
{
cache_get_field_content(i, "PlayerName", user);
cache_get_field_content(i, "Time", time);
format(string, sizeof(string), "%s logged in %s", user, time);
IRC_GroupSay(gGroupID, channel, string);
}
return 1;
}