Hello the anti caps lock thing is not working, how to fix it?
Код:
new string[128]; format(string, sizeof(string),"{FFFF00}Team Chat %s : %s", PlayerName(playerid), text[1]); if(IsCaps(string)) { SendClientMessage(playerid,COLOR_RED" No Caps!"); return 0; } for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && team[i] == team[playerid]) SendClientMessage(i, -1, string); } return 0; } Код:
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; } |
if(IsCaps(string)) { SendClientMessage(playerid,COLOR_RED" No Caps!"); return 0; } for(new i = 0; i < MAX_PLAYERS; i++) { new string[128] format(string, sizeof(string),"{FFFF00}Team Chat %s : %s", PlayerName(playerid), text[1]); if(IsPlayerConnected(i) && team[i] == team[playerid]) { SendClientMessage(i, -1, string); } return 0; }
stock IsCaps( text[ ] ) { for( new i = 0, j = strlen( text ); i < j; i ++ ) { if( ! ( 'A' <= text[ i ] <= 'Z' )) return false; } return true; }