SA-MP Forums Archive
Non Roleplay Name - First letter and last letter of name must be capital! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Non Roleplay Name - First letter and last letter of name must be capital! (/showthread.php?tid=94628)



Non Roleplay Name - First letter and last letter of name must be capital! - Eazy_Efolife - 31.08.2009

Title says it all!

I don't know if this was asked already, I searched and I couldn't find it. I want it when a player connects and his First: first letter and his last letter of his name must be capitalized or he will be kicked!

How do you do that? I've seen it on a Couple of servers!


Re: Non Roleplay Name - First letter and last letter of name must be capital! - Nakash - 31.08.2009

Quote:
Originally Posted by Compton's Eazy E
Title says it all!

I don't know if this was asked already, I searched and I couldn't find it. I want it when a player connects and his First: first letter and his last letter of his name must be capitalized or he will be kicked!

How do you do that? I've seen it on a Couple of servers!
Not the last letter,the first letter of the Firstname,and the first letter of the Lastname.
The name will be like "Johnny_Capilu".


Re: Non Roleplay Name - First letter and last letter of name must be capital! - Eazy_Efolife - 31.08.2009

Yes like that


Re: Non Roleplay Name - First letter and last letter of name must be capital! - Eazy_Efolife - 31.08.2009

Bump


Re: Non Roleplay Name - First letter and last letter of name must be capital! - aspire5630 - 31.08.2009

Quote:
Originally Posted by Compton's Eazy E
Bump
Why bump!, Your topic cant always be thirst, Its called having patience


Re: Non Roleplay Name - First letter and last letter of name must be capital! - Google63 - 31.08.2009

Use brain, logic and conditions
I made one and it is really easy


Re: Non Roleplay Name - First letter and last letter of name must be capital! - Google63 - 31.08.2009

What if name is: Joebullet ... Your function will fail because you didn't check for if it has char _ at all... And numbers will be left


Re: Non Roleplay Name - First letter and last letter of name must be capital! - mprofitt - 31.08.2009

Код:
stock RPName(name[],ret_first[],ret_last[])
{	
	new len = strlen(name),
	point = -1,
	bool:done = false;
	for(new i = 0; i < len; i++) {
		if((name[i] > 64 && name[i] < 91) || (name[i] > 96 && name[i] < 123) || name[i] == 95) { 
			if(name[i] == 95) {
				if(point != -1) return 0;
				else {
					if(i == 0) return 0;
					point = i + 1;
				}
			} 
			else if(point == -1) {
				if(name[0] < 65 || name[0] > 90) return 0;
				if(i>0) { 
					if(name[i]<97 || name[i]>122) 
					return 0; 
				}
				ret_first[i] = name[i]; 
			}
			else {
				if(name[point]<65 || name[point]>90) return 0;
				if(i>point+1) { 
					if(name[i]<97 || name[i]>122) 
					return 0; 
				}
				ret_last[i - point] = name[i];
				done = true;
			}
		} else return 0;
	}
	if(!done) return 0;
	return 1;
}



Re: Non Roleplay Name - First letter and last letter of name must be capital! - Google63 - 31.08.2009

Quote:
Originally Posted by Seif_ [adream-rp.com
]
Quote:
Originally Posted by JoeBullet
What if name is: Joebullet ... Your function will fail because you didn't check for if it has char _ at all... And numbers will be left
Actually this function capitalizes your RP name. If you don't have a function that checks if it's valid(usually people do...), search in the Useful Functions section, there are plenty.

Oh and I quote what he said:
Quote:

I want it when a player connects and his First: first letter and his last letter of his name must be capitalized or he will be kicked!

He can easily change it to get the player kicked, but having this is better, because there's a SA-MP glitch where it sometimes connects you with a lowered case letter while you made it upper case.
Man, I surely do know how to script 'cuz i do programming in C so this is just easy as cake... i am speaking if someone dont know


Re: Non Roleplay Name - First letter and last letter of name must be capital! - Eazy_Efolife - 31.08.2009

Quote:
Originally Posted by aspire5630
Quote:
Originally Posted by Compton's Eazy E
Bump
Why bump!, Your topic cant always be thirst, Its called having patience
that was my only bump and it was passed 12 hour rule to bump a topic