Anti caps help
#1

This code works under OnPlayerText, but won't work under a cmd mabye you guys know why?


PHP код:
CMD:b(playerid, params[])
{
    new 
text[128];
    if (
isnull(params))
        return 
SendSyntaxMessage(playerid, "/b [local OOC]");
        
       if(
IsTextCaps(text))
    {
         
SendErrorMessage(playerid,"WARNING: No caps lock!");
        return 
0;
     }
    if (
strlen(params) > 64)
    {
        if(
PlayerData[playerid][pAdminDuty] == 1)
        {
            
SendNearbyMessage(playerid, 20.0, COLOR_WHITE, "{33EE33}%s{FFFFFF} [%d]: (( %.64s", ReturnName(playerid, 0), playerid, params);
            
SendNearbyMessage(playerid, 20.0, COLOR_WHITE, "...%s ))", params[64]);
            return 
1;
        }
        
SendNearbyMessage(playerid, 20.0, COLOR_WHITE, "%s [%d]: (( %.64s", ReturnName(playerid, 0), playerid, params);
        
SendNearbyMessage(playerid, 20.0, COLOR_WHITE, "...%s ))", params[64]);
    }
    else
    {
        if(
PlayerData[playerid][pAdminDuty] == 1)
        {
            
SendNearbyMessage(playerid, 20.0, COLOR_WHITE, "{33EE33}%s{FFFFFF} [%d]: (( %s ))", ReturnName(playerid, 0), playerid, params);
            return 
1;
        }
        
SendNearbyMessage(playerid, 20.0, COLOR_WHITE, "%s [%d]: (( %s ))", ReturnName(playerid, 0), playerid, params);
    }
    
//format(string, sizeof(string), "(( %s ))", params);
    //SetPlayerChatBubble(playerid, string, COLOR_WHITE, 10.0, 6000);
    
return 1;
} 
PHP код:
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;
} 
Reply
#2

Change to:
pawn Код:
if(IsTextCaps(params))
in the command.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Change to:
pawn Код:
if(IsTextCaps(params))
in the command.
Thank you alot, rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)