Thread: [Solved] give grenade to player
View Single Post
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 06-10-2021 , 00:43   give grenade to player
Reply With Quote #1

hi! how to use fun's give_item() properly? I'm trying to give grenades to player when he throwing 'em but it gives me only flashbangs. Can someone help me and tell where are errors here?
Code:
#include <amxmodx>
#include <fun>
#include <csx>

new pCvar

public plugin_init() {
	register_plugin("infinite_grenades", "latest", "kww")
	pCvar = register_cvar("sv_testcvar", "1", FCVAR_SERVER)
}

public grenade_throw(id, gid, wid) {
	if(!get_pcvar_num(pCvar))
		return PLUGIN_HANDLED
	
	switch(wid) {
		case CSW_HEGRENADE: give_item(id, "weapon_hegrenade")
		case CSW_FLASHBANG: give_item(id, "weapon_flashbang")
		case CSW_SMOKEGRENADE: give_item(id, "weapon_smokegrenade")
	}
	
	return PLUGIN_CONTINUE
}

Last edited by kww; 06-11-2021 at 10:34.
kww is offline