Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Silencing ip address

 
Post new topic   Reply to topic Printable version
 View previous topic  view score Post :: Post sub game and bots to asss  View next topic  
Author Message
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Sun Nov 19, 2006 5:43 pm    Post subject: Silencing ip address Reply to topic Reply with quote

I am trying to silence by IP address using a python module. There are a few things I need to do in order to do this.

Get the player's ip when they enter the zone

Query the database for that ip and check the column 'banlength'

Compar that time to the current time to decide if they are still silenced.

Apply a new silence for the remaining time.

Any help would make me really happy. I'm working on it now. If I figure it out I will edit my post.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Nov 19, 2006 6:00 pm    Post subject: Reply to topic Reply with quote

You'd want two columns, startedat and length. Then when the player enters the server you see if now - startedat < length, if so then you adjust the chatmask for length - (now - startedat) seconds.

You could probably push most of it to the db:
Code: Show/Hide
select length - (now() - startedat) from blah
where now() - startedat < length and ip = 'blah'
Then check to see if there is more than 0 rows of results.
_________________
ss news
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Sun Nov 19, 2006 6:25 pm    Post subject: Reply to topic Reply with quote

How do I query the db and see if the ip entering matches a row with an ip that has a banlength on it? I need to know how to Query the database before I begin any of it.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Mon Nov 20, 2006 4:46 am    Post subject: Reply to topic Reply with quote

Just look at the alias module.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Mon Nov 20, 2006 5:04 pm    Post subject: Reply to topic Reply with quote

New problem: I looked at setcm in playercmd.c but chat.SetPlayerChatMask doesn't seem to silence people. Could you help me out with this?
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue Nov 21, 2006 5:38 pm    Post subject: Reply to topic Reply with quote

Post your code.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Tue Nov 21, 2006 6:25 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide

def c_silence(cmd, params, p, targ):
    if int(params) >= 1:
        chat.SetPlayerChatMask(targ, 1, int(params))


getcm shows all permissions, even if I change the int value.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue Nov 21, 2006 6:39 pm    Post subject: Reply to topic Reply with quote

Ok this works for me:
Code: Show/Hide
from asss import *

chat = get_interface(I_CHAT)

def c_silence(cmd, params, p, targ):
   # get integer parameter
   timeout = 0
   try: timeout = int(params)
   except: pass

   # check for priv command
   if isinstance(targ, PlayerType) and timeout >= 1:
      newmask = 1 << MSG_CHAT
      chat.SetPlayerChatMask(targ, newmask, timeout)

cmd1 = add_command("t1", c_silence)

Silencing chat channels for 60 seconds:
Code: Show/Hide
     Smong> ?getcm
getcm: +pub +pubmacro +freq +nmefreq +priv +chat +modchat
     Smong> ?t1 60
     Smong> ?getcm
getcm: +pub +pubmacro +freq +nmefreq +priv -chat +modchat
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Tue Nov 21, 2006 7:39 pm    Post subject: Reply to topic Reply with quote

thanks icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 14 page(s) served in previous 5 minutes.

phpBB Created this page in 0.494482 seconds : 33 queries executed (93.6%): GZIP compression disabled