Korbell
Изучающий
- Регистрация
- 15 Ноя 2010
- Сообщения
- 511
- Лучшие ответы
- 0
- Репутация
- 37
Собственно вот)
PHP:
if(strcmp(cmd, "/комманда", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1) // проверка на админа, 0 выключит проверку.
{
tmp = strtok(cmdtext, idx);
new txtid;
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " ИНФО: /комманда <текст> ");
return 1;
}
txtid = strval(tmp);
if(txtid == 2)
{
SendClientMessage(playerid, COLOR_GRAD2, " Вы не можете выбрать 2");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, " ИНФО: /комманда <текст> [textformat ~n~=Newline ~r~=Red ~g~=Green ~b~=Blue ~w~=White ~y~=Yellow]");
return 1;
}
format(string, sizeof(string), "~w~%s",result);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
GameTextForPlayer(i, string, 5000, txtid);
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Нет прав использовать комманду!");
return 1;
}
}
return 1;
}