 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
BDwinsAlt Agurus's Posse

Age:34 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
Posted: Mon Sep 04, 2006 6:22 pm Post subject: Reloading temp setts with python. |
 |
|
|
|
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 |
|
 |
Chambahs Power attack

Joined: Jun 19 2005 Posts: 820 Offline
|
Posted: Mon Sep 04, 2006 10:19 pm Post subject: |
 |
|
|
|
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:
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 |
|
 |
BDwinsAlt Agurus's Posse

Age:34 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
Posted: Mon Sep 04, 2006 11:29 pm Post subject: |
 |
|
|
|
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 |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Tue Sep 05, 2006 4:50 pm Post subject: |
 |
|
|
|
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 |
|
 |
Tunkel Guest
Offline
|
Posted: Wed Sep 06, 2006 4:42 pm Post subject: |
 |
|
|
|
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
|
Posted: Wed Sep 06, 2006 4:55 pm Post subject: |
 |
|
|
|
Still not tested but this is what it might look like.
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 |
|
 |
BDwinsAlt Agurus's Posse

Age:34 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
Posted: Wed Sep 06, 2006 6:35 pm Post subject: |
 |
|
|
|
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 |
|
 |
|
|
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
|
Software by php BB © php BB Group Server Load: 47 page(s) served in previous 5 minutes.
|