SA-MP Forums Archive
How to attach ringtone to player? - 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: How to attach ringtone to player? (/showthread.php?tid=186669)



How to attach ringtone to player? - cywil - 30.10.2010

Код:
...
		GameTextForPlayer(odbiorcaid, string, 15500, 3);

						new Float: x, Float: y, Float: z;
		        		GetPlayerPos(odbiorcaid, x, y, z);
		        		format(string, sizeof(string), "%s", PhoneRings[PlayerData[odbiorcaid][pPhoneMusic]-1]);
	  					foreach(i, MAX_PLAYERS)
				        {
				            if(IsPlayerInRangeOfPoint(i, 10, x, y, z))
				            {
					        	RingToneHandle[i] = Audio_PlayStreamed(i, string);
								Audio_Set3DPosition(i, RingToneHandle[i], x, y, z, 5);
							}
				        }
...
How to attach Ringtone to player position (ringtone walking with player)? This is my script, ringtone don't "walk" with player. Sorry for my bad English. Thanks.


Re: How to attach ringtone to player? - Mauzen - 30.10.2010

I never used the audio plugin, but i think you have tu use a timer, that updates the sound and sets its position to the players position every 500-1000ms


Re: How to attach ringtone to player? - cywil - 30.10.2010

Thanks, but I don't have idea how to do that... I never use timers. Thanks for help.


Re: How to attach ringtone to player? - cywil - 30.10.2010

Can anybody help? It's very important. Sorry for double post. Thank You


Re: How to attach ringtone to player? - cywil - 30.10.2010

Sorry guys, but I really need it. Mercy!!


Re: How to attach ringtone to player? - Sinner - 30.10.2010

Quote:
Originally Posted by cywil
Посмотреть сообщение
Thanks, but I don't have idea how to do that... I never use timers. Thanks for help.
on top of your gamemode
pawn Код:
forward Timer(playerid); //Tells the compiler theres a function called "Timer"
Wherever you want it to update
pawn Код:
SetTimerEx("Timer", 1000, 0, "%d", playerid); //Timer will update every 1000ms, non repeating, has an integer as a type, will do this for playerid
function would be
pawn Код:
public Timer(playerid) //Function that will be called when you run the timer
{
        ...
}
That's in a nutshell how to use timers, read a tutorial about them if you still don't understand.


Re : How to attach ringtone to player? - Amine_Mejrhirrou - 30.08.2011

amm now ther is Audio_Set3DPosition (Plugin made by Incognito) i dont know how to use it yet but this is what u looking for i guess