Advertisement
Guest User

Stocki

a guest
Mar 22nd, 2018
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.74 KB | None | 0 0
  1. stock IsRPName(name[], minname = 3, bool:firstupperthenlower = true) //By Nickk888
  2. {
  3.     new count, checknumcount, where, tmpname[24], tmpsname[24];
  4.     new len = strlen(name);
  5.     for(new i; i < len; i++) {
  6.         if(name[i] == '_')
  7.             count++,
  8.             where = i;
  9.         switch(name[i]) {
  10.             case 'A'..'Z', 'a'..'z', '_':
  11.                 checknumcount++;
  12.         }
  13.     }
  14.     if(count != 1 || (where < minname || len < ((where + 1) + minname)) || checknumcount != len)
  15.         return 0;
  16.     strmid(tmpname, name, 0, where);
  17.     strmid(tmpsname, name, where+1, len);
  18.     checknumcount = 0;
  19.     if(firstupperthenlower) {
  20.         switch(tmpname[0]) {
  21.             case 'A'..'Z':
  22.                 checknumcount++;
  23.         }
  24.         for(new i = 1, j = strlen(tmpname); i < j; i++){
  25.             switch(tmpname[i]) {
  26.                 case 'a'..'z':
  27.                     checknumcount++;
  28.             }
  29.         }
  30.         switch(tmpsname[0]) {
  31.             case 'A'..'Z':
  32.                 checknumcount++;
  33.         }
  34.         for(new i = 1, j = strlen(tmpsname); i < j; i++){
  35.             switch(tmpsname[i]) {
  36.                 case 'a'..'z':
  37.                     checknumcount++;
  38.             }
  39.         }
  40.         if((checknumcount + 1) != len)
  41.             return 0;
  42.     }
  43.     return 1;
  44. }
  45.  
  46. stock IsNumeric(const string[])
  47. {
  48.     for (new i = 0, j = strlen(string); i < j; i++)
  49.     {
  50.         if (string[i] > '9' || string[i] < '0') return 0;
  51.     }
  52.     return 1;
  53. }
  54.  
  55. forward bool:IsStrValid(string[]);
  56. stock bool:IsStrValid(string[])
  57. {
  58.     new num;
  59.     new len = strlen(string);
  60.     for(new i; i < len; i++)
  61.         switch(string[i])
  62.         {
  63.             case 'A'..'Z':num++;
  64.             case 'a'..'z':num++;
  65.             case '0'..'9':num++;
  66.         }
  67.     if(num == len) return true;
  68.     else return false;
  69. }
  70.  
  71. stock ClearPlayerChat(playerid)
  72. {
  73.     for(new i; i < 15; i++)
  74.         SendClientMessage(playerid, -1, "");
  75.     return 1;
  76. }
  77.  
  78. stock PlayerName(playerid)
  79. {
  80.     new gname[MAX_PLAYER_NAME];
  81.     GetPlayerName(playerid, gname, MAX_PLAYER_NAME);
  82.     return gname;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement