Caps Lock
#1

Hello everyone,

I have a big problem in my server with the caps, but i dont want to disable them with luxadmin because i dont like the smilies from to :d.

So i want a code that if player type 2 letters with caps or more, return a message that it will says. "Disable the caps and rewrite" or something like this.

Thank you!

*Sorry for my bad english!
Reply
#2

very good idea. but how?
______________________________________
IP : 188.40.57.132:7777
Drift - Generation
Reply
#3

I don't know how to do it, that why I create a topic here :P
Reply
#4

Something like this, maybe;
pawn Код:
stock IsCaps(text[])
{
    for(new i, j = strlen(text)-1; i < j; i++)
    {
        if(('A' <= text[i] <= 'Z') && ('A' <= text[i+1] <= 'Z'))
            return true;
    }
    return false;
}
Not tested.
Reply
#5

Thanks but not working
Reply
#6

Something like this:

Код:
public OnPlayerText(playerid, text[])
{
  for(new i=1; i<strlen(text); i++)
  {
    if(text[i] > 64 && text[i]< 91) text[i] += 32;
  }
  return 1;
}
This one let only the first letter to be caps, and the other it change it.

How we can change it to let only one, and return a message?
Reply
#7

pawn Код:
public OnPlayerText( playerid, text[ ] )
{
    if( IsCaps( text ) )
    {
        SendClientMessage( playerid, -1, "Disable the caps and rewrite" );
        return 0;
    }
    return 1; // Returns 0 only if you want to send a custom Chat.
}

stock IsCaps( text[ ] )
{
    for( new i, j = strlen( text )-1; i < j; i ++ )
    {
        if( ( 'A' <= text[ i ] <= 'Z' ) && ( 'A' <= text[ i+1 ] <= 'Z' ) )
            return true;
    }
    return false;
}
Reply
#8

Thank you so much!

Και όπως βλέπω είσαι έλληνας; Σε ευχαριστώ πολύ!
Reply
#9

No problem!

Ναι! Κανένα πρόβλημα.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)