22.02.2014, 12:10
Hello, can someone say me how to make an Anti Caps Lock System? Please give me an example then.
stock low(s[])
{
for(new i=0; s[i] != EOS; i++)
s[i] = ((s[i] > 31) && (s[i] < 59)) ? (s[i]) : (tolower(s[i]));
}
new mystring[] = "CAPslockKK!!";
printf("before: %s",mystring);
low(mystring);
printf("after: %s",mystring);
stock low(s[])
{
for(new i=0; s[i] != EOS; i++)
s[i] = ((s[i] > 31) && (s[i] < 59)) ? (s[i]) : (tolower(s[i]));
}
before: CAPSlockKKK!! after: capslockkkk!!
public OnPlayerText(playerid, text[])
{
if(IsTextCaps(text))
{
SendClientMessage(playerid, 0xFF0000FF, "Turn off your caps!");
return 0; // Will not send the text
}
return 1;
}
stock IsTextCaps(text[])
{
for(new i, j = strlen(text)-1; i < j; i ++)
{
if(('A' <= text[i] <= 'Z') && ('A' <= text[i+1] <= 'Z')) // If the letters were in CAPS
return 1;
}
return 0;
}