SA-MP Forums Archive
Anti caps help - 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: Anti caps help (/showthread.php?tid=604187)



Anti caps help - Hellman92 - 01.04.2016

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


PHP код:
CMD:b(playeridparams[])
{
    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(playerid20.0COLOR_WHITE"{33EE33}%s{FFFFFF} [%d]: (( %.64s"ReturnName(playerid0), playeridparams);
            
SendNearbyMessage(playerid20.0COLOR_WHITE"...%s ))"params[64]);
            return 
1;
        }
        
SendNearbyMessage(playerid20.0COLOR_WHITE"%s [%d]: (( %.64s"ReturnName(playerid0), playeridparams);
        
SendNearbyMessage(playerid20.0COLOR_WHITE"...%s ))"params[64]);
    }
    else
    {
        if(
PlayerData[playerid][pAdminDuty] == 1)
        {
            
SendNearbyMessage(playerid20.0COLOR_WHITE"{33EE33}%s{FFFFFF} [%d]: (( %s ))"ReturnName(playerid0), playeridparams);
            return 
1;
        }
        
SendNearbyMessage(playerid20.0COLOR_WHITE"%s [%d]: (( %s ))"ReturnName(playerid0), playeridparams);
    }
    
//format(string, sizeof(string), "(( %s ))", params);
    //SetPlayerChatBubble(playerid, string, COLOR_WHITE, 10.0, 6000);
    
return 1;

PHP код:
stock IsTextCaps(text[])
{
    for(new 
istrlen(text)-1j++)
    {
        if((
'A' <= text[i] <= 'Z') && ('A' <= text[i+1] <= 'Z')) // If the letters were in CAPS
        
return 1;
    }
    return 
0;




Re: Anti caps help - Konstantinos - 01.04.2016

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


Re: Anti caps help - Hellman92 - 01.04.2016

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