I tried to write a plugin, that gives 1 grenade to a player that makes a frag with a grenade.
Here is the code
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "Grenade Bonus"
#define VERSION "1.0"
#define AUTHOR "OptimuS"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "playerDeath", "a", "1>0")
}
public playerDeath()
{
new killer = read_data(1)
new victim = read_data(2)
new weapon[8]
read_data(4, weapon, 7)
if (killer != victim && equal(weapon, "grenade"))
{
new clip, ammo
new const uid = get_user_index(killer)
get_user_ammo(uid, CSW_HEGRENADE, clip, ammo)
if(ammo == 0)
{
give_item(uid, "weapon_hegrenade")
}
}
}
And this is the error log from the compiler
Code:
//// groptimus.sma
// D:\groptimus.sma(26) : error 035: argument type mismatch (argume
nt 1)
Line 26 is
new const uid = get_user_index(killer);
Any help would be appreciated, thank you.