01.04.2016, 19:05
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;
}