Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock IsRPName(name[], minname = 3, bool:firstupperthenlower = true) //By Nickk888
- {
- new count, checknumcount, where, tmpname[24], tmpsname[24];
- new len = strlen(name);
- for(new i; i < len; i++) {
- if(name[i] == '_')
- count++,
- where = i;
- switch(name[i]) {
- case 'A'..'Z', 'a'..'z', '_':
- checknumcount++;
- }
- }
- if(count != 1 || (where < minname || len < ((where + 1) + minname)) || checknumcount != len)
- return 0;
- strmid(tmpname, name, 0, where);
- strmid(tmpsname, name, where+1, len);
- checknumcount = 0;
- if(firstupperthenlower) {
- switch(tmpname[0]) {
- case 'A'..'Z':
- checknumcount++;
- }
- for(new i = 1, j = strlen(tmpname); i < j; i++){
- switch(tmpname[i]) {
- case 'a'..'z':
- checknumcount++;
- }
- }
- switch(tmpsname[0]) {
- case 'A'..'Z':
- checknumcount++;
- }
- for(new i = 1, j = strlen(tmpsname); i < j; i++){
- switch(tmpsname[i]) {
- case 'a'..'z':
- checknumcount++;
- }
- }
- if((checknumcount + 1) != len)
- return 0;
- }
- return 1;
- }
- stock IsNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- forward bool:IsStrValid(string[]);
- stock bool:IsStrValid(string[])
- {
- new num;
- new len = strlen(string);
- for(new i; i < len; i++)
- switch(string[i])
- {
- case 'A'..'Z':num++;
- case 'a'..'z':num++;
- case '0'..'9':num++;
- }
- if(num == len) return true;
- else return false;
- }
- stock ClearPlayerChat(playerid)
- {
- for(new i; i < 15; i++)
- SendClientMessage(playerid, -1, "");
- return 1;
- }
- stock PlayerName(playerid)
- {
- new gname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, gname, MAX_PLAYER_NAME);
- return gname;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement