public bool OnKeyUse(int iClient, const char[] sKeyType, ArrayList hParamsArr, char[] sError, int iErrLen)
{
decl char sParam[KEYS_MAX_LENGTH], szAuth[32], szName[MAX_NAME_LENGTH];
hParamsArr.GetString(1, sParam, sizeof(sParam));
GetClientAuthId(iClient, AuthId_Steam2, szAuth, sizeof(szAuth));
GetClientName(iClient, szName, sizeof(szName));
if (g_hUsers.FindString(szAuth) == -1)
{
char szQuery[256];
int iExpires = StringToInt(sParam);
FormatEx(szQuery, sizeof(szQuery), "INSERT INTO `test` (`steam`, `name`, `time`) VALUES ('%s', '%s', '%d');", szAuth, szName, GetTime(), iExpires != 0 ? iExpires + GetTime() : iExpires);
DataPack hPack = new DataPack();
hPack.WriteCell(GetClientUserId(iClient));
hPack.WriteCell(iExpires);
g_hDatabase.Query(DB_InsertCallback, szQuery, hPack);
return true;
}
return false;
}