when a player killing another player with a car its should display a color chat like this:
Blabla killed Blabla with a Car
but insted the plugin display this:
Server name killed Blabla with a Car
Code:
PHP Code:
#include <amxmodx>
#include <colorchat>
new g_msgDeathMsg, KilledByVehicle[33];
public plugin_init() {
register_plugin("Car Accident", "1.0", "lolz123")
g_msgDeathMsg = get_user_msgid("DeathMsg")
register_message(g_msgDeathMsg, "hookmsg_death")
register_event("DeathMsg", "EventDeathMsg", "a");
}
public hookmsg_death(msgid, msgdest, msgargs)
{
new weapon[32]
get_msg_arg_string(4, weapon, 31)
new victim = get_msg_arg_int(2);
if (equal(weapon, "vehicle"))
{
KilledByVehicle[victim] = true;
}
return PLUGIN_CONTINUE
}
public EventDeathMsg()
{
new killer = read_data(1);
new victim = read_data(2);
new ikiller[33], ivictim[33];
get_user_name(killer, ikiller, 32)
get_user_name(victim, ivictim, 32)
if( victim != killer )
{
if(KilledByVehicle[victim]) {
ColorChat(0, BLUE, "%s Killed %s with a Car !", ikiller, ivictim)
}
}
KilledByVehicle[victim] = false;
}