SA-MP Forums Archive
Music script - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Music script (/showthread.php?tid=160011)



Music script - Loppa - 15.07.2010

I created this script:
Quote:

forward music();

public music()
{
new i;
for(i=0; i<=MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 35, 100, 100, 100))
{
GameTextForPlayer(i, "~w~Music is now ~g~on", 5000, 5);
PlayerPlaySound(i, 1068, 100, 100, 100);


}else{

GameTextForPlayer(i, "~w~Music is now ~r~off", 5000, 5);
PlayerPlaySound(i, 1069, 100, 100, 100);
}

}
}return 1;
}

And it works with a timer:

Quote:

SetTimer("music",595,1);

But it doens't work. Well i mean that nothing work. It doesn't show the textdraw + the music don't work. Someone here knows why? And if you have any suggestion about a script that turn on a music when the player is in a certain part of the map and turn it off when he leave the area please post it here!


Re: Music script - Lorenc_ - 15.07.2010

Hmm, im not focusing at the code but you might have a pirated version of gta sa? thats what is disallowing it to work. Otherwise it must be wrong with the code.


Re: Music script - (SF)Noobanatior - 15.07.2010

code looks fine to me where are you setting the timer?


Re: Music script - Finn - 15.07.2010

Are you in range of this point: if(IsPlayerInRangeOfPoint(i, 35, 100, 100, 100))?


Re: Music script - Joe_ - 15.07.2010

pawn Код:
public music()
{
    for(new a = 0, b = GetMaxPlayers(); a < b; a++)
    {
        if(IsPlayerInRangeOfPoint(a, 35.0, 100.0, 100.0, 100.0))
        {
            GameTextForPlayer(a, "~w~Music is now ~g~on", 5000, 5);
            PlayerPlaySound(a, 1068, 100, 100, 100);
        }
        else
        {
            GameTextForPlayer(a, "~w~Music is now ~r~off", 5000, 5);
            PlayerPlaySound(a, 1069, 100, 100, 100);
        }
    }
   
    return 1;
}
Try that, but I don't think the floatpoints in PlayerPlaySound work.


Re: Music script - Hiddos - 15.07.2010

pawn Код:
if(IsPlayerInRangeOfPoint(i, 35, 100, 100, 100))
I guess you don't even know 20% about what you're actually doing here.