Caps Lock - 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)
+--- Thread: Caps Lock (
/showthread.php?tid=321602)
Caps Lock -
]Rafaellos[ - 27.02.2012
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!
Re: Caps Lock -
ProdrifterX - 27.02.2012
very good idea. but how?
______________________________________
IP :
188.40.57.132:7777
Drift - Generation
Re: Caps Lock -
]Rafaellos[ - 28.02.2012
I don't know how to do it, that why I create a topic here :P
Re: Caps Lock -
Vince - 28.02.2012
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.
Re: Caps Lock -
]Rafaellos[ - 28.02.2012
Thanks but not working
Re: Caps Lock -
]Rafaellos[ - 28.02.2012
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?
Re: Caps Lock -
Konstantinos - 28.02.2012
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;
}
Re: Caps Lock -
]Rafaellos[ - 28.02.2012
Thank you so much!
Και όπως βλέπω είσαι έλληνας; Σε ευχαριστώ πολύ!
Re: Caps Lock -
Konstantinos - 28.02.2012
No problem!
Ναι! Κανένα πρόβλημα.