Im trying to learn small by making a very simple plugin for TFC.
I want the plugin to detect
_ if a player has nail grenades
_ send a print message that nail grenades cant be used
_ empty the players ammo bag from nail grenades
I probably do some very stupid things while coding, but im very new to it.
I looked at
pizzahuts sniper plugin to see how to detect a weapon.
It works for switchable weapons but not for grenades. I have this now, it compiles but i dont get any message that nail grenades are carried
Code:
/* AMX Mod X
* Anti Nail Grenade Plugin for Team Fortress Classic
*
* Created by Lt Llama
* based on pizzahut's Anti-Sniper AMX script.
*/
#include <amxmodx>
#include <engine>
#include <tfcx>
#include <tfcconst>
new announced[33]
public plugin_init() {
register_plugin("Anti-Nail", "0.1", "Lt Llama")
}
public client_authorized(id){
announced[id] = 0
}
public client_PreThink(id) {
if (is_user_alive(id)) {
new grenade
if (tfc_isgrenade(grenade) == TFC_WPN_NAILGRENADE ) {
announce(id)
} else {
announced[id] = 0
}
}
return PLUGIN_CONTINUE
}
public announce(id){
if (announced[id]==0) {
client_print(id, print_chat,"You carry nail grenades")
announced[id] = 1
}
}
I tried get_user_weapon and get_user_ammo, but i cant get them to work.
I would be very greatful for any hints in the right direction.
Thx