[SCRIPT] ammo

Intended for use on live public servers.
21 posts Page 1 of 2 First unread post
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


This is a script to change and edit amunition of a player far beyond the usual limitations.
This+rapid=EPIC WIN
CODE:
Code: Select all
from pyspades.server import weapon_reload
from commands import add, admin, get_player

@admin
def reload(connection,*args):
    player=connection
    ammo=255
    clip=255
    try:
        if len(args)>2: player=get_player(args[2])
        if len(args)>0: ammo=int(args[0])
        if len(args)>1: clip=int(args[1])
    except Exception:
        return "Invalid, use /reload [ammo] [clip] [player]"
    player.set_ammo(int(ammo),int(clip))
    connection.refresh_ammo()
    return "Reloaded"

@admin
def ammo(connection):
    ammo=connection.ammo
    return "You have "+str(ammo[0])+" ammo and a clip of "+str(ammo[1])+"."

@admin
def autoreload(connection):
    connection.autoReload= not connection.autoReload
    connection.refresh_ammo()
    return "Auto reloading is "+["OFF","ON"][connection.autoReload]
   
add(reload)
add(ammo)
add(autoreload)
def apply_script(protocol, connection, config):
    
    class ammoConnection(connection):
        ammo=(0,0)
        autoReload=False
        
        def refresh_ammo(self):
            if self.autoReload:
                self.set_ammo(255,255)
            self.ammo=(self.weapon_object.current_ammo,self.weapon_object.current_stock)

        def on_reload(self):
            self.refresh_ammo()
            connection.on_reload(self)

        def on_spawn(self,pos):
            self.refresh_ammo()
            connection.on_spawn(self, pos)
    
        def on_shoot_set(self, fire):
            self.refresh_ammo()
            connection.on_shoot_set(self, fire)

        def on_refill(self):
            self.refresh_ammo()
            connection.on_refill(self)

        def on_input_update(self):
            self.refresh_ammo()
            connection.on_input_update(self)

        def set_ammo(self, new_ammo, new_stock=None):
            new_ammo=max(min(255,new_ammo),0)
            new_stock=max(min(255,new_stock),0)
            weapon=self.weapon_object
            weapon_reload.player_id = self.player_id
            weapon_reload.clip_ammo = weapon.current_ammo
            weapon.current_ammo = new_ammo
            if new_stock:
                weapon.current_stock = new_stock
            weapon_reload.reserve_ammo = weapon.current_stock
            self.send_contained(weapon_reload)
            self.ammo=(new_ammo,new_stock)
    
    return  protocol, ammoConnection

Have fun!
Vengeance
Deuced Up
Posts: 350
Joined: Mon May 06, 2013 12:07 pm


Cool! Blue_BigSmile
MrHaaax
Modder
Modder
Posts: 1360
Joined: Sun Nov 25, 2012 2:58 am


We will have an LMG soon enough D:
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


So do you specify how much ammo you start with? Is it possible to start with even less than 10?
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


no, you can though. Would you like a script like that? This one is more of a building block for scripts that change ammo, /autoreload is cool. It makes it so that you don't need to reload, and it keeps your ammo at 255/255
TB_
Post Demon
Post Demon
Posts: 998
Joined: Tue Nov 20, 2012 6:59 pm


nah don't worrya bout that, BR_ probably already did it with his OIC mode:)
IceCream
Hoster
Hoster
Posts: 322
Joined: Thu Nov 01, 2012 12:18 pm


THIS IS FUCKING AWESOME

SMG+Rapid+Autoreload=Happy happy joy joy
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


:D
Kamikaze_Blargle
Blue Master Race
Blue Master Race
Posts: 263
Joined: Mon Dec 17, 2012 5:43 pm


IceCraft wrote:
SMG+Rapid+Autoreload=Happy happy joy joy
Why on earth would you need SMG and Rapid? xD
MaxyBlack
Deuce
Posts: 5
Joined: Wed Jun 19, 2013 9:11 am


can some one create new download link ?
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


what's wrong with this one?
Venator
League Participant
League Participant
Posts: 1225
Joined: Wed Nov 07, 2012 8:32 pm


thepolm3 do you think you could turn the smg into an hmg with your superior scripting skills?
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


what do you mean by heavy machine gun?
technicly, i mean;
like faster fire & more damage?
Bigger clip and less damage?
What?
Venator
League Participant
League Participant
Posts: 1225
Joined: Wed Nov 07, 2012 8:32 pm


ok:
Slightly faster firing.
Really low damage (like 5hp for body and 10 for head?)
200 round clip.
Immense recoil.
MrHaaax
Modder
Modder
Posts: 1360
Joined: Sun Nov 25, 2012 2:58 am


Venator wrote:
ok:
Slightly faster firing.
Really low damage (like 5hp for body and 10 for head?)
200 round clip.
Immense recoil.
Actually here's how a HMG should be IMO:
Lower firerate.
Med-damage(lower than SMG's a bit)
200 rds and high recoil.
21 posts Page 1 of 2 First unread post
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 3 guests