Question regarding playerid (noob question!)
#1

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
Reply
#2

https://sampwiki.blast.hk/wiki/Loop
Reply
#3

For everyone:
pawn 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.
    }
}
Reply
#4

Actually, if you want to optimize your script, you should download 'foreach', it does the same thing but faster.
Reply
#5

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
Reply
#6

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:
pawn 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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)