Help with sound plz.
#1

Hi guys me and a friend made a custom club in LV.
but now we want to play sound when you are in the area.
how do you play sounds when a player is in a specific area ?
and when he moves outside the area the sound stops ?

/Artix
Reply
#2

check if IsPlayerToPoint by a timer and if he's not.
Reply
#3

a little bit more explaination would be nice
i say i dont know how to do it.
and you only say that ?

/Artix
Reply
#4

Quote:
Originally Posted by [RiFA
Artix ]
a little bit more explaination would be nice
i say i dont know how to do it.
and you only say that ?

/Artix
well u could research i don't have to script it for you
just giving u some ideas^^
Reply
#5

trying to give you some info on that one

somwhere in your gamemode (outside a public function):
pawn Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:temPposx, Float:temPposy, Float:temPposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    temPposx = (oldposx -x);
    temPposy = (oldposy -y);
    temPposz = (oldposz -z);
    if (((temPposx < radi) && (temPposx > -radi)) && ((temPposy < radi) && (temPposy > -radi)) && ((temPposz < radi) && (temPposz > -radi)))
    {
        return 1;
    }
    //----------------------------------------------------------------------------------------------------------------------------speedo
    /*new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z);
    if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    { return true; }*/

    //-----------------------------------------------------------------------------------------------------------------------stop speedo
    return 0;
}
on top:
pawn Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
somewhere in your gamemode again (also outside a public, cause this is one 2):
pawn Код:
public IsPlayerNearClub(playerid)
{
  if(PlayerToPoint(50.0,playerid,your x,your y,your z)) // change the radius (50.0) if needed, and the coцrdinates ofcourse
      {
     new Float:X,Float:Y,Float:Z;
         GetPlayerPos(playerid,X,Y,Z);
         PlayerPlaySound(playerid, 1139, X, Y, Z); // change the sound to what you would prefer (1139)
      }
  return 1;
}
in OnPlayerConnect:
pawn Код:
SetTimer("IsPlayerNearClub(playerid)",1000,1); //1000 is checking every second
EDIT:
forgot to kill the timer
in OnPlayerDisconnect:
pawn Код:
KillTimer(IsPlayerNearClub(playerid));
I am a beginner as well, report with any bugs ...

Hopes it helps

grts Riz
Reply
#6

thnQ that helped me allot i think i can figure it out now

/Artix
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)