Raised This Month: $ Target: $400
 0% 

Help count frags + reward


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-25-2013 , 08:13   Help count frags + reward
Reply With Quote #1

Hello,

Can someone make a plugin that Count frags from 0 to death and show this message in hud:

set_hudmessage(255, 0, 0, 0.02, 0.20, 0, 1.0, 1.0, 0.1, 0.2, 1)
show_hudmessage(id, "Frags: %d", frags)

After he die frags need to reset to 0.
I must say i'm using CSDM and is only 1 round with no time per round

When the player get to 10 frags

set_user_health(id, 300)
set_user_armor(id, 200)
and his screen makes red for 1 sec

and after he die to became normal

100 hp, 0 armor

Thank you

I've tryed something:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

new const sounds[ ][ ] =
{
    
"rage/scream1.wav",
    
"rage/scream3.wav",
    
"rage/scream4.wav",
    
"rage/scream02.wav",
    
"rage/scream06.wav"
};

public 
plugin_init()
{
   
register_event("DeathMsg""hook_death""a""1>0")     
}

public 
plugin_precache( )
{
    for( new 
isizeof soundsi++ )
    {
        
precache_soundsounds] );
    }
}

public 
hook_death(id)
{    
    if(
get_user_frags(id) > 2)
    {        
        
set_user_health(id300)
    
        
set_user_armor(id200)
    
        new 
name[33]
        
get_user_name(idname32)
    
        
set_hudmessage(20000, -1.00.2506.05.0)
        
show_hudmessage(0"%s: RAGE !!! Sa il omoare cineva !!!"name )
    
        
client_cmd0"spk ^"%a^""sounds[random_num(0,sizeof(sounds))])

        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id)
        
write_short(1<<10)
        
write_short(1<<10)
        
write_short(0x0000)
        
write_byte(200)
        
write_byte(0)
        
write_byte(0)
        
write_byte(75)
        
message_end()
    }
    
    else
    {
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;


Last edited by daNzEt; 12-25-2013 at 09:37.
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
DavidJr
Senior Member
Join Date: Apr 2012
Old 12-25-2013 , 10:11   Re: Help count frags + reward
Reply With Quote #2

You hook DeathMsg incorrect.

PHP Code:
register_event("DeathMsg""event_DeathMsg""a"
PHP Code:
public event_DeathMsg()
{
    new 
iKiller read_data(1//this is the killer
    
new iVictim read_data(2//this is the victim
    
    
if (get_user_frags(iKiller) > 2)
    {
        
set_user_health(iKiller300
        
set_user_armor(iKiller200
        
        new 
name[33
        
get_user_name(iKillername32
        
        
set_hudmessage(20000, -1.00.2506.05.0
        
show_hudmessage(0"%s: RAGE !!! Sa il omoare cineva !!!"name 
        
        
client_cmd(0"spk ^"%a^""sounds[random_num(0,sizeof(sounds))]) 
    
        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id
        
write_short(1<<10
        
write_short(1<<10
        
write_short(0x0000
        
write_byte(200
        
write_byte(0
        
write_byte(0
        
write_byte(75
        
message_end() 
    }

__________________
What are you looking for here?
DavidJr is offline
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-26-2013 , 04:24   Re: Help count frags + reward
Reply With Quote #3

It's not working ...

PHP Code:
#include <amxmodx>
#include <fun>

new const sounds[ ][ ] =
{
    
"rage/scream1.wav",
    
"rage/scream3.wav",
    
"rage/scream4.wav",
    
"rage/scream02.wav",
    
"rage/scream06.wav"
};

public 
plugin_init()
{
   
register_event("DeathMsg""event_DeathMsg""a")      
}

public 
plugin_precache( )
{
    for( new 
isizeof soundsi++ )
    {
        
precache_soundsounds] );
    }
}

public 
event_DeathMsg()
{
    new 
iKiller read_data(1)
    
    if (
get_user_frags(iKiller) > 10)
    {
        
set_user_health(iKiller300
        
set_user_armor(iKiller200
        
        new 
name[33
        
get_user_name(iKillername32
        
        
set_hudmessage(20000, -1.00.2506.05.0
        
show_hudmessage(0"%s: RAGE !!! Sa il omoare cineva !!!"name 
        
        
client_cmd(0"spk ^"%a^""sounds[random_num(0,sizeof(sounds))]) 
    
        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, iKiller
        
write_short(1<<10
        
write_short(1<<10
        
write_short(0x0000
        
write_byte(200
        
write_byte(0
        
write_byte(0
        
write_byte(75
        
message_end() 
    }

Doesn't give anything to player with more then 10 kills without to die.
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
DavidJr
Senior Member
Join Date: Apr 2012
Old 12-27-2013 , 10:54   Re: Help count frags + reward
Reply With Quote #4

What do you want to give?
__________________
What are you looking for here?
DavidJr is offline
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-27-2013 , 11:07   Re: Help count frags + reward
Reply With Quote #5

Damn ... 300 hp / 200 armor / hudmessage to all / screenfade for 1 sec red to killer
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
DavidJr
Senior Member
Join Date: Apr 2012
Old 12-27-2013 , 11:23   Re: Help count frags + reward
Reply With Quote #6

Try this:
PHP Code:
public event_DeathMsg()
{
    new 
iKiller read_data(1//this is the killer
    
new iVictim read_data(2//this is the victim
    
    
g_Kills[iKiller] ++
    
    if (
g_Kills[iKiller] >= 10)
    {
        
set_user_health(iKiller300
        
set_user_armor(iKiller200
        
        new 
name[33
        
get_user_name(iKillername32
        
        
set_hudmessage(20000, -1.00.2506.05.0
        
show_hudmessage(0"%s: RAGE !!! Sa il omoare cineva !!!"name 
        
        
client_cmd(0"spk ^"%a^""sounds[random_num(0,sizeof(sounds))]) 
    
        
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id
        
write_short(1<<10
        
write_short(1<<10
        
write_short(0x0000
        
write_byte(200
        
write_byte(0
        
write_byte(0
        
write_byte(75
        
message_end() 
    }

__________________
What are you looking for here?
DavidJr is offline
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-27-2013 , 13:19   Re: Help count frags + reward
Reply With Quote #7

Can't compile:

PHP Code:
error 017undefined symbol "g_Kills" 
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
wTf.
Senior Member
Join Date: Aug 2011
Location: This important?
Old 12-27-2013 , 14:40   Re: Help count frags + reward
Reply With Quote #8

create a global veriable.

PHP Code:
new g_Kills[33

Last edited by wTf.; 12-27-2013 at 14:42.
wTf. is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 12-27-2013 , 15:21   Re: Help count frags + reward
Reply With Quote #9

You should check if the Killer is alive / connected. Also some of your variables can be made static.
Also, reset g_Kills for the Victim, else they won't be resetted after death.
__________________
Kia is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 12-27-2013 , 19:49   Re: Help count frags + reward
Reply With Quote #10

Kia, ah I forgot. Anyway, he didn't request for reset ;)
__________________
What are you looking for here?
DavidJr is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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