Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- You wanna check a RolePlay name? Use this!
- SA:MP RolePlay NameChecker by xyzccode © 2014.
- */
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //----------------------------------[#include - include fajlovi]----------------------------------//
- #include <a_samp>
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //----------------------------------[#define - definicija]----------------------------------------//
- #if defined xyz_namecheck_include
- #endinput
- #endif
- #define xyz_namecheck_include
- #define MIN_LEN 3
- #define MAX_LEN 20
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //-------------------------------------[stock]----------------------------------------------------//
- stock xyz_namecheck(playerid, const source[])
- {
- new
- len = strlen(source),
- pos = strfind(source, "_", true)
- ;
- if(len <= MIN_LEN) return KickMessage(playerid, 0xFF3636FF, "Vase nick je prekratak. Izbaceni ste!");
- if(len >= MAX_LEN) return KickMessage(playerid, 0xFF3636FF, "Vase nick je predugacak. Izbaceni ste!");
- if(pos == -1) return KickMessage(playerid, 0xFF3636FF, "Vase nick nije u formatu Ime_Prezime. Izbaceni ste!");
- for(new i=0; i<strlen(source); i++)
- {
- if(i == 0)
- {
- switch(source[i])
- {
- case 'A' .. 'Z': continue;
- default:
- {
- return KickMessage(playerid, 0xFF3636FF, "Prvo slovo Vaseg imena mora biti veliko slovo. Izbaceni ste!");
- }
- }
- }
- else if(i == pos + 1)
- {
- switch(source[i])
- {
- case 'A' .. 'Z': continue;
- default:
- {
- return KickMessage(playerid, 0xFF3636FF, "Prvo slovo Vaseg prezimena mora biti veliko slovo. Izbaceni ste!");
- }
- }
- }
- else
- {
- switch(source[i])
- {
- case 'a' .. 'z': continue;
- case '_': continue;
- case '0' .. '9':
- {
- return KickMessage(playerid, 0xFF3636FF, "Vas nick ne smije da sadrzi brojeve. Izbaceni ste!");
- }
- default:
- {
- return KickMessage(playerid, 0xFF3636FF, "Vas nick smije da sadrzi samo slova abecede i donju crticu. Izbaceni ste!");
- }
- }
- }
- }
- return 1;
- }
- stock KickMessage(playerid, color, const message[])
- {
- SendClientMessage(playerid, color, message);
- SetTimerEx("KickPlayer", 100, false, "d", playerid);
- return 1;
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //-------------------------------------[public]---------------------------------------------------//
- forward KickPlayer(playerid);
- public KickPlayer(playerid)
- {
- Kick(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement