SA-MP Forums Archive
Register e-mail support - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Register e-mail support (/showthread.php?tid=187102)



Register e-mail support - Scriptor - 01.11.2010

hello all...
i wanna ask how to make script when you register with dialog you type sex,age,country and i want to add e-mail just for forgoten passwords... can anyone give me any script please?? or gimme some advices im noob.. thanks alot


Re: Register e-mail support - Miguel - 01.11.2010

Show a dialog asking for the e-mail. They, in OnDialogResponse, unformat the inputtext with sscanf and check if there are a string, an "@", another string, a dot and another string. Then store that string to your database.


Re: Register e-mail support - (SF)Noobanatior - 01.11.2010

Код:
/**
 *  Return if a Email is valid or not
 *  @param   value
 */
stock ValidEmail(email[]) {
  new len=strlen(email);
  new cstate=0;
  new i;
  for(i=0;i<len;i++) {
    if ((cstate==0 || cstate==1) && (email[i]>='A' && email[i]<='Z') || (email[i]>='a' && email[i]<='z')  || (email[i]=='.')  || (email[i]=='-')  || (email[i]=='_'))
    {
    } else {
       // Ok no A..Z,a..z,_,.,-
       if ((cstate==0) &&(email[i]=='@')) {
          // its an @ after the name, ok state=1;
          cstate=1;
       } else {
          // Its stuff which is not allowed
          return false;
       }
    }
  }
  if (cstate<1) return false;
  if (len<6) return false;
  // A toplevel domain has only 3 to 4 signs :-)
  if ((email[len-3]=='.') || (email[len-4]=='.') || (email[len-5]=='.')) return true;
  return false;
}