Raised This Month: $ Target: $400
 0% 

Need plugin resupply ammo when I choose a player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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