AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] give_item flashbangs (https://forums.alliedmods.net/showthread.php?t=162868)

keyblade 07-23-2011 23:33

[HELP] give_item flashbangs
 
when i use this
PHP Code:

give_item(idCSW_FLASHBANG)
give_item(idCSW_FLASHBANG

i just get 1 flashbang
how can i get 2 or more flashbangs?

thank you for your help

Xuqe Noia 07-24-2011 02:26

Re: [HELP] give_item flashbangs
 
Sorry, i thought that it was the sourcemod forum

yokomo 07-24-2011 05:30

Re: [HELP] give_item flashbangs
 
Try this for example:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "2,3,4,5,6 FB"
#define VERSION "1.0"
#define AUTHOR "Administrator"
#define FB_AMMO 254

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /fb""FuntionGiveFB")
}

public 
FuntionGiveFB(id)
{
    if(!
is_user_alive(id)) return PLUGIN_HANDLED
        
    
if(user_has_weapon(idCSW_FLASHBANG))
    {
        
cs_set_user_bpammo(idCSW_FLASHBANGcs_get_user_bpammo(idCSW_FLASHBANG)+FB_AMMO)
    }
    else
    {
        
give_item(id,"weapon_flashbang")
        
cs_set_user_bpammo(idCSW_FLASHBANGFB_AMMO)
    }
    
    return 
PLUGIN_HANDLED



keyblade 07-24-2011 11:52

Re: [HELP] give_item flashbangs
 
Quote:

Originally Posted by yokomo (Post 1517245)
Try this for example:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
 
#define PLUGIN "2,3,4,5,6 FB"
#define VERSION "1.0"
#define AUTHOR "Administrator"
#define FB_AMMO 254
 
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
 
    
register_clcmd("say /fb""FuntionGiveFB")
}
 
public 
FuntionGiveFB(id)
{
    if(!
is_user_alive(id)) return PLUGIN_HANDLED
 
    
if(user_has_weapon(idCSW_FLASHBANG))
    {
        
cs_set_user_bpammo(idCSW_FLASHBANGcs_get_user_bpammo(idCSW_FLASHBANG)+FB_AMMO)
    }
    else
    {
        
give_item(id,"weapon_flashbang")
        
cs_set_user_bpammo(idCSW_FLASHBANGFB_AMMO)
    }
 
    return 
PLUGIN_HANDLED



thank you! cs_set_user_bpammo can work



and i feel sorry that i post the thread in wrong forum...


All times are GMT -4. The time now is 00:55.

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