AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Vampire bug (https://forums.alliedmods.net/showthread.php?t=90205)

Debesėlis 04-15-2009 09:30

Vampire bug
 
Whats wrong here? When I kill an opponent I am given hp and shown the specified effect, but when I get killed myself the same happens.. How could I fix that?

PHP Code:

public death_event(id)
{

    if(
get_user_flags(id) & ADMIN_ACCESS)
    {
    new 
killer read_data(1)
    if(
vampir_active[killer] == 1)
    {
    
set_user_health(killerget_user_health(killer)+get_cvar_num("amx_vampire_hp"))
    
client_print(killerprint_chat"%L"LANG_PLAYER"VAMPIRE"get_cvar_num("amx_vampire_hp"))
  
    
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, killer)
    
write_short(1<<10)
    
write_short(1<<10
    
write_short(0x0000)
    
write_byte(0)
    
write_byte(0)
    
write_byte(200)
    
write_byte(75)
    
message_end()
    }
    }



Arkshine 04-15-2009 09:36

Re: Vampire bug
 
Do a check that killer must not be the same than victim, If I understand well.

Debesėlis 04-15-2009 10:10

Re: Vampire bug
 
Do you have any ideas on where "victim" should be?

Arkshine 04-15-2009 10:13

Re: Vampire bug
 
read_data(2)

xPaw 04-15-2009 10:17

Re: Vampire bug
 
PHP Code:

public death_event( ) {
    if( 
get_user_flagsid ) & ADMIN_ACCESS ) {
        new 
iKiller read_data);
        new 
iVictim read_data);
        
        if( 
vampir_active[killer] && iKiller != iVictim ) {
            
set_user_health(iKillerget_user_health(iKiller)+get_cvar_num("amx_vampire_hp"));
            
client_print(iKillerprint_chat"%L"iKiller"VAMPIRE"get_cvar_num("amx_vampire_hp"));

            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("ScreenFade"), _iKiller);
            
write_short(1<<10);
            
write_short(1<<10);
            
write_short(FFADE_IN);
            
write_byte(0);
            
write_byte(0);
            
write_byte(200);
            
write_byte(75);
            
message_end();
        }
    }



Debesėlis 04-15-2009 10:33

Re: Vampire bug
 
Quote:

Originally Posted by xPaw (Post 805998)
PHP Code:

public death_event( ) {
    if( 
get_user_flagsid ) & ADMIN_ACCESS ) {
        new 
iKiller read_data);
        new 
iVictim read_data);
        
        if( 
vampir_active[killer] && iKiller != iVictim ) {
            
set_user_health(iKillerget_user_health(iKiller)+get_cvar_num("amx_vampire_hp"));
            
client_print(iKillerprint_chat"%L"LANG_PLAYER"VAMPIRE"get_cvar_num("amx_vampire_hp"));

            
message_begin(MSG_ONEget_user_msgid("ScreenFade"), _iKiller);
            
write_short(1<<10);
            
write_short(1<<10);
            
write_short(0x0000);
            
write_byte(0);
            
write_byte(0);
            
write_byte(200);
            
write_byte(75);
            
message_end();
        }
    }



Thank you works fine! :)

Arkshine 04-15-2009 11:00

Re: Vampire bug
 
By the way :

- You should use pcvar
- MSG_ONE -> MSG_ONE_UNRELIABLE
- LANG_PLAYER -> iKiller ( LANG_PLAYER should be used for all players, 0 as id )

Debesėlis 04-15-2009 11:32

Re: Vampire bug
 
Quote:

Originally Posted by arkshine (Post 806020)
By the way :

- You should use pcvar
- MSG_ONE -> MSG_ONE_UNRELIABLE
- LANG_PLAYER -> iKiller ( LANG_PLAYER should be used for all players, 0 as id )

The message works with iKiller. But I only need the message to be displayed to the killer, not to all players. Thanks for the note I changed to
PHP Code:

client_print(idprint_chat, ... 


Debesėlis 04-16-2009 07:11

Re: Vampire bug
 
Everythings fine, just that when an admin chooses the vampire function and kills someone, everyone in the server is given hp. How do I make it so only the admin would get hp.

PHP Code:

public death_event(id
{
    if(
get_user_flags(id) & ADMIN_ACCESS
    {
    new 
iKiller read_data(1);
    new 
iVictim read_data(2);
    
    if(
vampir_active[iKiller] && iKiller != iVictim)
    {
    
set_user_health(iKillerget_user_health(iKiller) + get_cvar_num("amx_vampir_hp"));
    
client_print(idprint_chat"%L"LANG_PLAYER"VAMPIRE"get_cvar_num("amx_vampir_hp"));
    
    
message_begin(MSG_ONEget_user_msgid("ScreenFade"), _iKiller);
    
write_short(1<<10);
    
write_short(1<<10);
    
write_short(0x0000);
    
write_byte(0);
    
write_byte(0);
    
write_byte(200);
    
write_byte(75);
    
message_end();
    }
    }



tuty 04-16-2009 07:59

Re: Vampire bug
 
0x0000 ->

#define FFADE_IN
0x0000


All times are GMT -4. The time now is 02:28.

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