Page 1 of 1

gungame utils question

PostPosted: Thu Dec 04, 2008 4:55 pm
by WebJunkie
currently i run a gungame5 server with the addons mani-1.2s+evenscripts-beta250+gungame utils. and the deathmatch seems to be stable. i would like to add a unlimited ammo addon but it uses es_tools. i would prefer not to use es_tools because of all the crashing issues i had using it. My question is, is there any tools built into the gungame utils that would allow a unlimited ammo script to be run?

PostPosted: Thu Dec 04, 2008 5:06 pm
by PitBull
I don't know if these scripts work, but they should.

1. You have unlimited reserve ammo, but you have to reload
import es
import playerlib

def weapon_reload(event_var):
    playerlib.getPlayer(event_var['userid']).set("ammo", [event_var['es_userweapon'],999])

2. You do not have to reload
import es
import playerlib

def weapon_fire(event_var):
    playerlib.getPlayer(event_var['userid']).set("ammo", [event_var['weapon'],999])

PostPosted: Thu Dec 04, 2008 5:47 pm
by Don
The second version would be my choice but you could change the 999 to a much lower number. You could actually set it to 2 for everything except the burst mode gun(Bullpup?). I would think setting that to something like 30 would work for everything.

PostPosted: Thu Dec 04, 2008 6:27 pm
by Warren
The Famas and Glock have burst modes.

Re:

PostPosted: Thu Dec 04, 2008 8:16 pm
by PitBull
So just use this:
import es
import playerlib

def weapon_fire(event_var):
    playerlib.getPlayer(event_var['userid']).set("ammo", [event_var['weapon'],10])

Re: gungame utils question

PostPosted: Thu Dec 04, 2008 8:32 pm
by WebJunkie
thanks for the speedy relpy's, but what i neglected to inform you of was my enourmous lack of knowledge. I would guess what i do with this is create a text file. put it in a folder in eventscrpts and then run it as an evenscript. would that be a good or bad assumption? thanks(try not to bash the noob too bad please)

Re: gungame utils question

PostPosted: Thu Dec 04, 2008 9:26 pm
by WebJunkie
nevermind, i think i figured it out. create a .py file using notepad. create and place in a folder in custom_addons. am i gettin warm?

Re: gungame utils question

PostPosted: Thu Dec 04, 2008 9:32 pm
by Don
WebJunkie wrote:nevermind, i think i figured it out. create a .py file using notepad. create and place in a folder in custom_addons. am i gettin warm?

Warmer but the simplest way would be to create a file called something like unlimited_ammo.py. Put that into a folder under cstrike/addons/eventscripts/unlimited_ammo and then put this in your autoexec.cfg.:
es_load unlimited_ammo
That would be the easiest way to use it without having to worry about it being a custom addon.

Re: gungame utils question

PostPosted: Thu Dec 04, 2008 10:40 pm
by WebJunkie
thank you all for the help, i'll try it out and respond on how it went. thanks again

Re: gungame utils question

PostPosted: Thu Dec 04, 2008 11:18 pm
by WebJunkie
Ok this is what i have, how can i add a message to the server at start up?

# ==============================================================================
#   IMPORTS
# ==============================================================================

# EventScripts imports
import es
import playerlib

# ==============================================================================
#   ADDON REGISTRATION
# ==============================================================================
# Register this addon with EventScripts
info = es.AddonInfo()
info.name     = 'unlimited ammo'
info.version  = '1.0.0'
info.url      = 'http://forums.gungame5.com/viewtopic.php?f=12&t=330'
info.basename = 'addons/eventscripts/unlimited_ammo'
info.author   = 'Gungame5 Forum'

# ==============================================================================
#   GAME EVENTS
# ==============================================================================

def weapon_fire(event_var):
    playerlib.getPlayer(event_var['userid']).set("ammo", [event_var['weapon'],10])

PostPosted: Fri Dec 05, 2008 2:26 am
by WebJunkie
this code works but, you still have to reload. i'm looking for unlimited ammo with no reload. i was using one called omg_ammo but it used es tools. i was hoping that gungame utils used a similar command as es_tools so that i could just edit the code, but thats probably not possible. here was the code from omg_ammo:
block load
{
  es_doblock corelib/noisy_on
  es_xset pweapon 0
}

block unload
{
  es_doblock corelib/noisy_off
}

event round_start
{
   es_msg #multi #green Enjoy unlimited ammo!
}

event weapon_fire
{
  es_xset pfire 0
  es_xset pweapon 0

    es_format pweapon "weapon_%1" event_var(weapon)
    es est_getweaponindex pfire event_var(es_username) server_var(pweapon)
   
    es es_setindexprop server_var(pfire) "CBaseCombatWeapon.LocalWeaponData.m_iClip1" 124
}
 


thanks for your help guys. this thread probably needs to continue in the suggestions forum instead of in here, so i apologize.

PostPosted: Fri Dec 05, 2008 3:07 am
by Warren
Since unlimited ammo is not a new idea, and it doesn't really relate to gungame, check out this filter on ESAM. I'm sure it would be easiest to just use one of those.

http://addons.eventscripts.com/addons/tags/527

PostPosted: Fri Dec 05, 2008 3:35 am
by Don
Oh yeah, that script up top needs eventscripts_noisy 1. I forgot to mention that.

PostPosted: Fri Dec 05, 2008 1:04 pm
by PitBull
Also there is a mistake with the set-part. I set the ammo, but I need to set the clip:
def weapon_fire(event_var):
    playerlib.getPlayer(event_var['userid']).set("clip", [event_var['weapon'],10])