Cap Key Disable
#1

Hey,

On alot of my newer servers I try to prevent the use of CAPS. I think it makes the chat look rather horrid therefor I have chosen to introduce a new method of disabling the caps lock key.

Here is my code:

pawn Код:
stock DisableCaps(text[])
{
    for(new n=0; n<strlen(text); n++)
    {
        for(new nx=0; nx<sizeof(CapsL); nx++)
        {
            if(text[n] == CapsL[nx])
            {
                text[n] = NCaps[nx];
            }
        }
    }
    return text;
}
new CapsL[26][] =
{
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
    "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
};

new NCaps[26][] =
{
    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
    "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
};
However this is incorrect for some reason.

Код:
C:\Users\Michael\Desktop\Los Santos Cops And Robbers\gamemodes\Server.pwn(155) : error 033: array must be indexed (variable "CapsL")
C:\Users\Michael\Desktop\Los Santos Cops And Robbers\gamemodes\Server.pwn(157) : error 006: must be assigned to an array
C:\Users\Michael\Desktop\Los Santos Cops And Robbers\gamemodes\Server.pwn(526) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
pawn Код:
public OnPlayerText(playerid,text[])
{
    if(DisablePlayersCapKeys[playerid])
    {
        new Text[128];
        format(Text,sizeof(Text),"%s",DisableCaps(playerid));
        SendClientMessageToAll(GetPlayerColor(playerid),Text);
        return 0;
    }
    return 1;
}
Could anyone help me please
Reply
#2

try putting this under onplayertext or if you want a command use a boolean
Код:
for(new i=0;i<strlen(text);i++)text[i] = tolower(text[i]);
Reply
#3

Remove 2nd pair of square brackets
pawn Код:
new CapsL[26][]
Turns into

pawn Код:
new CapsL[26]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)