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
Reloading temp setts with python.

 
Post new topic   Reply to topic Printable version
 View previous topic  SSH security for ASSS Post :: Post My zone is green only in LAN.  View next topic  
Author Message
BDwinsAlt
Agurus's Posse


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

PostPosted: Mon Sep 04, 2006 6:22 pm    Post subject: Reloading temp setts with python. Reply to topic Reply with quote

I did read the post about doors for C. How would I go about updating the door mode instantly if someone types a command. Right now you have to wait a few seconds for the doors to open and close. I need to be able to set the door mode and reload the door state.

How can I do this in python?

ALSO, how can I take away a death from someone's score in python if they get tked.
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
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Mon Sep 04, 2006 10:19 pm    Post subject: Reply to topic Reply with quote

Dont know about the doors but i know that for the win/death count in python, its:

GetStat(p, STAT_WINS, INTERVAL_RESET)
SetStat(p, STAT_WINS, INTERVAL_RESET)

Or:

GetStat(p, STAT_LOSSES, INTERVAL_RESET)
SetStat(p, STAT_LOSSES, INTERVAL_RESET)

And then:

stats.SendUpdates()


All found in asss/src/include/stats.h and also asss/src/packets/pdata.h

Preview for code for you or anyone else:

Code: Show/Hide

def get_money(p):
    kp = stats.GetStat(p, STAT_KILL_POINTS, INTERVAL_RESET)
    fp = stats.GetStat(p, STAT_FLAG_POINTS, INTERVAL_RESET)
    return kp + fp

def subtract_money(p, amount):
    if amount > 0:
        fp = stats.GetStat(p, STAT_FLAG_POINTS, INTERVAL_RESET)
        fp -= amount
        stats.SetStat(p, STAT_FLAG_POINTS, INTERVAL_RESET, fp)
        stats.SendUpdates()

def c_buy(cmd, params, p, targ):
    # spec can't buy
    if len(params) > 0 and p.ship == SHIP_SPEC:
        chat.SendMessage(p, "Sorry, you cannot buy from spec.")
        return

    money = get_money(p)

    if params == "nades":
        if money >= 100000:
            subtract_money(p, 100000)
       do_nades(p)

Back to top
View users profile Send private message Add User to Ignore List
BDwinsAlt
Agurus's Posse


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

PostPosted: Mon Sep 04, 2006 11:29 pm    Post subject: Reply to topic Reply with quote

Thanks man. I will try it out tomarrow I have to go to bed now. Thanks again :-D

EDIT: I got it working but with code a little different.
Your example helped me a lot. One thing though, STAT_WIN is STAT_KILLS and STAT_LOSSES is STAT_DEATHS. Just a note to anyone who wants to do this.

Thanks guys :)


Now if we could figure out the other issue :P
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 Sep 05, 2006 4:50 pm    Post subject: Reply to topic Reply with quote

Looking at clientset.h it doesn't have any python hooks in it. But a workaround is to use asss.call_callback(CB_ARENAACTION, (arena, AA_CONFCHANGED)) and that should make the clientset module resend the settings. I haven't tested this so it's only hypothetical.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Tunkel
Guest


Offline

PostPosted: Wed Sep 06, 2006 4:42 pm    Post subject: Reply to topic Reply with quote

Can you ellaberate? I am having this same problem as well. An example would be nice. I'm pretty new to asss myself.
Back to top
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Wed Sep 06, 2006 4:55 pm    Post subject: Reply to topic Reply with quote

Still not tested but this is what it might look like.
Code: Show/Hide
import * from asss

cfg = get_interface(I_CONFIG)

def set_doormode(arena, newdoormode):
    cfg.SetInt(arena.cfg, "Door", "DoorMode", newdoormode, "", false)
    call_callback(CB_ARENAACTION, (arena, AA_CONFCHANGED))

def mm_attach(a):
    set_doormode(a, 127)

def mm_detach(a):
    set_doormode(a, -2)
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: Wed Sep 06, 2006 6:35 pm    Post subject: Reply to topic Reply with quote

HEY! This worked for me! Thanks very much. Tunkel is my buddy in real life and he was trying to help me too. Thanks.
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: 47 page(s) served in previous 5 minutes.

phpBB Created this page in 0.466071 seconds : 32 queries executed (94.6%): GZIP compression disabled