AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   message on respawn, death (https://forums.alliedmods.net/showthread.php?t=127367)

FlyingHorse 05-20-2010 09:08

message on respawn, death
 
So, how do i add a message when player spawns? For example: "You have respawned" or .. "you have died" ?

hzqst 05-20-2010 09:22

Re: message on respawn, death
 
client_print (index, print_chat, any:...)

to use this you should hook Ham_Spawn and Ham_Killed first

drekes 05-20-2010 09:29

Re: message on respawn, death
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_Spawn"player""Event_Ham_Spawn_Post"1)
    
RegisterHam(Ham_Killed"player""Event_Ham_Killed")
}

public 
Event_Ham_Spawn_Post(id)
{
    if(
is_user_alive(id))
        
client_print(idprint_chat"You spawned")
}

public 
Event_Ham_Killed(victimattackershouldgib)
{
    if(!
is_user_alive(victim) && is_user_alive(attacker))
    {
        new 
AttackerName[33]
        
get_user_name(attackerAttackerName32)

        
client_print(victimprint_chat"You have been killed by %s"AttackerName)
    }



Exolent[jNr] 05-20-2010 19:34

Re: message on respawn, death
 
@drekes
You should hook spawn in post and check is_user_alive().

drekes 05-20-2010 19:47

Re: message on respawn, death
 
Quote:

Originally Posted by Exolent[jNr] (Post 1186384)
@drekes
You should hook spawn in post and check is_user_alive().

fixed

FlyingHorse 05-25-2010 10:34

Re: message on respawn, death
 
Thanks.. but on the death message.. how do i add who the killer is.. like "killed by %s" or something like that

is it like this?..
PHP Code:

public Event_Ham_Killed(victimattackershouldgib)
{
    if(
is_user_connected(victim))
    
ColorChat(victimGREEN"^x04[Rambo Mod]^x01 You got owned by %s"attacker)



drekes 05-25-2010 12:35

Re: message on respawn, death
 
updated my post


All times are GMT -4. The time now is 03:32.

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