SA-MP Forums Archive
Little Help - 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: Little Help (/showthread.php?tid=312805)



Little Help - Thedya - 22.01.2012

Guys i just wanna add ''50'' radius for the other players. Now when choose any case, all of server can hear the voice. I dont want this. I just need adding radius. Can you help ?

Код:
if(response)
    {
    switch(dialogid == 3030)
        {
                case 1:
            {
                switch(listitem)
                {
                    case 0://
                    {
for(new i = 0, j = GetMaxPlayers(); i < j; i++) {
	if(PlayAudioStreamForPlayer(i, "http://k004.kiwi6.com/hotlink/9rrqj92k8t/pitbull_suavemente_feat_nayer_mohombi_new_song_2011.mp3")) {
	}
}
                    }



Re: Little Help - Gerira Gaijin - 22.01.2012

Add a loop...

pawn Код:
for(new i=0;i<MAX_PLAYERS;i++)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(i, X, Y, Z);
    if(IsPlayerInRangeOfPoint(playerid, 50, X, Y, Z)
    {
         // rest of your code here...
    }
}



Re: Little Help - Thedya - 22.01.2012

Thanks but, i do not understand one point.

if(IsPlayerInRangeOfPoint(playerid, 50, X, Y, Z)

X,Y,Z must i write some of cordinate on there?


Re: Little Help - Gerira Gaijin - 22.01.2012

GetPlayerPos sets the X,Y,Z variables that we created in the line above, to some player's position.


Re: Little Help - Thedya - 22.01.2012

so its random point?


Re: Little Help - Gerira Gaijin - 22.01.2012

The code above gets the position of every player (player is "i"). GetPlayerPos gets the position of "i" player, and X, Y, Z are the co-ordinates of that "i" player. Basically, it checks the position of every player online.


Re: Little Help - Thedya - 22.01.2012

Thanks for your help Gerira.. +rep


Re: Little Help - Thedya - 22.01.2012

Ah 1 sec, can you add this to on my code for show me the example ?

Код:
if(response)
    {
    switch(dialogid == 3030)
        {
                case 1:
            {
                switch(listitem)
                {
                    case 0://
                    {
for(new i = 0, j = GetMaxPlayers(); i < j; i++) {
	if(PlayAudioStreamForPlayer(i, "http://k004.kiwi6.com/hotlink/9rrqj92k8t/pitbull_suavemente_feat_nayer_mohombi_new_song_2011.mp3")) {
	}
}
                    }
                    case 1: //
                    {
And this is yours

Код:
for(new i=0;i<MAX_PLAYERS;i++)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(i, X, Y, Z);
    if(IsPlayerInRangeOfPoint(playerid, 50, X, Y, Z)
    {
         // rest of your code here...
    }
}
Can you consolidate them ?


Re: Little Help - Thedya - 22.01.2012

Nobody ?