Advertisement
xyzccode

[SA-MP] [INC] RolePlay NameChecker - by xyzccode © 2014

Aug 26th, 2014
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.68 KB | None | 0 0
  1. /*
  2.  
  3.     You wanna check a RolePlay name? Use this!
  4.  
  5.         SA:MP RolePlay NameChecker by xyzccode © 2014.
  6.  
  7. */
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////
  9. //----------------------------------[#include - include fajlovi]----------------------------------//
  10. #include    <a_samp>
  11.  
  12. ////////////////////////////////////////////////////////////////////////////////////////////////////
  13. //----------------------------------[#define - definicija]----------------------------------------//
  14. #if defined xyz_namecheck_include
  15.     #endinput
  16. #endif
  17.  
  18. #define xyz_namecheck_include
  19.  
  20. #define     MIN_LEN         3
  21. #define     MAX_LEN         20
  22.  
  23. ////////////////////////////////////////////////////////////////////////////////////////////////////
  24. //-------------------------------------[stock]----------------------------------------------------//
  25. stock xyz_namecheck(playerid, const source[])
  26. {
  27.     new
  28.         len = strlen(source),
  29.         pos = strfind(source, "_", true)
  30.     ;
  31.     if(len <= MIN_LEN) return KickMessage(playerid, 0xFF3636FF, "Vase nick je prekratak. Izbaceni ste!");
  32.     if(len >= MAX_LEN) return KickMessage(playerid, 0xFF3636FF, "Vase nick je predugacak. Izbaceni ste!");
  33.     if(pos == -1) return KickMessage(playerid, 0xFF3636FF, "Vase nick nije u formatu Ime_Prezime. Izbaceni ste!");
  34.    
  35.     for(new i=0; i<strlen(source); i++)
  36.     {
  37.         if(i == 0)
  38.         {
  39.             switch(source[i])
  40.             {
  41.                 case 'A' .. 'Z': continue;
  42.                 default:
  43.                 {
  44.                     return KickMessage(playerid, 0xFF3636FF, "Prvo slovo Vaseg imena mora biti veliko slovo. Izbaceni ste!");
  45.                 }
  46.             }
  47.         }
  48.         else if(i == pos + 1)
  49.         {
  50.             switch(source[i])
  51.             {
  52.                 case 'A' .. 'Z': continue;
  53.                 default:
  54.                 {
  55.                     return KickMessage(playerid, 0xFF3636FF, "Prvo slovo Vaseg prezimena mora biti veliko slovo. Izbaceni ste!");
  56.                 }
  57.             }
  58.         }
  59.         else
  60.         {
  61.             switch(source[i])
  62.             {
  63.                 case 'a' .. 'z': continue;
  64.                 case '_': continue;
  65.                 case '0' .. '9':
  66.                 {
  67.                     return KickMessage(playerid, 0xFF3636FF, "Vas nick ne smije da sadrzi brojeve. Izbaceni ste!");
  68.                 }
  69.                 default:
  70.                 {
  71.                     return KickMessage(playerid, 0xFF3636FF, "Vas nick smije da sadrzi samo slova abecede i donju crticu. Izbaceni ste!");
  72.                 }
  73.             }
  74.         }
  75.     }
  76.     return 1;
  77. }
  78.  
  79. stock KickMessage(playerid, color, const message[])
  80. {
  81.     SendClientMessage(playerid, color, message);
  82.     SetTimerEx("KickPlayer", 100, false, "d", playerid);
  83.     return 1;
  84. }
  85.  
  86. ////////////////////////////////////////////////////////////////////////////////////////////////////
  87. //-------------------------------------[public]---------------------------------------------------//
  88. forward KickPlayer(playerid);
  89. public KickPlayer(playerid)
  90. {
  91.     Kick(playerid);
  92.     return 1;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement