I would like to allow a user to select a map style via a room graphic and then have that room be his/hers for the life of the account. User would store their furniture, room inventory, etc. The room would for obvious reasons be their name and the ability to set room permissions would also be their own.
I'm using smartfoxserver pro.
Ideas? Im not sure where to start or if its even possible after trying to research it on google.
Users have thier own rooms?
-
- Posts: 8
- Joined: 06 Jul 2014, 15:31
Re: Users have thier own rooms?
I would recommend you using dynamic rooms to create the users "house" as they login. This will temporarily create a room on the zone and will allow users to join it.
Example:
For the inventory/furniture, i'm guessing you would want the users to decorate their house? This could be done with some drag and drop coding and a little php to send the x and y position of the dragged item into a mysql database where their username/user id is.
Example on an item:
Example of saving:
of course, this is pretty basic and can be easily tampered in the process. I suggest you using an extension to send the data over to the database.
I hope this helps a little!
Example:
Code: Select all
_global.myroom = _global.myName;
var rObj:Object = {};
rObj.name = _global.myroom;
rObj.password = "";
rObj.maxUsers = "20"
smartfox.createRoom(rObj);
trace("YOUR ROOM WAS CREATED!");
For the inventory/furniture, i'm guessing you would want the users to decorate their house? This could be done with some drag and drop coding and a little php to send the x and y position of the dragged item into a mysql database where their username/user id is.
Example on an item:
Code: Select all
on(press){
startDrag(this);
_global.oldx = _xmouse;
_global.oldy = _ymouse;
_global.item = "table"
}
on(release){
stopDrag(this);
_global.newx = _xmouse;
_global.newy = _ymouse;
saveFurniture();
}
Example of saving:
Code: Select all
function saveFurniture(){
var php:LoadVars = new LoadVars();
var php_process:LoadVars = new LoadVars();
php_process.username = _global.myName;
php_process.item = _global.item;
php_process.newy = _global.newy;
php_process.newx = _global.newx;
php.sendAndLoad("http://example.com/saveFurniturePosition.php",php_process,"POST");
php_process.onLoad = function(success:Boolean) {
if (success) {
if(this.res == "SAVED"){
trace("Saved!");
}
}
}
}
of course, this is pretty basic and can be easily tampered in the process. I suggest you using an extension to send the data over to the database.
I hope this helps a little!
Quackbay - The online virtual world for kids!
-
- Posts: 8
- Joined: 06 Jul 2014, 15:31
Re: Users have thier own rooms?
awesome, tyvm.
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 39 guests