Author Topic: All Caps Preventer.  (Read 2969 times)

Could someone make something like E-Tard filter or Curse Filter that checks if your typing in Full caps or not. Im fed up of people TYPING LIKE THIS IT GETS REALLY ANNOYING.



Easy....
Code: [Select]
package NotAllCaps {
function ServerCmdmessagesent(%client, %text){
%test = strupr(%text);
if(%test $= %text){
messageclient(%client,"","Please do not type in all caps.");
return;
}
parent::ServerCmdMessagesent(%client, %text);
}
};
activatepackage(NotAllCaps);

Might have to check that messagesent is the right command...:P

I thought it said "All Caps Perverter."

CAPS LOCK IS CRUISE CONTROL FOR AWESOME!!!1!




Thanks Aloshi, Shall try.

Once you type in all caps you cant type anymore, even if your not talking in all caps it says Please do not use all caps.
« Last Edit: June 03, 2007, 08:55:18 AM by MrPickel »

If it was like the Age of Time one, where anything above half caps is counted as "All Caps". In Aloshi's, someone could say "A REALLY LONG YELLING SENTENCE caps prevent" and get no message.

Change the message as you want:
Code: [Select]
package AllCaps {
function serverCmdMessageSent(%client, %message){
%length = strlen(%message);
if(%length < 5){
Parent::serverCmdMessageSent(%client, %message);
return;
}
%capscount = 0;
for(%i=0;%i<%length;%i++){
%char = getSubStr(%message, %i, 1);
if(strlwr(%char) !$= %char)
%capscount++;
}
if(%capscount > %length/2)
messageClient(%client, "", "CAPS LOCK IS CRUISE CONTROL FOR COOL!");
else
Parent::serverCmdMessageSent(%client, %message);
}
};
ActivatePackage(AllCaps);

[Edit] Doesn't work, apparently ifs can't differentiate between caps and non caps.

[Edit] I found a solution.
Code: [Select]
package AllCaps {
function isCaps(%char){
// Really hacky, but I can't think of a better way
if(%char $= "")
return 0;
%check = strreplace(strupr(%char), %char, "");
if(%check $= "")
return 1;
else
return 0;
}
function serverCmdMessageSent(%client, %message){
%length = strlen(%message);
if(%length < 5){
Parent::serverCmdMessageSent(%client, %message);
return;
}
%capscount = 0;
for(%i=0;%i<%length;%i++){
%char = getSubStr(%message, %i, 1);
if(isCaps(%char))
%capscount++;
}
if(%capscount > %length/2)
messageClient(%client, "", "CAPS LOCK IS CRUISE CONTROL FOR COOL!");
else
Parent::serverCmdMessageSent(%client, %message);
}
};
ActivatePackage(AllCaps);
« Last Edit: June 05, 2007, 11:04:13 AM by Randy »


Thanks Randy have love <3