AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Car accident help (https://forums.alliedmods.net/showthread.php?t=159690)

Lolz123 06-20-2011 08:30

Car accident help
 
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_msgDeathMsgKilledByVehicle[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(msgidmsgdestmsgargs)
{
    new 
weapon[32]
    
get_msg_arg_string(4weapon31)

    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(killerikiller32)
    
get_user_name(victimivictim32)
        
    if( 
victim != killer )
    {
        if(
KilledByVehicle[victim]) {
            
ColorChat(0BLUE"%s Killed %s with a Car !"ikillerivictim)
        }
    }
    
KilledByVehicle[victim] = false;



jimaway 06-20-2011 17:41

Re: Car accident help
 
in this car accident, player is killed by worldspawn (i think), not by a player, thats why it returns servers name in get_user_name


All times are GMT -4. The time now is 23:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.