AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Have no clue why it won't work! (https://forums.alliedmods.net/showthread.php?t=130773)

GXLZPGX 06-27-2010 10:17

Have no clue why it won't work!
 
These two should work fine together:

PHP Code:

RegisterHamHam_Killed"player""player_killed"

+

PHP Code:

public player_killediVictimiAttacker )
{
    new 
iAttacker read_data(1)
    new 
iVictim read_data(2)
    
    if( 
iVictim == iAttacker )
        return 
PLUGIN_HANDLED
    
    
if( cs_get_user_teamiVictim ) == CS_TEAM_CT )
    {
        
gShouldSwitch[iVictim] = true
        gShouldSwitch
[iAttacker] = true
        iPoints
[iAttacker] += 35
        client_print_color
iAttackerBlue"^4[DoA] You gained^3 35 iPoints!" )
        
client_print_coloriVictimRed"^4[DoA] You have been killed, and will spawn as a ^3zombie^4 next round." )
    }
    else if( 
cs_get_user_teamiVictim ) == CS_TEAM_T )
    {
        
iPoints[iAttacker] += 35
        client_print_color
iAttackerRed"^4[DoA] You gained^3 35 iPoints!" )
        
client_print_coloriVictimRed"^4[DoA]^3 I trust you will do better next time.." )
    }
    
    return 
PLUGIN_HANDLED;


It won't display the message or add the points. Should I register a death message like this?

PHP Code:

register_event("DeathMsg""EventDeathMsg""a"); 

PHP Code:

public EventDeathMsg()
{
    new 
iAttacker read_data(1)
    new 
iVictim read_data(2)
    
    if( 
iVictim == iAttacker )
        return 
PLUGIN_HANDLED
    
    
if( cs_get_user_teamiVictim ) == CS_TEAM_CT )
    {
        
gShouldSwitch[iVictim] = true
        gShouldSwitch
[iAttacker] = true
        iPoints
[iAttacker] += 35
        client_print_color
iAttackerBlue"^4[DoA] You gained^3 35 iPoints!" )
        
client_print_coloriVictimRed"^4[DoA] You have been killed, and will spawn as a ^3zombie^4 next round." )
    }
    else if( 
cs_get_user_teamiVictim ) == CS_TEAM_T )
    {
        
iPoints[iAttacker] += 35
        client_print_color
iAttackerRed"^4[DoA] You gained^3 35 iPoints!" )
        
client_print_coloriVictimRed"^4[DoA]^3 I trust you will do better next time.." )
    }
    
    return 
PLUGIN_HANDLED;


EDIT: WHEN I REGISTERED A DEATH MESSAGE IT WORKED

drekes 06-27-2010 11:07

Re: Have no clue why it won't work!
 
Don't use read_data in Ham_Killed, use params instead.

Alucard^ 06-27-2010 11:11

Re: Have no clue why it won't work!
 
Like drekes said, Ham_Killed detect automatically the killer and the victim... just here:

PHP Code:

iVictimiAttacker 

You only have to use as you want...

read_data( ) is for events.


All times are GMT -4. The time now is 14:51.

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