itsDevi

IsValidRoleplayName

Feb 22nd, 2021
145
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. stock IsValidRoleplayName(const vname[]) {
  2.     if (!vname[0] || strfind(vname, "_") == -1)
  3.         return 0;
  4.  
  5.     else for (new a = 0, len = strlen(vname); a != len; a ++) {
  6.         if ((a == 0) && (vname[a] < 'A' || vname[a] > 'Z'))
  7.             return 0;
  8.  
  9.         else if ((a != 0 && a < len  && vname[a] == '_') && (vname[a + 1] < 'A' || vname[a + 1] > 'Z'))
  10.             return 0;
  11.  
  12.         else if ((vname[a] < 'A' || vname[a] > 'Z') && (vname[a] < 'a' || vname[a] > 'z') && vname[a] != '_' && vname[a] != '.')
  13.             return 0;
  14.     }
  15.     return 1;
  16. }
RAW Paste Data