need help
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
need help
Hello, i'm new here, i recently got smartfox server pro, ive setup my game
but i need a little help with some features i wanted to add
i wanted to add some badges whitch i have
but threes this 1 badge i want only moderators to have so if there a mod that badge will show for them
so like this badge will show for everyone but only moderators will have it on their name tag, so far ive got the badge to show for everyone and everyone hat
but i need a little help with some features i wanted to add
i wanted to add some badges whitch i have
but threes this 1 badge i want only moderators to have so if there a mod that badge will show for them
so like this badge will show for everyone but only moderators will have it on their name tag, so far ive got the badge to show for everyone and everyone hat
-ZG1
Hi. Welcome to the Forums!
Well, in the User object there is a method called isModerator(). This method returns a boolean which is true when an User is a moderator or false when isn't.
So, in the onUserEnterRoom() event, you can simply check if the user is or not a moderator and show or hide the badges.
Well, in the User object there is a method called isModerator(). This method returns a boolean which is true when an User is a moderator or false when isn't.
So, in the onUserEnterRoom() event, you can simply check if the user is or not a moderator and show or hide the badges.
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.
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
Hi. For checking if the current client is a moderator, you need to use the amIModerator property of the SmartFoxClient class.
For checking if other user is a Moderator, you can do it on the onUserEnterRoom event, and use the User.isModerator() method.
For checking if other user is a Moderator, you can do it on the onUserEnterRoom event, and use the User.isModerator() method.
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.
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
is there a example code i could use? because ive set the moderators bade to modbadge everytime i enter it in and hide from other users my avatar wont show O.O
[/code]
Code: Select all
//----------------------------------------------------------
// Handles a new user entering the room
//----------------------------------------------------------
smartfox.onUserEnterRoom = function(fromRoom, user)
{
var userId:Number = user.getId()
var userName:String = user.getName() User.isModerator()
// Add user to the userList listbox
userList_lb.addItem(userName, userId)
// Sort names
userList_lb.sortItemsBy("label", "ASC")
updateRoomStatus(fromRoom)
// Show the user avatar
var mc:MovieClip = avatarMC.attachMovie("avatar", "avatar_" + userId, userId)
mc._x = user.variables["px"]
mc._y = user.variables["py"]
mc.name.text = userName
mc.disc.gotoAndStop(user.variables["col"])
}
-ZG1
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
zachofthegolden1 wrote:its not working is there a exampe file or something im really lost
You can user some userVars for the badges.
You could use something like this..
http://sfs-tutorials.blogspot.com/2010/ ... orial.html
Quackbay - The online virtual world for kids!
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
zachofthegolden1 wrote:i love the site and ive tried the boolns for the if mderator show badge, right now i set the badge to hidden so its there but no one can see it, also i tried the veribals it works if i have a button but then everyone else is able to click it
Try something like;
Code: Select all
if(_global.myName = "YOUR NAME"){
_root.BUTTONNAME._visible = true;
}
Quackbay - The online virtual world for kids!
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
Aiidenb wrote:zachofthegolden1 wrote:i love the site and ive tried the boolns for the if mderator show badge, right now i set the badge to hidden so its there but no one can see it, also i tried the veribals it works if i have a button but then everyone else is able to click it
Try something like;Code: Select all
if(_global.myName = "YOUR NAME"){
_root.BUTTONNAME._visible = true;
}
i tried that everytime i logged in without a name the nae was test so whatever user name i set for it to show for everyone who logs in without entering a name so instead of guest_5 its the username test
-ZG1
What about;
Code: Select all
if (_global.myName == "YOUR NAME") {
_root.BUTTONNAME._visible = true;
} else {
if (_global.myName != "YOUR NAME") {
_root.BUTTONNAME._visible = false;
}
}
Quackbay - The online virtual world for kids!
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
ok i found a way around this but not thw way i have hoped, basically i make the game with al the eatures then publish then i make another button and oublish under a new name then for me i go to the one with button and normal players go to the app without button when i click it shows a avatar with the hair i like and the mod badge. also the game yoville have made it when ever someones mod level goes higher then 1 they get a mod badge on their name tag
-ZG1
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
rjgtav wrote:Hi. Welcome to the Forums!
Well, in the User object there is a method called isModerator(). This method returns a boolean which is true when an User is a moderator or false when isn't.
So, in the onUserEnterRoom() event, you can simply check if the user is or not a moderator and show or hide the badges.
ive done some testing i understand now is there a certain tag i should use? like it says trace "I am a moderator in this zone" what if i chagged it to this.modBadge._visable.true
-ZG1
What do you mean by a tag? you simply use those methods and they return either true or false, it is as simple as that.
They return true when you or the user is a moderator and false when you aren't. simple
They return true when you or the user is a moderator and false when you aren't. simple
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.
- zachofthegolden1
- Posts: 89
- Joined: 05 Sep 2011, 19:31
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 87 guests