[GAME MODE]SMG Warz

Incomplete code that isn't ready for use.
25 posts Page 1 of 2 First unread post
Bux Xray
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 218
Joined: Sat Aug 24, 2013 9:07 am


hi..could someone test my script? cuz I dont have server

its used for Skilled smg user or wants to practice using smg
you cant use any guns exept SMG

and if you have low health , Kill a player then you will get 5 hp
Code: Select all
#SMG WARZ Game Mode
#by BOYuXRAY
#version 1
#inspired by Kuma`s script
 
from pyspades.constants import *
from random import randint
from twisted.internet.reactor import callLater
 
SMG_ONLY = "You cant kill with Rifle,Shotgun Use SMG!"
 
def apply_script(protocol, connection, config):
 
    class SMGwarConnection(connection)
        def spawn(self)
            self.weapon = SMG_WEAPON
            return connection.spawn(self)
 
        def on_weapon_set(self, weapon)
            self.send_chat(SMG_ONLY)
            return false
 
    class SMGwarProtocol(protocol):
        game_mde = CTF_MODE
        starting_hp = config.get("start_hp_on_hit",10)
        startig_hp = config.get("start_hp",100)
 
  return SMGwarProtocol, SMGwarConnection
if it did not work,YAY...I`m just beginner xD
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


There are many faults with this script.
You are missing many semi colons in the script ":", also in "return false" the f in the false should be capital. Then the spelling of game_mode is wrong, also you don't really need that many imports. (You are not using randint and callLater anywhere) Also if we return False on_weapon_set, on reload the weapon will be broken so yeah.

fixed version (but reloading breaks the gun)
Code: Select all
#SMG WARZ Game Mode
#by BOYuXRAY
#version 1
#inspired by Kuma`s script
 
from pyspades.constants import *
 
SMG_ONLY = "You cant kill with Rifle or Shotgun. Use the SMG!"
 
def apply_script(protocol, connection, config): #Error here
 
    class SMGwarConnection(connection): #Error here
        def spawn(self):#Error here
            self.weapon = SMG_WEAPON
            return connection.spawn(self)
 
        def on_weapon_set(self, weapon): #Error here
            self.send_chat(SMG_ONLY)
            return False #Error here
 
    class SMGwarProtocol(protocol):
        game_mode = CTF_MODE #Error here

    return SMGwarProtocol, SMGwarConnection
Another version in which I fixed the reloading part.
Code: Select all
#SMG WARZ Game Mode
#by BOYuXRAY
#version 1
#inspired by Kuma`s script
 
from pyspades.constants import *
 
SMG_ONLY = "You cannot kill with Rifle or Shotgun. Use the SMG!"
 
def apply_script(protocol, connection, config): #Error here
 
    class SMGwarConnection(connection): #Error here
        def spawn(self):#Error here
            self.weapon = SMG_WEAPON
            return connection.spawn(self)
 
        def on_weapon_set(self, weapon): #Error here
            if weapon in [RIFLE_WEAPON, SHOTGUN_WEAPON]:
                self.send_chat(SMG_ONLY)
                self.set_weapon(SMG_WEAPON)
            return False
 
    class SMGwarProtocol(protocol):
        game_mode = CTF_MODE #Error here

    return SMGwarProtocol, SMGwarConnection

Bux Xray
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 218
Joined: Sat Aug 24, 2013 9:07 am


SMG War
Version 2

-Fixed a silly mistake
-Fixed by Kuma
-Fixed the reload part
-Fixed Error

I hope I can do another version Green_Cookie Green_Cookie

SMG War
SMG War is used by Players who want to fight with smg and want to fight an enemy using SMG

