14.10.2018, 01:29
(
Последний раз редактировалось Threshold; 15.10.2018 в 02:23.
)
PHP код:
CMD:tchat(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] < 1 && pInfo[playerid][Tester] < 1) return SendClientMessage(playerid, -1, ""COL_RED"EROARE: You are not admin or tester!");
if(!strlen(params)) return SendClientMessage(playerid, -1, ""COL_RED"TesterCmd: /tchat [Text]");
new Testerstring[144];
format(Testerstring, sizeof(Testerstring), ""COL_GREEN"[Tester Chat] %s %s[%d]: %s",
(pInfo[playerid][pAdminLevel]) ? (GetAdminName(playerid)) : (GetTesterName(playerid)), PlayerName(playerid), playerid, params);
SendMessageToAllTesters(Testerstring, -1);
return 1;
}
In your original code, you had two statements that queried whether the player was an admin, so if an admin was to use the command it would result in the message being sent twice. You should use 'return' to break the code to prevent it from continuing when you've achieved the result you want.
EDIT:
Quote:
If player is not helper but admin, the statement will be true because of OR. Change it to AND. |
Quote:
There is `isnull` macro, it is better checking first or second character than all of them (strlen). |