Kick and Ban (Please Read)

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
Bosskafett
Posts: 41
Joined: 24 Jan 2012, 00:04

Kick and Ban (Please Read)

Post by Bosskafett »

Hello!

I understand this is both in the docs and a few posts on this subject. I gathered this:
------------------
var dataObj:Object = {}

dataObj.id = userId.toString()
dataObj.msg = msg

smartFox.sendXtMessage("$dmn", "kick", dataObj)
----------------
Where exactly does that go? How does that work?? I honestly cant find any other information about this matter, apart from the code above.

Please reply! D:

Thanks Guys,
Jack
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Kick and Ban (Please Read)

Post by rjgtav »

Hello.
That code goes in the client code. Please keep in mind that the user needs to be a Moderator in order to be able to send that request, otherwise that request will be ignored by the server.
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.
Bosskafett
Posts: 41
Joined: 24 Jan 2012, 00:04

Re: Kick and Ban (Please Read)

Post by Bosskafett »

Hey rjgtav,

Thanks for getting back to me. When I put this in the SmartFoxClient, do I execute the process by saying something in the chat bar? Is it something like: ban <user> / kick <user>

Thanks,
Jack
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Kick and Ban (Please Read)

Post by rjgtav »

You can do it whatever way you want. If you want, you can use a simple button. Simply add that code to a function and call it when ever you need it.
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.
Bosskafett
Posts: 41
Joined: 24 Jan 2012, 00:04

Re: Kick and Ban (Please Read)

Post by Bosskafett »

Alright:)

Yet, is it the user ID you target?? I dont want to only be able to kick myself.
I've never seen that code mak up before, and is extremely confusing. Please explain how to use it :)

Whats the client and what is data obj? How can a button define a specific user???? The code seems somewhat incomplete. Argh, Im confused.

help!
jack
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Kick and Ban (Please Read)

Post by Bax »

Bosskafett , you should create a function (activated by a button or what else) which executes the code you wrote in the first post. The userID is the id of the user you want to kick or ban. Also, in order to kick or ban the user running that function must have moderation privileges.
Sorry, but I believe you really need to better study the SFS documentation and API documentation.
Paolo Bax
The SmartFoxServer Team
Bosskafett
Posts: 41
Joined: 24 Jan 2012, 00:04

Re: Kick and Ban (Please Read)

Post by Bosskafett »

Why thank you Baxy, I understand now :D
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
Bosskafett
Posts: 41
Joined: 24 Jan 2012, 00:04

Re: Kick and Ban (Please Read)

Post by Bosskafett »

So you add a moderator to the Config.xml but the user isnt a moderator when you login. :/
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Kick and Ban (Please Read)

Post by rjgtav »

Hmm... Have you restarted the server after you added the user to the config? And is the username you entered on the config exactly the same of that user?
And are you using custom-login? If so, you need to manually set that user a moderator, after the successful login...
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.
Bosskafett
Posts: 41
Joined: 24 Jan 2012, 00:04

Re: Kick and Ban (Please Read)

Post by Bosskafett »

Its not custom login. I use PHP for that, its strange. This is how its set out:

<Moderators status="on">
<Mod name="Jack"/>
</Moderators>

Is that right??

Cheers,
jack
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Kick and Ban (Please Read)

Post by rjgtav »

Hmm... Moderators only work if you specify both an username and a password... To increase security... Otherwise anyone could be a moderator... It was only needed to login with the mod's username. You configure it like:

<Moderators status="on">
<Mod name="modName" pwd="modPass" />
</Moderators>
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.
Bosskafett
Posts: 41
Joined: 24 Jan 2012, 00:04

Re: Kick and Ban (Please Read)

Post by Bosskafett »

Alright, cheers mate;

:D
if(_global.is_rocketsnail == 1){
mc.snail._visible = true;
smartfox.setUserVariables({snl:1, init:false})
}
The Re-creator of Old Games ;D
Post Reply