PDA

View Full Version : pluginUserEnter and playerNumber



crusader
10-27-2004, 06:49 PM
Hello.

Jobe, Mike, I have a question for you.

It seems to me that when a user enters a game room with a room plugin,
the server automatically assings a number >=0 for normal users
and -1 for spectators.

Is that so?

The following function gave me:
0
1
-1
-1

function pluginUserEnter(username, playerNumber) {
trace(playerNumber)
}

jobem
10-27-2004, 06:52 PM
Hi crus,

Yes it numbers them. But I cannot remember if it gives -1 for spectators. How are you indicating if someone is a spectator or not? (i.e. how would the plug-in know the difference?)

crusader
10-27-2004, 07:21 PM
Hi Jobe, thanks for replying.

I guess that the server knows if a user is a spectator from the function joinGame():

ElectroServer.joinGame(room,password,playerType,zo ne), where playerType is either "player" or "spectator"

I think that this variable is passed somehow to the plugin.

Could you please make sure how this works? I want to treat a spectator differently than a player
(store his username in another array, send differenent messages etc) so I really need to know
how spectators are different that players inside a plugin (i.e. I want to make sure that -1 always reffers to a spectator)

Thanks

jobem
10-27-2004, 08:58 PM
Hi Dimitrios,

I just verified it. I totally forgot that we put that in there :) You understand it correctly. If you are a player then you get numbered, else you don't.

crusader
10-27-2004, 09:07 PM
Ok Jobe, thanks a lot. That's great, it works perfectly for me!

Thanks :)