Author Topic: DanMister[RACE] 'NightStalker' (Python)  (Read 184 times)

Offline DanMister

  • Level 7 Expert
  • *****
  • Posts: 196
  • no autographs, please.
DanMister[RACE] 'NightStalker' (Python)
« on: November 28, 2009, 11:24:52 PM »
New Race 'NightStalker'
Code: (python) [Select]
##################
# IMPORT MODULES
import es
import random
import gamethread

import wcs
##################
#   PUBLISH INFO
info = es.AddonInfo()
info.name = 'NightStalker'
info.author = 'DanMister'

##################
#   RACE INFO
#
RaceName = 'NightStalker'
race = wcs.Race(RaceName)
race.registerWeaponRestriction('allow only',['knife','glock','usp','mp5'])

###################
#   SILL INFO

race.registerSkill('Weapon of choice',5,1,"Recieve your favorite weapon, the mp5")
race.registerSkill('Sneaky Sneaky',5,1,'Invisibily')
race.registerSkill('Spectacles',3,1,'Nightvision(Required for Specatacle Skill)')
race.registerSkill('Spectactle skill',6,1,'Run faster,do more damage if Nightvision is on')

###################
#   ULTIMATE INFO

race.registerUltimate('Into the shadows',10,6,1,'Teleport into the shadows')

###################
#   CODE



def player_spawn(ev):
    userid = int(ev['userid'])
    chance1 = random.randint(1,5)
    chance2 = random.randint(1,3)
    chance3 = random.randint(1,6)
    effect = wcs.Effect()
    player  = playerlib.getPlayer(ev['userid'])
    weapon = wcs.GetLevel(userid, RaceName, 'Weapon of choice')
    Invis = wcs.GetLevel(userid, RaceName, 'Sneaky Sneaky')
    nvg = wcs.GetLevel(userid, RaceName, 'Spectacles')
    nvgSkills = wcs.GetLevel(userid, RaceName, 'Spectacle skill')

    if weapon >= chance1:
        es.server.queuecmd('est_Give %s weapon_mp5' % event_var['userid'])
        effect.Ring1(ev['userid'], 150, 5, 0, 0, 0)
        es.tell(userid, '#multi', text('You have recieved your weapon of choice.', lang = playerlib.getPlayer(userid).get("lang") ) )

        if Invis >= chance1:
            player.setcolor(255, 255, 255, 100)
            player.setWeaponColor(255, 255, 255, 100)
            es.tell(userid, '#multi', text('Your Invisibility has been set.', lang = playerlib.getPlayer(userid).get("lang") ) )

            if nvg >= chance2:
                player.setNightvision(1)
                player.setNightvisionState(1)
                es.tell(userid, '#multi', text('NightVision set.', lang = playerlib.getPlayer(userid).get("lang") ) )

                    if nvgSkills >= chance3 and player.getNightvisionState() < 1:
                        player.setSpeed(1.5)
                        es.tell(userid, '#multi', text('NightVision speed skill set', lang = playerlib.getPlayer(userid).get("lang") ) )


def player_hurt(ev):
    attacker = int(ev['attacker'])
    userid = int(ev['userid'])
    chance = random.randint(1,15)
    effect = wcs.Effect()
    player1 = wcs.Command(ev['userid'])
    player  = playerlib.getPlayer(ev['userid'])
    nvgSkills = wcs.GetLevel(userid, RaceName, 'spectacle skill')

    if nvgSkills >= chance and player.getNightvisionState() < 1:
        player1.damage(2, 2, ev['attacker'])
        effect.Beam1(ev['attacker'], ev['userid'], 2, 0, 70, 0)


def player_ultimate(ev):
    userid = int(ev['userid'])
    player = playerlib.getPlayer(ev['userid'])
    Teleport = wcs.GetLevel(userid, RaceName, 'Into the shadows')
    effect = wcs.Effect()

    if Teleport < 3 and not Teleport == 0 and not wcs.Command(ev['userid']).GetCoolDown('Into the shadows'):
        player.PushTo(player.getViewCoord(), 100)
        effect.Smoke(ev['userid'])
        wcs.Command(ev['userid']).SetCoolDown('Into the shadows',10)
        es.tell(userid, '#multi', text('You teleported into the shadows', lang = playerlib.getPlayer(userid).get("lang") ) )

    if Teleport = 3 and not wcs.Command(ev['userid']).GetCoolDown('Into the shadows'):
        player.PushTo(player.getViewCoord(), 100)
        effect.Smoke(ev['userid'])
        wcs.Command(ev['userid']).SetCoolDown('Into the shadows',5)
        es.tell(userid, '#multi', text('You teleported into the shadows', lang = playerlib.getPlayer(userid).get("lang") ) )

    if Teleport > 3 and not wcs.Command(ev['userid']).GetCoolDown('Into the shadows'):
        player.PushTo(player.getViewCoord(), 100)
        effect.Smoke(ev['userid'])
        wcs.Command(ev['userid']).SetCoolDown('Into the shadows',2)
        es.tell(userid, '#multi', text('You teleported into the shadows', lang = playerlib.getPlayer(userid).get("lang") ) )

# AND THATS IT!
###############################################################################################

            
        
    
    
        

    
                        

                    

                    

                    
                    
            
        
    
    
« Last Edit: November 28, 2009, 11:29:45 PM by DanMister »
Quote

Quote
"Genius may have its limitations, but stupidity is not thus handicapped."   Elbert Hubbard

Zawmbee

  • Guest
Re: DanMister[RACE] 'NightStalker' (Python)
« Reply #1 on: November 29, 2009, 12:54:21 AM »
stop posting repeats... warned.