Данная команда позволяет воспроизводить текст.
Code
else if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/mg", true) == 0)
{
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)) return SendClientMessage(playerid, -1, "» Введите: /megaphone(/mg) [текст]. ");
format(string, sizeof(string), "- %s сказал(а) в мегафон: %s ", sendername, result);
ProxDetector(20.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
AudioMess(playerid,20,result);
return 1;
}
Code
stock AudioMess(id,rad,str[]) {
new Float:px,Float:py,Float:pz;
GetPlayerPos(id,px,py,pz);
new stream[256];
format(stream,sizeof(stream),"http://translate.google.kg/translate_tts?ie=UTF-8&q=%s&tl=ru&prev=input",str);
for(new i=0; i != MAX_PLAYERS; i++) {
if(IsPlayerInRangeOfPoint(i,rad,px,py,pz) && GetPlayerVirtualWorld(id) == GetPlayerVirtualWorld(i)) {
PlayAudioStreamForPlayer(i,stream);
}
}
return 1;
}
Автор: Agada