Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetTimer("RemoteKickTimer", 10000, 1); //10 segundos, MySQL constante iria lagar MUITO o server
- public RemoteKickTimer()
- {
- for(new i; i < MAX_PLAYERS; i++)
- {
- if(samp_mysql_ping() != 0) break;
- if(!IsPlayerConnected(i)) continue;
- new query[256], nome[MAX_PLAYER_NAME];
- GetPlayerName(i, nome, sizeof nome);
- format(query, sizeof query, "SELECT `kick` FROM `users` WHERE `nick` = '%s'", nome);
- samp_mysql_query(query);
- samp_mysql_store_result();
- if(samp_mysql_num_rows() == 1)
- {
- new kick[4], reason[64], string[128];
- samp_mysql_fetch_row(kick);
- if(strval(kick))
- {
- format(query, sizeof query, "SELECT `kickreason` FROM `users` WHERE `nick` = '%s'", nome);
- samp_mysql_query(query);
- samp_mysql_store_result();
- if(samp_mysql_num_rows() == 1)
- {
- samp_mysql_fetch_row(reason);
- format(string, sizeof string, "%s foi kickado remotamente. Razão: %s", nome, reason);
- SendClientMessageToAll(0xFF0000AA, string);
- }
- format(query, sizeof query, "UPDATE `users` SET `kick` = 0, `kickreason` = NULL WHERE `nick` = '%s'", nome);
- samp_mysql_query(query);
- Kick(i);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment