Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Send-Mail by Mandrack_FreeZe
- Créditos ao 'Victor pela PSD Plugin
- Créditos ao Slice pela include mailer
- Créditos ao Y_Less pelo ycmd e sscanf2
- Crédito a Double_O_Seven pela DOF2
- www.forum.sa-mp.com/forumdisplay.php?f=56
- ***NÃO RETIRE OS CRÉDITOS***
- Server PHP já configurado. FS pronto para utilização.
- */
- #include <a_samp>
- #include <DOF2>
- #include <YSI\y_commands>
- #include <sscanf2>
- #define MAILER_URL "sendmailsamp.url.ph/sendmail.php" //NÃO MODIFIQUE OU REMOVA ESTÁ LINHA!!
- #include <mailer>
- #define loop(%0,%1) for(new %0; %0 < %1; ++%0)
- #define AZUL_CLARO 0x00BFFFFF
- #define VERMELHO 0xFF0000FF
- #define CINZA 0x696969FF
- #define VERDE 0x00FF00FF
- new pAuto[MAX_PLAYERS];
- new pSpawn[MAX_PLAYERS];
- native CriarPasta(pasta[]);
- public OnFilterScriptInit()
- {
- print("[Send-Mail] Configurando...");
- if(!DOF2_FileExists("SendMail"))
- {
- CriarPasta("scriptfiles\\SendMail");
- }
- if(!DOF2_FileExists("SendMail/Emails"))
- {
- CriarPasta("scriptfiles\\SendMail\\Emails");
- print("[Send-Mail] Pastas criadas!");
- }
- print("\n--------------------------------------");
- print(" Send-Mail by Mandrack_FreeZe Ativado");
- print(" www.forum.sa-mp.com");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- DOF2_Exit();
- print("\n--------------------------------------");
- print(" Send-Mail by Mandrack_FreeZe Desativado");
- print(" www.forum.sa-mp.com");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- pSpawn[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- pSpawn[playerid] = 0;
- SendClientMessage(playerid, VERDE, "[Send-Mail] Este servidor utiliza o sistema de e-mail Send-Mail por Mandrack_FreeZe");
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- pSpawn[playerid] = 1;
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 9647)
- {
- if(response)
- {
- new arquivo[60];
- format(arquivo, sizeof(arquivo), "SendMail/Emails/%s", PlayerName(playerid));
- DOF2_CreateFile(arquivo);
- DOF2_SetString(arquivo, "Email", inputtext);
- DOF2_SetString(arquivo, "Para", "ND");
- DOF2_SetString(arquivo, "Assunto", "ND");
- DOF2_SaveFile();
- }
- return 1;
- }
- if(dialogid == 8569)
- {
- if(response)
- {
- if(listitem == 0)
- {
- ShowPlayerDialog(playerid,7545,DIALOG_STYLE_INPUT,"Para:","Digite o destinatario abaixo:","Proximo","Cancelar");
- }
- if(listitem == 1)
- {
- SendClientMessage(playerid, VERDE, "Uma solicitação de troca de e-mail foi enviada aos admins online.");
- new string[100];
- format(string, sizeof(string), "O player [%d]%s está solicitando uma troca de email. Utilize /aemail.", playerid, PlayerName(playerid));
- loop(i, GetMaxPlayers())
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerAdmin(i))
- {
- SendClientMessage(i, VERMELHO, string);
- }
- }
- }
- }
- }
- return 1;
- }
- if(dialogid == 7545)
- {
- if(response)
- {
- new arquivo[60];
- format(arquivo, sizeof(arquivo), "SendMail/Emails/%s", PlayerName(playerid));
- DOF2_SetString(arquivo, "Para", inputtext);
- DOF2_SaveFile();
- ShowPlayerDialog(playerid,7548,DIALOG_STYLE_INPUT,"Assunto:","Digite um título abaixo:","Proximo","Cancelar");
- }
- return 1;
- }
- if(dialogid == 7548)
- {
- if(response)
- {
- new arquivo[60];
- format(arquivo, sizeof(arquivo), "SendMail/Emails/%s", PlayerName(playerid));
- DOF2_SetString(arquivo, "Assunto", inputtext);
- DOF2_SaveFile();
- ShowPlayerDialog(playerid,7549,DIALOG_STYLE_INPUT,"Menssagem:","Digite a menssagem abaixo:","Enviar","Cancelar");
- }
- return 1;
- }
- if(dialogid == 7549)
- {
- if(response)
- {
- new arquivo[60], string[126];
- format(arquivo, sizeof(arquivo), "SendMail/Emails/%s", PlayerName(playerid));
- SendMail(DOF2_GetString(arquivo, "Para"), DOF2_GetString(arquivo, "Email"),PlayerName(playerid),DOF2_GetString(arquivo, "Assunto"), inputtext);
- format(string, sizeof(string), "E-mail enviado para: %s Assunto: %s. Verifique se o E-mail digitado é o correto.", DOF2_GetString(arquivo, "Para"), DOF2_GetString(arquivo, "Assunto"));
- SendClientMessage(playerid, AZUL_CLARO, string);
- }
- return 1;
- }
- return 1;
- }
- stock PlayerName(playerid)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- return pName;
- }
- YCMD:aemail(playerid, params[], help)
- {
- if(pSpawn[playerid] != 1) return SendClientMessage(playerid, CINZA, "Logue antes de usar esse comando!");
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, CINZA, "Você não é um Admin!");
- new string[80], id;
- if(sscanf(params, "u", id)) return SendClientMessage(playerid, CINZA, "Utilize /aemail [ID]");
- pAuto[id] = 1;
- format(string, sizeof(string), "Você autorizou o player %s a mudar de e-mail.", PlayerName(id));
- SendClientMessage(playerid, VERDE, string);
- format(string, sizeof(string), "Você foi autorizado a mudar de e-mail pelo admin %s. Use /memail", PlayerName(playerid));
- SendClientMessage(id, AZUL_CLARO, string);
- return 1;
- }
- YCMD:email(playerid, params[], help)
- {
- if(pSpawn[playerid] != 1) return SendClientMessage(playerid, CINZA, "Logue antes de usar esse comando!");
- new arquivo[60];
- format(arquivo, sizeof(arquivo), "SendMail/Emails/%s", PlayerName(playerid));
- if(DOF2_FileExists(arquivo))
- {
- new email[60];
- format(email, sizeof(email), "E-mail %s", DOF2_GetString(arquivo, "Email"));
- ShowPlayerDialog(playerid,8569,DIALOG_STYLE_LIST,email,"Mandar E-mail\nSolicitar troca de E-mail","Selecionar","Cancelar");
- } else {
- ShowPlayerDialog(playerid, 9647, DIALOG_STYLE_INPUT, "Seu E-mail não está registrado!", "Digite seu e-mail abaixo corretamente por favor:\nOBS: Você só tem 1 e-mail por conta.", "Registrar","Cancelar");
- }
- return 1;
- }
- YCMD:memail(playerid, params[], help)
- {
- if(pSpawn[playerid] != 1) return SendClientMessage(playerid, CINZA, "Logue antes de usar esse comando!");
- if(pAuto[playerid] != 1) return SendClientMessage(playerid, CINZA, "Você não foi autorizado! Peça autorização a um admin!");
- new ss[80];
- if(sscanf(params, "s[80]", ss)) return SendClientMessage(playerid, CINZA, "Utilize /memail [NOVO E-MAIL]");
- new arquivo[60], string[100];
- format(arquivo, sizeof(arquivo), "SendMail/Emails/%s", PlayerName(playerid));
- pAuto[playerid] = 0;
- if(DOF2_FileExists(arquivo))
- {
- DOF2_SetString(arquivo, "Email", ss);
- format(string, sizeof(string), "Novo e-mail configurado: %s", ss);
- SendClientMessage(playerid, VERDE, string);
- } else {
- ShowPlayerDialog(playerid, 9647, DIALOG_STYLE_INPUT, "Seu E-mail não está registrado!", "Digite seu email abaixo corretamente por favor:\nOBS: Você só tem 1 e-mail por conta.", "Registrar","Cancelar");
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment