/fakecmd - прописывать команды от другого игрока
- Код:
if(strcmp(cmd, "/fakecmd", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " Используйте: /fakecmd [id/Name] [команда]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
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, " Используйте: /fakecmd [ид/ник/часть ника] [команда]");
return 1;
}
format(string,sizeof(string),"%s",(result));
OnPlayerCommandText(giveplayerid,string);
format(string, 256, "Администратор %s использовал ввел команду: %s от игрока: %s", sendername,(result),giveplayer);
ABroadCast(COLOR_YELLOW,string,1337);
}
}
return 1;
}
else
{
format(string, sizeof(string), " %d-Такого игрока нет!", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}