Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2009-04-02 (original capture). Home · Forum · All archived topics · Downloads
Warcraft-Source.com - WCS mod for CSS
April 02, 2009, 05:16:30 PM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Join the new Facebook Warcraft-Source.com Group! It has been currently opened!
Join!
Google  
  Home   Forum   Help Search Login Register   *
Pages: [1]   Go Down
  Print  
This topic has not yet been rated! You have not rated this topic. Select a rating:
Author Topic: Auto reload upon kill?  (Read 25 times)
Onslaught
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 285


WWW.SNK-KLAN.NET


WWW
breezefesty
onslaught87
« on: March 30, 2009, 10:44:23 PM »

Can anyone code a skill that does this like in gungame?  I'm gonna go through the gg code and see if i can find it meanwhile

EDIT: ok i found it:

Code:
    Title: gg_reload
    Version: 5.0.415
    Description: When a player makes a kill the ammo in their clip is
                 replenished.
'''

# ==============================================================================
#  IMPORTS
# ==============================================================================
# EventScripts imports
import es
import playerlib

# GunGame imports
import gungamelib
import ggweaponlib
reload(ggweaponlib)

# ==============================================================================
#  ADDON REGISTRATION
# ==============================================================================
# Register this addon with EventScripts
info = es.AddonInfo()
info.name     = 'gg_reload (for GunGame5)'
info.version  = '5.0.415'
info.url      = 'http://gungame5.com/'
info.basename = 'gungame/included_addons/gg_reload'
info.author   = 'GunGame Development Team'

# ==============================================================================
#  GAME EVENTS
# ==============================================================================
def load():
    # Register addon with gungamelib
    gg_reload = gungamelib.registerAddon('gg_reload')
    gg_reload.setDisplayName('GG Reload')

def unload():
    # Unregister this addon with gungamelib
    gungamelib.unregisterAddon('gg_reload')

def player_death(event_var):
    # Get event info
    attacker = int(event_var['attacker'])
    userid = int(event_var['userid'])
   
    # Fallen to death?
    if not attacker:
        return
   
    # Killed self?
    if attacker == userid:
        return
   
    # Get weapon
    weapon = event_var['weapon']
   
    # We will only reload weapons that the attacker is on the level for
    if weapon != gungamelib.getPlayer(attacker).getWeapon():
        return
   
    # Is a hegrenade or knife kill?
    if weapon in ('hegrenade', 'knife'):
        return
   
    # Set clip
    playerHandle = es.getplayerhandle(attacker)
    weaponInfo = ggweaponlib.getWeaponInfo(weapon)
    for weaponIndex in es.createentitylist('weapon_' + weapon).keys():
        if playerHandle == es.getindexprop(weaponIndex, 'CBaseEntity.m_hOwnerEntity'):
            es.setindexprop(weaponIndex, 'CBaseCombatWeapon.LocalWeaponData.m_iClip1', weaponInfo.ammo)
            break

Tryin to figure out how i can make it load and unload in a skill, since this is in python i cant put it in the racefile...
« Last Edit: March 30, 2009, 10:47:38 PM by Onslaught » Logged

(click to show/hide)

         
WCA | Berettonawak [FR]
Watchdogs
Level 7 Expert
*****
Online Online

France France

Posts: 1738


Big Berettonawak is watching you...



Bifkids

myServer 81.93.251.44:27015
(Warning: click connects through Steam)
« Reply #1 on: March 31, 2009, 06:19:28 PM »

Code:
//skill_cfg : player_spawn
"skillX_setting" "es_xset wcs_chance 5|es_xset wcs_chance 8|es_xset wcs_chance 10|es_xset wcs_chance 50"
"skillX_cmd" "es_keysetvalue WCSuserdata event_var(userid) reload_on_kill server_var(wcs_chance)"
"skillX_sfx" "0"

and since you really seem to like py..

Code
GeSHi (python):
import es, playerlib, random
 
def player_death(ev):
   wcs_tmp = es.keygetvalue("WCSuserdata", event_var['attacker'], "reload_on_kill")
   if wcs_tmp > 0:
       wcs_dice = random.randint(0, 101)
       if wcs_tmp <= wcs_dice:
           wcs_userid = playerlib.getplayer(event_var['attacker'])
           wcs_userid.set('clip', ['primary', '30'])
           es.tell(event_var['attacker'], "Reloaded")
       else:
           es.tell(event_var['attacker'], "Failed Reloading")
 
HAPPY?

(click to show/hide)
Logged


MY INTERNET:
Onslaught
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 285


WWW.SNK-KLAN.NET


WWW
breezefesty
onslaught87
« Reply #2 on: April 01, 2009, 06:31:26 AM »

so i name it reload_on_kill.py right?  And no i dont like python for the record, simply because it's too strict.  You mistab something and all the code goes to shit.  Makes me angry.  Thanks for the help btw, ill test when u reply.
Logged

(click to show/hide)

         
WCA | Maxxi [NL]
Level 7 Expert
*****
Offline Offline

Netherlands Netherlands

Posts: 1124



WWW
16maxpayne16

myServer 84.243.214.217:27015
(Warning: click connects through Steam)
« Reply #3 on: April 01, 2009, 08:25:08 AM »

so i name it reload_on_kill.py right?  And no i dont like python for the record, simply because it's too strict.  You mistab something and all the code goes to shit.  Makes me angry.  Thanks for the help btw, ill test when u reply.
but it can do so much more Tongue

and it works like es name it 3454425fgxbdfzst#$VXF#$5.py
then es load 3454425fgxbdfzst#$VXF#$5 and it still works xD
Logged

Server = work in progress Smiley

Onslaught
Level 7 Expert
*****
Offline Offline

United States United States

Posts: 285


WWW.SNK-KLAN.NET


WWW
breezefesty
onslaught87
« Reply #4 on: Today at 04:14:34 AM »

but i have to name it whatever it says here:

"reload_on_kill")

Right?
Logged

(click to show/hide)

         
Pages: [1]   Go Up
  Print  
 
Jump to:  

Last 7 Shouts:
Today at 04:59:34 PM
dunno what to think...
Today at 04:57:32 PM
i dont believe its perm ban..
Today at 04:27:47 PM
malus..banned Sad forgive me...
Today at 04:23:50 PM
i wont do it again i promise Sad
Today at 04:22:37 PM
yes...Warcraft-Source.com | v0.77 | FastDL | 90+ Races | Server
Today at 04:22:11 PM
r u sure its one of the official servers?
Today at 04:16:21 PM
My steam was STEAM UserID STEAM_0:1:21818146                 and name Ug.Man....pls....
Recent
[Today at 05:16:16 PM]

[Today at 04:51:53 PM]

[Today at 04:22:32 PM]

by Narb
[Today at 03:19:49 PM]

by Narb
[Today at 01:20:56 PM]

by Narb
[Today at 01:17:35 PM]

[Today at 12:53:44 PM]

[Today at 12:49:55 PM]

[Today at 12:47:27 PM]

[Today at 11:52:54 AM]
Theme switch

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.058 seconds with 25 queries.