SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 26/10/2010, 05:07 PM   #1
Mattjones17
Big Clucker
 
Join Date: Sep 2008
Posts: 105
Reputation: 0
Default Question regarding playerid (noob question!)

Hi,

Say I want to use:

Audio_Play(playerid, 1, false, false, false);

How can I do it so that instead of playing just for 'playerid' (ie the person who triggered it), it does it globally?

The same goes for any function that calls playerid. How can I get it so it does something to EVERYONE and not that individual player?

Thanks

Matt
Mattjones17 is offline  
Old 26/10/2010, 05:09 PM   #2
BMUK
Gangsta
 
Join Date: Feb 2007
Posts: 801
Reputation: 71
Default Re: Question regarding playerid (noob question!)

http://wiki.sa-mp.com/wiki/Loop
BMUK is offline  
Old 26/10/2010, 05:09 PM   #3
Double-O-Seven
Guest
 
Posts: n/a
Default Re: Question regarding playerid (noob question!)

For everyone:
Code:
for(new i=0;i<MAX_PLAYERS;i++)//"i" instead of "playerid"
{
	if(IsPlayerConnected(i))
	{
		Audio_Play(i, 1, false, false, false);
		//More things for each player.
	}
}
 
Old 26/10/2010, 05:12 PM   #4
The_Moddler
High-roller
 
The_Moddler's Avatar
 
Join Date: Jan 2010
Location: In my house.
Posts: 1,141
Reputation: 3
Default Re: Question regarding playerid (noob question!)

Actually, if you want to optimize your script, you should download 'foreach', it does the same thing but faster.
__________________
The_Moddler is offline  
Old 26/10/2010, 05:18 PM   #5
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 8,133
Reputation: 701
Default Re: Question regarding playerid (noob question!)

Quote:
Originally Posted by The_Moddler View Post
Actually, if you want to optimize your script, you should download 'foreach', it does the same thing but faster.
+1 on this idea
Scenario is offline  
Old 27/10/2010, 04:21 PM   #6
Mattjones17
Big Clucker
 
Join Date: Sep 2008
Posts: 105
Reputation: 0
Default Re: Question regarding playerid (noob question!)

Quote:
Originally Posted by The_Moddler View Post
Actually, if you want to optimize your script, you should download 'foreach', it does the same thing but faster.
Quote:
Originally Posted by Double-O-Seven View Post
For everyone:
Code:
for(new i=0;i<MAX_PLAYERS;i++)//"i" instead of "playerid"
{
	if(IsPlayerConnected(i))
	{
		Audio_Play(i, 1, false, false, false);
		//More things for each player.
	}
}


Worked great, thanks.

I will definately consider 'foreach' - sounds very useful!

Thanks!
Mattjones17 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 noob question ;D killer98p Help Archive 13 19/08/2010 10:20 AM
Help? Noob question Sam-819 Client Support 6 11/02/2010 06:31 PM
Noob question :$ Shellegg Help Archive 8 01/04/2009 01:22 AM


All times are GMT. The time now is 07:57 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.