Help with sound plz.
#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


Messages In This Thread
Help with sound plz. - by Doppeyy - 10.08.2009, 23:18
Re: Help with sound plz. - by saiberfun - 10.08.2009, 23:20
Re: Help with sound plz. - by Doppeyy - 10.08.2009, 23:21
Re: Help with sound plz. - by saiberfun - 10.08.2009, 23:34
Re: Help with sound plz. - by Rizard - 10.08.2009, 23:43
Re: Help with sound plz. - by Doppeyy - 11.08.2009, 00:17

Forum Jump:


Users browsing this thread: 1 Guest(s)