Advertisement
Guest User

Untitled

a guest
May 31st, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. std::string gibPoints(const char* odhraca, const char* hracovy, const char * lastparametr, uint64 serverConnectionHandlerID)
  2. {
  3.  
  4. char* s;
  5. char* unikveod = NULL;
  6. char* unikvekomu = NULL;
  7. anyID* ids;
  8. size_t i;
  9.  
  10. if (ts3Functions.getClientList(serverConnectionHandlerID, &ids) != ERROR_ok) {
  11. ts3Functions.logMessage("Error getting channel list", LogLevel_ERROR, "Plugin", serverConnectionHandlerID);
  12. return 0;
  13. }
  14.  
  15. for (i = 0; ids[i]; i++)
  16. {
  17.  
  18. if (ts3Functions.getClientVariableAsString(serverConnectionHandlerID, ids[i], CLIENT_NICKNAME, &s) != ERROR_ok) {
  19. ts3Functions.logMessage("Error querying channel name", LogLevel_ERROR, "Plugin", serverConnectionHandlerID);
  20. return 0;
  21. }
  22. if (lastparametr) {
  23. printf("%s %s \n", s, odhraca);
  24. if (strcmp(odhraca, s) == 0)
  25. {
  26. ts3Functions.getClientVariableAsString(serverConnectionHandlerID, ids[i], CLIENT_UNIQUE_IDENTIFIER, &unikveod);
  27. }
  28.  
  29. if (strcmp(hracovy, s) == 0)
  30. {
  31. printf("ASD");
  32. ts3Functions.getClientVariableAsString(serverConnectionHandlerID, ids[i], CLIENT_UNIQUE_IDENTIFIER, &unikvekomu);
  33. }
  34. //printf("========\n%s %s\n", unikveod, unikvekomu);
  35. if (unikveod == NULL || unikvekomu == NULL) {
  36. return "ERROR";
  37. }else {
  38. int intparam = std::strtol(lastparametr, NULL, 10);
  39. int points = pointsof(hracovy, serverConnectionHandlerID);
  40. int mojepoints = pointsof(odhraca, serverConnectionHandlerID);
  41. if (mojepoints >= intparam && intparam > 0) {
  42.  
  43. //sql
  44. //sqlite3_stmt * statement;
  45.  
  46. //sqlite3_prepare_v2(db, "UPDATE Users SET points = points + 15, lastname = ? WHERE ts3id = ?;", -1, &statement, NULL);
  47. //sqlite3_bind_text(statement, 1, uzernejm, -1, 0);
  48. //sqlite3_bind_text(statement, 2, unikveid, -1, 0);
  49. //sqlite3_step(statement);
  50. //sqlite3_finalize(statement);
  51. //sql
  52.  
  53. return "You just gave someone 'some :D' points";
  54. }
  55. else {
  56. return "ERROR";
  57. }
  58. }
  59.  
  60. }
  61. ts3Functions.freeMemory(s);
  62. ts3Functions.freeMemory(unikvekomu);
  63. ts3Functions.freeMemory(unikveod);
  64. }
  65. ts3Functions.freeMemory(ids); /* Release array */
  66.  
  67. return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement