Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::string gibPoints(const char* odhraca, const char* hracovy, const char * lastparametr, uint64 serverConnectionHandlerID)
- {
- char* s;
- char* unikveod = NULL;
- char* unikvekomu = NULL;
- anyID* ids;
- size_t i;
- if (ts3Functions.getClientList(serverConnectionHandlerID, &ids) != ERROR_ok) {
- ts3Functions.logMessage("Error getting channel list", LogLevel_ERROR, "Plugin", serverConnectionHandlerID);
- return 0;
- }
- for (i = 0; ids[i]; i++)
- {
- if (ts3Functions.getClientVariableAsString(serverConnectionHandlerID, ids[i], CLIENT_NICKNAME, &s) != ERROR_ok) {
- ts3Functions.logMessage("Error querying channel name", LogLevel_ERROR, "Plugin", serverConnectionHandlerID);
- return 0;
- }
- if (lastparametr) {
- printf("%s %s \n", s, odhraca);
- if (strcmp(odhraca, s) == 0)
- {
- ts3Functions.getClientVariableAsString(serverConnectionHandlerID, ids[i], CLIENT_UNIQUE_IDENTIFIER, &unikveod);
- }
- if (strcmp(hracovy, s) == 0)
- {
- printf("ASD");
- ts3Functions.getClientVariableAsString(serverConnectionHandlerID, ids[i], CLIENT_UNIQUE_IDENTIFIER, &unikvekomu);
- }
- //printf("========\n%s %s\n", unikveod, unikvekomu);
- if (unikveod == NULL || unikvekomu == NULL) {
- return "ERROR";
- }else {
- int intparam = std::strtol(lastparametr, NULL, 10);
- int points = pointsof(hracovy, serverConnectionHandlerID);
- int mojepoints = pointsof(odhraca, serverConnectionHandlerID);
- if (mojepoints >= intparam && intparam > 0) {
- //sql
- //sqlite3_stmt * statement;
- //sqlite3_prepare_v2(db, "UPDATE Users SET points = points + 15, lastname = ? WHERE ts3id = ?;", -1, &statement, NULL);
- //sqlite3_bind_text(statement, 1, uzernejm, -1, 0);
- //sqlite3_bind_text(statement, 2, unikveid, -1, 0);
- //sqlite3_step(statement);
- //sqlite3_finalize(statement);
- //sql
- return "You just gave someone 'some :D' points";
- }
- else {
- return "ERROR";
- }
- }
- }
- ts3Functions.freeMemory(s);
- ts3Functions.freeMemory(unikvekomu);
- ts3Functions.freeMemory(unikveod);
- }
- ts3Functions.freeMemory(ids); /* Release array */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement