Hi Guys,
I'd like to send a special variable from one user to another.
1) Is there a direct way to do this, or just going through the server ?
2) On the server side, si there a simpler way to get the user than sending the username in the parameters, then running a for :
[code]for(var i = 0 ; i < peopleInTheRoom ; i++)
{
var userIs = peopleInTheRoom[i]
if(userIs.getName() == params.targetUser)
{ etc } ...
[/code]
3) Can I create a place where two users can play individually and sepparate from the rest without creating a new room ?
?
Three questions :)
-
GolceaVlad
- Posts: 36
- Joined: 23 Aug 2010, 17:55
Hi.
For more information you can check the AS2 API: http://www.smartfoxserver.com/docs/docP ... ectToGroup
For more information you coud check the Serverside AS API:
http://www.smartfoxserver.com/docs/docP ... erById.htm
You can use the sendObjectToGroup() method, by using it like: sendObjectToGroup(object, [the name of the user you want to send the object]).GolceaVlad wrote:I'd like to send a special variable from one user to another.
1) Is there a direct way to do this, or just going through the server ?
For more information you can check the AS2 API: http://www.smartfoxserver.com/docs/docP ... ectToGroup
Yes, there is. You can get an user by its Id, by using _server.getUserById(Id), so you would only need to send the id of the user in the params.GolceaVlad wrote:2) On the server side, si there a simpler way to get the user than sending the username in the parameters, then running a for :
Code: Select all
for(var i = 0 ; i < peopleInTheRoom ; i++) { var userIs = peopleInTheRoom[i] if(userIs.getName() == params.targetUser) { etc } ...
For more information you coud check the Serverside AS API:
http://www.smartfoxserver.com/docs/docP ... erById.htm
Well, in my opinion, its better if you create a dynamic game room, where the players can play.GolceaVlad wrote:3) Can I create a place where two users can play individually and sepparate from the rest without creating a new room ?
?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
-
GolceaVlad
- Posts: 36
- Joined: 23 Aug 2010, 17:55
Hum... For example you could call all the game rooms by starting its names by "Game-", for example: "Game-TicTacToe", "Game-Snake",.... Then in the client-side you could analyse the roomnames and then put the games in one section and the other ones in the other section.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.