Ok usually I would tell people whats wrong with there script and what not, but I'm too tired, and there where way too many errors. Just compare my code with yours. Plus, I don't know how to hook grenade events. I know one method involves hooking a sound event and the using get_grenade_id(), but I forget how. I fixed all the obvious errors, but there is bound to be more, and I'm just too tired to go on. I placed comments where some code belongs and some doesn't. Also, this code can not be compiled or tested, its more of a draft if anything, with previous errors fixed.
Hope I helped.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
//Fakemeta natives are not used anywhere here :/
#define PLUGIN "SMOKE PUNISH"
#define VERSION "1.0"
#define AUTHOR "RapHero2000"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("amx_smoke", "1") //turns the plugin on and off
register_cvar("amx_smoke_hp", "101") //sets the amount of hp is takin when a player throws smoke nade
// Place Grenade Event here...
}
public GrenadeEvent() {
if(get_cvar _num ("amx_smoke") == 0)
return PLUGIN_HANDLED
new id = read_data(1); // Don't know if this is right
// get grenade id here, then check to see if its a smoke, if not return plugin_handled (or 0)
new healthToTake = get_cvar_num("amx_smoke_hp");
set_user_health(id, (get_user_health(id) - healthToTake));
explode(id)
}
// This doesn't need to be public, since the core doesn't do anything with it.
explode(player_slay) {
message_begin( MSG_ALL,SVC_TEMPENTITY)
write_byte( 21 )
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2] + 16)
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2] + 1936)
write_short( white )
write_byte( 0 ) // startframe
write_byte( 0 ) // framerate
write_byte( 2 ) // life
write_byte( 16 ) // width
write_byte( 0 ) // noise
write_byte( 188 ) // r
write_byte( 220 ) // g
write_byte( 255 ) // b
write_byte( 255 ) //brightness
write_byte( 0 ) // speed
message_end()
//Explosion2
message_begin( MSG_ALL,SVC_TEMPENTITY)
write_byte( 12 )
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_byte( 188 ) // byte (scale in 0.1's)
write_byte( 10 ) // byte (framerate)
message_end()
//Smoke
message_begin( MSG_ALL,SVC_TEMPENTITY)
write_byte( 5 )
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_short(smoke)
write_byte(2)
write_byte(10)
message_end()
user_kill(player_slay,1)
return PLUGIN_HANDLED
}
__________________