Download :
attachment=0]SMGwar.py[/attachment
Attachments
SMGwar.py
Used to kill with SMG
(759 Bytes) Downloaded 264 times
Bux Xray
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 218
Joined: Sat Aug 24, 2013 9:07 am


Cheat For All
Version 3

-Added some features
-same as SMG War version 2
with some features
-added /fly to add some
intense
-added /smghelp to guide
players

Commands
/fly - makes you fly like a bird :3
/smghelp - guides you with the commands



[HELP]Did not work :( ,
so pls. help me :(
Code: Select all
#SMG WARZ Game Mode
#by BOYuXRAY
#version 3
#inspired by Kuma`s script
#added some features
 
from pyspades.constants import *
from commands import add, alias, admin, name, move
from twisted.internet.task import LoopingCall
 
SMG_ONLY = "You cannot kill with Rifle or Shotgun. Use the SMG!"

@alias ('fly')
def fly(connection)
    protocol = connection.protocol
        if connection in protocol.players:
            player = connection
            player.fly = not player.fly
            message = 'now flying like a bird' if player.fly else 'no longer flying like a bird'
            player.send_chat("You're {0}".format(message))

def smghelp(connection):
    protocol = connection.protocol
    help = ["-" * 50,"Some of the commands are: /fly,/smghelp","anyone cant use rifle and shotgun,use SMG","Good luck!"
    if connection in protocol.players:
        for line in help:
            connection.send_chat(line)

 
def apply_script(protocol, connection, config):
    class SMGwarConnection(connection): 
        def spawn(self):
            self.weapon = SMG_WEAPON
            return connection.spawn(self)
 
        def on_weapon_set(self, weapon):
            if weapon in [RIFLE_WEAPON, SHOTGUN_WEAPON]:
                self.send_chat(SMG_ONLY)
                self.set_weapon(SMG_WEAPON)
            return False
 
    class SMGwarProtocol(protocol):
        game_mode = CTF_MODE

    return SMGwarProtocol, SMGwarConnection
Attachments
SMGwar.py
(1.45 KiB) Downloaded 241 times
learn_more
Coder
Coder
Posts: 891
Joined: Sun Mar 24, 2013 9:59 pm


so now this topic is: help box paste shit together?
MKU
Artist
Artist
Posts: 383
Joined: Wed Oct 31, 2012 12:20 am


learn_more wrote:
so now this topic is: help box paste shit together?
halp him
Bux Xray
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 218
Joined: Sat Aug 24, 2013 9:07 am


yeah...so this is like a [REQUEST] Now xD
learn_more
Coder
Coder
Posts: 891
Joined: Sun Mar 24, 2013 9:59 pm


Bux Xray wrote:
yeah...so this is like a [REQUEST] Now xD
yeah well have you thought about giving a bit more info than:

DUN WURK
Bux Xray
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 218
Joined: Sat Aug 24, 2013 9:07 am


I keep improving the SMGwar and fixing it
and still I dont know if it will work
Code: Select all
#SMGwar by BOYuXRAY
#Version 3
#fixed Version

from commands import add, alias, admin, name, move
from twisted.internet.task import LoopingCall

SMGWAR_ENABLED_MESSAGE = "SMGwar enabled!players must use smg now!"
SMGWAR_DISABLED_MESSAGE = "SMGwar disabled!Players can use any weapons now!"
NO_SMGWAR = "No,SMGwar enabled"
SMG_ONLY = "you cant use shotgun,rifle use SMG!"
SMGWAR = true 

@alias('SMGwar')
@admin
def smgwarmode(connection)
    global SMGWAR, strip
    protocol = connection.protocol
    SMGWAR = not SMGWAR
    if SMGWAR:
        protocol.send_chat(PEACE_ENABLED_MESSAGE)
    else
        protocol.send_chat(PEACE_DISABLED_MESSAGE)

@alias('fly')
def smgwar_fly(connection):
    protocol = connection.protocol
    if SMGWAR:
        if connection in protocol.players:
            player = connection
            player.fly = not player.fly
            message = 'now flying like a bird' if player.fly else 'no longer flying'
            player.send_chat("You're {0}".format(message))
    else:
        connection.send_chat(NO_SMGWAR)

def smgwarhelp(connection):
    protocol = connection.protocol
    help = ["-" * 50,"Some of the commands are: /f","in smg war,you can only use smg,"good luck!", "-" * 50]
    if connection in protocol.players:
        for line in help:
            connection.send_chat(line)

add(smgwarmode)
add(smgwarhelp)
add(smgwar_fly)

def apply_script(protocol, connection, config):

   class SMGwarConnection(connection):
        def spawn(self):
            self.weapon = SMG_WEAPON
            return connection.spawn(self)

 def on_weapon_set(self, weapon):
            if weapon in [RIFLE_WEAPON, SHOTGUN_WEAPON]:
                self.send_chat(SMG_ONLY)
                self.set_weapon(SMG_WEAPON)
            return False
 

    class SMGwarConnection(connection):
        smgwar_fly = true

    class SMGwarProtocol(protocol):
        game_mode = CTF_MODE


    return SMGwarProtocol, SMGwarConnection
Improves
-admins can enabled and disabled SMGwar now
by doing /SMGwar
-same like version3 ,with /fly to add some
intense
-added /smgwarhelp to guide some players that
did not know

If this works
I recommend adding to tips "type /smgwarhelp for the game mode guide"
Attachments
SMGwar.py
(1.97 KiB) Downloaded 255 times
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


You are just copying my peace script. And even failing at that.
This won't work.
tungdil
League Participant
League Participant
Posts: 517
Joined: Mon May 06, 2013 4:28 pm


If you made a clan, i'd join it bux xXXDDDd.
Bux Xray
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 218
Joined: Sat Aug 24, 2013 9:07 am


oh............just copied the /fly then the idea /help
Bux Xray
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 218
Joined: Sat Aug 24, 2013 9:07 am


are you serious xD

I have xD
it have a weird name xD because I just made it for fun before
then I decided to make it public

BOLTZ ULTRA ZYBORGS
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


Anyways, I am not going to fix that script for you. Learn to read the errors the interpreter gives to you. You make really stupid mistakes all the time, and you have just copy pasted code and still fail at that. There are problems with the indentation, naming the booleans wrong, stupid spelling mistakes. You have included a toggle command which is of no use (You have not added a if statement, so people will still spawn with smgs, and you are not using my reload fix so they can't fire after reloading), If you really want to learn scripting, learn the basics of programming, learn python and then come here.
learn_more
Coder
Coder
Posts: 891
Joined: Sun Mar 24, 2013 9:59 pm


if you can't read the errors the server gives you then you shouldnt even try anymore.
if you can read em, you can make anything.
25 posts Page 1 of 2 First unread post
Return to “Work In Progress”

Who is online

Users browsing this forum: No registered users and 12 guests