SA-MP Forums Archive
TTS Script compiles perfectly ,but didn't work in-game :'( - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: TTS Script compiles perfectly ,but didn't work in-game :'( (/showthread.php?tid=611288)



TTS Script compiles perfectly ,but didn't work in-game :'( - Youssefree - 04.07.2016

I want all the players in range of a player will hear what he said.
Quote:

// This is a comment
// uncomment the line below if you want to write a filterscript
//define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" fs");
print("--------------------------------------\n");
return 1;
}

public OnPlayerText(playerid, text[])
{
if IsPlayerInRangeOfPoint(playerid, 7.0, 1,1,1)
*then
new pText[144];
format(pText, sizeof (pText), "(%d) %s", playerid, text);
PlayAudioStreamForPlayer(playerid,"http://soundoftext.com/static/sounds/en/%s.mp3",1,1,1,7.0,1);
}
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" fs");
print("----------------------------------\n");
}

#endif




Re: TTS Script compiles perfectly ,but didn't work in-game :'( - Runn3R - 04.07.2016

It will only play for the player that typed that.

And the api doesn't work.


Re: TTS Script compiles perfectly ,but didn't work in-game :'( - d1git - 04.07.2016

Код:
public OnPlayerText(playerid, text[]) {
    new pText[144], Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z);
    format(pText, sizeof (pText), "http://soundoftext.com/static/sounds/en/%s.mp3", text);
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerInRangeOfPoint(i, 7.0, x, y, z) {
            PlayAudioStreamForPlayer(i, pText, x, y, z, 7.0, 1);
        }
    }
    return 1;
}



Re: TTS Script compiles perfectly ,but didn't work in-game :'( - Youssefree - 04.07.2016

Quote:
Originally Posted by Runn3R
Посмотреть сообщение
It will only play for the player that typed that.

And the api doesn't work.
I knew that! i need an API :/ .
Quote:
Originally Posted by d1git
Посмотреть сообщение
Код:
public OnPlayerText(playerid, text[]) {
    new pText[144], Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z);
    format(pText, sizeof (pText), "http://soundoftext.com/static/sounds/en/%s.mp3", text);
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerInRangeOfPoint(i, 7.0, x, y, z) {
            PlayAudioStreamForPlayer(i, pText, x, y, z, 7.0, 1);
        }
    }
    return 1;
}
Thanks , when i release it , i will mention your name and Runn3ER's name in the credits