Error in script : replace totalUser by Ape.totalUser

On Wed, 10 Nov 2010 01:22:49 +0100, <[email protected]> wrote:
> Exemple (assuming you are only using channel for that purpose) :
> 
> Ape.totalUser = 0;
> 
> Ape.registerCmd('dispatchJoin', true, function(params, cmd) {
>       if (totalUser%2 == 0) {
>               var channel = (totalUser%2 == 0 ? Ape.mkChan('room' + 
> totalUser/2) :
> Ape.getChannelByName('room' + (totalUser-1)/2)); /* Create or get the
> proper channel */
>       }
>       cmd.user.join(channel);
> });
> 
> Ape.registerHookCmd('join', function(params, cmd) {
>       return 0;
> });
> 
> Ape.addEvent('afterJoin', function(channel, user) {
>       Ape.totalUser++;
> });
> 
> Ape.addEvent('left', function(channel, user) {
>       Ape.totalUser--;
> )};
> 
> 
> 
> On Wed, 10 Nov 2010 01:15:28 +0100, <[email protected]> wrote:
>> Sorry I didn't understand.
>> If you have a script that works find, where is the problem ?
>> 
>> There is several way to do what you want
>> 
>> - Create a new command with the help of Server-side JS
>>
>
(http://www.ape-project.org/wiki/index.php/How_to_create_a_server_Module)
>> that force the user to join a channel (user.join(channel) <= the
channel
>> object must be created with Ape.mkChan('name') first. Disabling the
> default
>> "JOIN" command by hooking the commande (Ape.registerHookCmd("join",
>> function(params, cmd) { return 0 });
>> 
>> - Or simply just hook the default "JOIN" cmd and control how many
people
>> are already in the channel.
>> 
>> Anthony
>> 
>> On Tue, 9 Nov 2010 15:57:10 -0800 (PST), harmo <[email protected]>
>> wrote:
>>> Hello !
>>> I've just start a project of a "live game online", and I want to limit
>>> acces to two users by channel.
>>> I script a counter for detect and limit connexions, it's work fine,
>>> but now I want to create new channel when user 3 and user 4 want to
>>> connect (the game is for 2 players max).
>>> How can I do this ?

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to