Raised This Month: $ Target: $400
 0% 

Need plugin resupply ammo when I choose a player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazyChickenTest
Member
Join Date: Jul 2010
Location: World ;)
Old 07-15-2010 , 17:42   Need plugin resupply ammo when I choose a player
Reply With Quote #1

Hi!
Need plugin to resupply ammo when I choose a player and press +USE. Something like this http://forums.alliedmods.net/showthread.php?t=62756 but I need to resupply ammo. Sorry for my not good english. Thx for help
CrazyChickenTest is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 07-15-2010 , 17:44   Re: Need plugin resupply ammo when I choose a player
Reply With Quote #2

Choose as in aim on? Or what?
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-15-2010 , 18:05   Re: Need plugin resupply ammo when I choose a player
Reply With Quote #3

short and simple:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new pcvar_interval
new pcvar_range
new g_max_bpammo[33] = {0,52,0,90,1,32,1,100,90,1,120,100,100,90,90,90,100,120,30,120,200,32,90,120,90,2,35,90,90,0,100,0,0}

public 
plugin_init(){
    
register_plugin("ResupplyTargetAmmo""1.0""Sylwester")
    
pcvar_interval register_cvar("resupply_interval""0.5")
    
pcvar_range register_cvar("resupply_range""100.0")
    
register_forward(FM_PlayerPreThink"player_PreThink")
}


public 
player_PreThink(id){
    static 
Float:last_time[33]
    if(!
is_user_alive(id))
        return
    new 
Float:time get_gametime()
    if(
time last_time[id] < get_pcvar_float(pcvar_interval))
        return
    if(!(
pev(idpev_button) & IN_USE))
        return
    new 
targetbody
    
new Float:distance get_user_aiming(idtargetbody)
    if(!
is_user_alive(target)
    || 
distance get_pcvar_float(pcvar_range)
    || 
cs_get_user_team(target)!=cs_get_user_team(id))
        return

    new 
clipbpweapon
    weapon 
get_user_weapon(targetclipbp)
    if(
bp g_max_bpammo[weapon])
        
cs_set_user_bpammo(targetweaponbp+1)
    
last_time[id] = time

__________________
Impossible is Nothing
Sylwester is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 07-15-2010 , 18:10   Re: Need plugin resupply ammo when I choose a player
Reply With Quote #4

Wouldn't it be better to just use CmdStart?
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-15-2010 , 18:19   Re: Need plugin resupply ammo when I choose a player
Reply With Quote #5

Maybe, but if you talk about cases where prethink is called more often, then on the other hand there will be little longer delay before giving ammo. There are many things that would be better (starting with caching most of the stuff), but I don't have time to make perfect version and besides this is scripting help, not suggestions/requests.
__________________
Impossible is Nothing
Sylwester is offline
CrazyChickenTest
Member
Join Date: Jul 2010
Location: World ;)
Old 07-16-2010 , 03:40   Re: Need plugin resupply ammo when I choose a player
Reply With Quote #6

Sylwester thx it working ;)
Topic is ready for close
CrazyChickenTest is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 07-16-2010 , 19:54   Re: Need plugin resupply ammo when I choose a player
Reply With Quote #7

I think this was for Suggestions/Requests.
SpeeDeeR is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode