Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- #include <a_mysql>
- #include <a_http>
- #define DIALOG_ONEBIP 10100
- #define DIALOG_ONEBIP_INFO 10101
- #define ONEBIP_API_FILE "OneBip/OneBipOutput"
- new
- _OBFilePath[41][50],
- _OBOutput[200],
- _OBEtapa[41],
- _OBOperadora[41][10],
- _OBOjr_email[41][50],
- _OBOtravado[41],
- Query[640]
- ;
- //----------------------------------------------------------------------------------------------------------------------------------------
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new nick[MAX_PLAYER_NAME], email[50], passwd[50], celular[50], temp[50], out[500], registrado;
- GetPlayerName(playerid, nick, sizeof(nick));
- if(dialogid == DIALOG_ONEBIP) {
- switch(_OBEtapa[playerid]) {
- case -1: {
- if(response == 0) return 1;
- _OBEtapa[playerid] = 0;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Início", "{FFFFFF}Você já possui uma conta no OneBip?", "Sim", "Não");
- }
- case 0: {
- if(response == 1) {
- _OBEtapa[playerid] = 11;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_INPUT, "Registro - Onebip", "{FFFFFF}Insira abaixo o seu e-mail do OneBip:", "Continuar", "Cancelar");
- } else {
- _OBEtapa[playerid] = 1;
- OnDialogResponse(playerid, DIALOG_ONEBIP, 1, 0, "");
- }
- }
- case 11: {
- if(response == 0) return 1;
- format(_OBOjr_email[playerid], 50, "%s", inputtext);
- _OBEtapa[playerid] = 12;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_INPUT, "Registro - Onebip", "{FFFFFF}Insira abaixo o sua senha do OneBip:", "Continuar", "Cancelar");
- }
- case 12: {
- if(response == 0) return 1;
- if(_OBOtravado[playerid] != 1) {
- format(_OBOutput, sizeof(_OBOutput), "brazucas-server.com/OneBipCore.php?nick=%s&etapa=verificarlogin&email=%s&senha=%s", nick, _OBOjr_email[playerid], inputtext);
- HTTP(playerid, HTTP_GET, _OBOutput, "", "OnebipResponse");
- }
- _OBOtravado[playerid] = 1;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Mensagem", "{FFFFFF}Aguarde enquanto os dados inseridos são verificados...\n\n{999999}Pressione ESC caso o processo leve mais de um minuto.", "OK", "");
- }
- case 13: {
- if(response == 0) return 1;
- _OBEtapa[playerid] = 1;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Mensagem", "{00FF00}Login efetuado com sucesso!\n\n{999999}Clique em OK para continuar com o processo de registro.", "OK", "");
- }
- case 1: {
- if(response == 0) return 1;
- new _opr = strval(inputtext);
- format(Query, sizeof(Query), "SELECT * FROM onebip_info WHERE NICK = '%s' LIMIT 0,1", nick);
- mysql_query(Query);
- mysql_store_result();
- if(mysql_retrieve_row()) {
- mysql_fetch_field_row(email, "ONEBIP_USER");
- mysql_fetch_field_row(passwd, "ONEBIP_PASS");
- mysql_fetch_field_row(celular, "ONEBIP_CEL");
- mysql_fetch_field_row(temp, "REGISTRADO"); registrado = strval(temp);
- if(registrado == 1) {
- ShowPlayerDialog(playerid, DIALOG_ONEBIP_INFO, DIALOG_STYLE_MSGBOX, "Registro - Conta já registrada", "{FFFFFF}Você já está registrado.", "OK", "");
- return 1;
- }
- format(out, sizeof(out), "{FF0000}Informações já salvas sobre seus dados:\n\n{FFFFFF}Username: {00FF00}%s\n{FFFFFF}Senha: {00FF00}%s\n{FFFFFF}Celular: {00FF00}%s\n\n{FF0000}Caso os dados do seu celular estejam errados, logue em http://my.onebip.com/login\ncom os dados de login acima e faça as alterações necessárias.", email, passwd, celular);
- _OBEtapa[playerid] = 5;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Cadastro encontrado!", out, "Continuar", "Cancelar");
- mysql_free_result();
- return 1;
- }
- switch(_opr) {
- case 1: format(_OBOperadora[playerid], 10, "%s", "claro");
- case 2: format(_OBOperadora[playerid], 10, "%s", "vivo");
- case 3: format(_OBOperadora[playerid], 10, "%s", "tim");
- case 4: format(_OBOperadora[playerid], 10, "%s", "oi");
- default: {
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_INPUT, "Registro - Etapa 1", "{FFFFFF}Insira abaixo sua operadora:\n\n1 - Claro\n2 - Vivo\n3 - Tim\n4 - Oi", "Continuar", "Cancelar");
- return 1;
- }
- }
- _OBEtapa[playerid] = 2;
- OnDialogResponse(playerid, DIALOG_ONEBIP, 1, 0, "");
- return 1;
- }
- case 2: {
- if(response == 0) return 1;
- _OBEtapa[playerid] = 3;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_INPUT, "Registro - Etapa 2", "{FFFFFF}Insira abaixo o número de seu celular com DDD: (exemplo: 6192775466)", "Continuar", "Cancelar");
- return 1;
- }
- case 3: {
- if(response == 0) return 1;
- if(_OBOtravado[playerid] != 1) {
- format(_OBOutput, sizeof(_OBOutput), "brazucas-server.com/OneBipCore.php?nick=%s&etapa=1&celular=%s&operadora=%s", nick, inputtext, _OBOperadora[playerid]);
- HTTP(playerid, HTTP_GET, _OBOutput, "", "OnebipResponse");
- }
- _OBOtravado[playerid] = 1;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Mensagem", "{FFFFFF}Aguarde enquanto suas contas de e-mail e do onebip são criadas...\n\n{999999}Pressione ESC caso o processo leve mais de um minuto.", "OK", "");
- }
- case 4: {
- if(response == 0) return 1;
- format(Query, sizeof(Query), "SELECT * FROM onebip_info WHERE NICK = '%s' LIMIT 0,1", nick);
- mysql_query(Query);
- mysql_store_result();
- if(mysql_retrieve_row()) {
- mysql_fetch_field_row(email, "ONEBIP_USER");
- mysql_fetch_field_row(passwd, "ONEBIP_PASS");
- mysql_fetch_field_row(celular, "ONEBIP_CEL");
- }
- mysql_free_result();
- _OBEtapa[playerid] = 5;
- format(out, sizeof(out), "{FF0000}Informações de sua conta do onebip:\n\n{FFFFFF}Username: {00FF00}%s\n{FFFFFF}Senha: {00FF00}%s\n{FFFFFF}Celular: {00FF00}%s\n{FFFFFF}URL para login: {00FF00}http://my.onebip.com/login\n\n{FF0000}Salve essas informações caso queira comprar créditos no futuro.", email, passwd, celular);
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Mensagem", out, "Continuar", "Cancelar");
- }
- case 5: {
- if(response == 0) return 1;
- if(_OBOtravado[playerid] != 1) {
- format(_OBOutput, sizeof(_OBOutput), "brazucas-server.com/OneBipCore.php?nick=%s&etapa=2", nick);
- HTTP(playerid, HTTP_GET, _OBOutput, "", "OnebipResponse");
- }
- _OBOtravado[playerid] = 1;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Mensagem", "{FFFFFF}Aguarde enquanto o código é enviado para o seu celular...\n\n{999999}Pressione ESC caso o processo leve mais de um minuto.", "OK", "");
- }
- case 6: {
- if(response == 0) return 1;
- _OBEtapa[playerid] = 7;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_INPUT, "Registro - Etapa 3", "{FFFFFF}Insira abaixo o código enviado para o seu celular:\n\n{999999}O código pode levar alguns minutos para chegar em seu celular.", "Continuar", "Cancelar");
- return 1;
- }
- case 7: {
- if(response == 0) return 1;
- new pincode = strval(inputtext);
- if(_OBOtravado[playerid] != 1) {
- format(_OBOutput, sizeof(_OBOutput), "brazucas-server.com/OneBipCore.php?nick=%s&etapa=3&pincode=%d", nick, pincode);
- HTTP(playerid, HTTP_GET, _OBOutput, "", "OnebipResponse");
- }
- _OBOtravado[playerid] = 1;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Mensagem", "{FFFFFF}Aguarde, verificando o código...\n\n{999999}Pressione ESC caso o processo leve mais de um minuto.", "OK", "");
- }
- case 8: {
- if(response == 0) return 1;
- _OBEtapa[playerid] = 1;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Mensagem", "{00FF00}Pagamento efetuado com sucesso!", "OK", "");
- }
- }
- }
- return 0;
- }
- //----------------------------------------------------------------------------------------------------------------------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[128];
- new idx;
- cmd = strtok(cmdtext,idx);
- if(strcmp("/novoregistro", cmd, true) == 0) {
- _OBEtapa[playerid] = -1;
- ShowPlayerDialog(playerid, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Iniciar", "{FFFFFF}Para se registrar no Brazucas é necessário fazer o pagamento de uma taxa de R$4 que\npode ser feito via celular in-game, o sistema de registro foi feito desta maneira para\neliminar as chances de ter jogadores usando cheat no servidor, os R$4 gastos no pagamento\nsão convertidos em 4.000 créditos logo após o seu registro, para ler mais sobre créditos\nacesse nossa FAQ.", "Continuar", "Fechar");
- return 1;
- }
- return 0;
- }
- //----------------------------------------------------------------------------------------------------------------------------------------
- forward OnebipResponse(index, response_code, data[]);
- public OnebipResponse(index, response_code, data[]) {
- format(_OBFilePath[index], sizeof(_OBFilePath), "%s%d.ini", ONEBIP_API_FILE, index);
- new File:temp = fopen(_OBFilePath[index], io_write);
- if(temp) {
- fwrite(temp, data);
- fclose(temp);
- }
- switch(strval(dini_Get(_OBFilePath[index], "Etapa"))) {
- case 2: {
- _OBEtapa[index] = 4;
- _OBOtravado[index] = 0;
- OnDialogResponse(index, DIALOG_ONEBIP, 1, 0, "");
- return 1;
- }
- case 3: {
- _OBEtapa[index] = 6;
- _OBOtravado[index] = 0;
- OnDialogResponse(index, DIALOG_ONEBIP, 1, 0, "");
- return 1;
- }
- case 5: {
- _OBEtapa[index] = 8;
- _OBOtravado[index] = 0;
- OnDialogResponse(index, DIALOG_ONEBIP, 1, 0, "");
- return 1;
- }
- case 13: {
- _OBEtapa[index] = 13;
- _OBOtravado[index] = 0;
- OnDialogResponse(index, DIALOG_ONEBIP, 1, 0, "");
- }
- }
- switch(strval(dini_Get(_OBFilePath[index], "Erro"))) {
- case 1: {
- _OBEtapa[index] = 1;
- _OBOtravado[index] = 0;
- ShowPlayerDialog(index, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Erro", "{FF0000}Não foi possível criar sua conta do OneBip.\n\n{FFFFFF}Possíveis motivos para este erro acontecer:\n- O número de celular inserido é inválido.\n- O número de celular inserido já está sendo usado em outra conta.", "OK", "");
- return 1;
- }
- case 2: {
- _OBEtapa[index] = 1;
- _OBOtravado[index] = 0;
- ShowPlayerDialog(index, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Erro", "{FF0000}Não foi possível confirmar sua conta do OneBip, tente iniciar o processo novamente.", "OK", "");
- return 1;
- }
- case 3: {
- _OBEtapa[index] = 1;
- _OBOtravado[index] = 0;
- ShowPlayerDialog(index, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Erro", "{FF0000}A operadora de celular inserida não existe.", "OK", "");
- return 1;
- }
- case 4: {
- _OBEtapa[index] = 1;
- _OBOtravado[index] = 0;
- ShowPlayerDialog(index, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Erro", "{FF0000}Não foi possível enviar o código para o seu celular, tente iniciar o processo novamente.", "OK", "");
- return 1;
- }
- case 5: {
- _OBEtapa[index] = 1;
- _OBOtravado[index] = 0;
- ShowPlayerDialog(index, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Erro", "{FF0000}O código inserido está incorreto.", "OK", "");
- return 1;
- }
- case 6: {
- _OBEtapa[index] = 1;
- _OBOtravado[index] = 0;
- ShowPlayerDialog(index, DIALOG_ONEBIP, DIALOG_STYLE_MSGBOX, "Registro - Erro", "{FF0000}E-mail e/ou senha incorreto(s).", "OK", "");
- return 1;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement