Note: This forum is merely an archive. It is no longer possible to register or post. - StackOverflow
New Ace of Spades Forums: http://buildandshoot.com/

semisucks.py instired by GreaseMonkey

Finished a script? Pop it in here.

semisucks.py instired by GreaseMonkey

Postby ajint56 » Thu Aug 23, 2012 5:40 pm

Disables the semi https://gist.github.com/3442243
inspired by the famous GreaseMonkey
Last edited by ajint56 on Thu Aug 23, 2012 10:41 pm, edited 2 times in total.
ajint56
Member
 
Posts: 2
Joined: Thu Aug 23, 2012 5:23 pm

Re: semisucks.py instired by GreaseMonkey

Postby Influx » Thu Aug 23, 2012 8:49 pm

This looks like you've just taken GreaseMonkey's script, and replaced all instances of "SMG" with "SEMI". This won't work for two reasons;

a) the semi is called RIFLE_WEAPON, not SEMI_WEAPON. Therefore it's trying to get something that doesn't exist.
b) You didn't change RIFLE_WEAPON to anything else. Even if SEMI_WEAPON did work, you'd still be telling the code "if the player picks the rifle, force them to use a rifle instead".

Here is something I believe should work.

Code: Select all
from pyspades.constants import *

def apply_script(protocol, connection, config):
    class EverythingSucksConnection(connection):
        def on_weapon_set(self, wpnid):
            if wpnid == RIFLE_WEAPON or wpnid == SMG_WEAPON:
                self.send_chat("This weapon is forbidden on this server because it sucks.")
                return False
            return connection.on_weapon_set(self, wpnid)

        def set_weapon(self, weapon, local = False, no_kill = False, *args, **kwargs):
            if weapon == RIFLE_WEAPON or weapon == SMG_WEAPON:
                self.send_chat("This weapon is forbidden on this server because it sucks.")
                self.send_chat("You've been given a real man's gun.")
                weapon = SHOTGUN_WEAPON
                if local:
                    no_kill = True
                    local = False
                return connection.set_weapon(self, weapon, local, no_kill, *args, **kwargs)
   
    return protocol, EverythingSucksConnection
User avatar
Influx
Member
 
Posts: 115
Joined: Thu Jan 12, 2012 11:05 pm
Location: Not France.

Re: semisucks.py instired by GreaseMonkey

Postby ajint56 » Thu Aug 23, 2012 10:37 pm

yes thanks the link is now updated :D
ajint56
Member
 
Posts: 2
Joined: Thu Aug 23, 2012 5:23 pm


Return to Script releases



Who is online

Users browsing this forum: No registered users and 4 guests

cron