rickvocam

Untitled

Mar 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1.  
  2.  
  3. forward GetReportCount(userid, tdate[]);
  4. public GetReportCount(userid, tdate[])
  5. {
  6. new string[128];
  7. format(string, sizeof(string), "SELECT SUM(count) as totalcount FROM `tokens_report` WHERE `playerid` = %d AND `date` = '%s'", GetPlayerSQLId(userid), tdate);
  8. return mysql_tquery(MainPipeline, string, "QueryGetCountFinish", "ii", userid, 0);
  9. }
  10.  
  11. forward GetHourReportCount(userid, thour[], tdate[]);
  12. public GetHourReportCount(userid, thour[], tdate[])
  13. {
  14. new string[128];
  15. format(string, sizeof(string), "SELECT `count` FROM `tokens_report` WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(userid), tdate, thour);
  16. return mysql_tquery(MainPipeline, string, "QueryGetCountFinish", "ii", userid, 1);
  17. }
  18.  
  19. forward GetRequestCount(userid, tdate[]);
  20. public GetRequestCount(userid, tdate[])
  21. {
  22. new string[128];
  23. format(string, sizeof(string), "SELECT SUM(count) as totalcount FROM `tokens_request` WHERE `playerid` = %d AND `date` = '%s'", GetPlayerSQLId(userid), tdate);
  24. return mysql_tquery(MainPipeline, string, "QueryGetCountFinish", "ii", userid, 0);
  25. }
  26.  
  27. forward GetHourRequestCount(userid, thour[], tdate[]);
  28. public GetHourRequestCount(userid, thour[], tdate[])
  29. {
  30. new string[128];
  31. format(string, sizeof(string), "SELECT `count` FROM `tokens_request` WHERE `playerid` = %d AND `date` = '%s' AND `hour` = '%s'", GetPlayerSQLId(userid), tdate, thour);
  32. return mysql_tquery(MainPipeline, string, "QueryGetCountFinish", "ii", userid, 1);
  33. }
  34. forward QueryGetCountFinish(userid, type);
  35. public QueryGetCountFinish(userid, type)
  36. {
  37. new rows = cache_num_rows();
  38.  
  39. switch(type)
  40. {
  41. case 0:
  42. {
  43. if(rows > 0)
  44. {
  45. new bool:is_null;
  46. cache_is_value_name_null(o, "totalcount", is_null);
  47. if(!is_null) {
  48. cache_get_value_name_int(0, "totalcount", ReportCount[userid]);
  49. }
  50. else ReportCount[userid] = 0;
  51. }
  52. else ReportCount[userid] = 0;
  53.  
  54. }
  55. case 1:
  56. {
  57. if(rows > 0)
  58. {
  59. cache_get_value_name_int(0, "count", ReportHourCount[userid]);
  60. }
  61. else ReportHourCount[userid] = 0;
  62. }
  63. case 2:
  64. {
  65. Homes[userid] = rows;
  66. }
  67. }
  68. print("test getcountfinish");
  69. return 1;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment