Raised This Month: $ Target: $400
 0% 

Client_death and round_end


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-10-2013 , 17:00   Client_death and round_end
Reply With Quote #1

I have a plugin that gives money to killer via client_death event. Other plugin checks money @ round_end event. But if is killed last player, round_end happens before client_death, so money isn't counted correctly. So the question is - should I use set_task in round_end or should I use other funcion to determine if player was killed and give him the money which happens before round_end?

EDIT: Or, could you tell me how long does new round starts after round_end is called? Because found new bug.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 07-10-2013 at 17:05.
GuskiS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-10-2013 , 17:21   Re: Client_death and round_end
Reply With Quote #2

You can use HLTV event (search for VEN tutorial), it happens 5.0 seconds after round end on normal ends, and 3.0 seconds after Game Commencing event.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-10-2013 , 17:37   Re: Client_death and round_end
Reply With Quote #3

I've tried using HLTV event, but I cant give money with. Thx for the seconds.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-11-2013 , 04:11   Re: Client_death and round_end
Reply With Quote #4

Sure you can, write what you want to do, show your code.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-11-2013 , 05:16   Re: Client_death and round_end
Reply With Quote #5

PHP Code:
register_logevent("Round_Start"2"1=Round_Start")

public 
Round_Start()
{
    if(
RoundCount 2)
        return
    new 
players[32], pnum
    get_players
(playerspnum)
    for(--
pnumpnum >= 0pnum--)
    {
        new 
id players[pnum]
        if(!
is_user_connected(id))
            return
        new 
win get_pcvar_num(rm_win)
        new 
lose get_pcvar_num(rm_lose)

        if(
g_DidWin[id])
            
addMoney(idg_EndMoney[id], win)
        else 
addMoney(idg_EndMoney[id], lose)
        
g_DidWin[id] = false
    
}

Basicly, my script will check money player is carrying during round_end event, block any new round money and give exact money for victory or loss last round.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-11-2013 , 15:25   Re: Client_death and round_end
Reply With Quote #6

Use HLTV event to store players money.
Block Money message from there.
Hook PlaybackEvent from HLTV event.
When PlaybackEvent is called, unhook it and unblock Money message, and set Players money to the value you want.

HLTV is called at new round, before player spawns and before money is given.
PlaybackEvent is called after that.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-11-2013 , 18:51   Re: Client_death and round_end
Reply With Quote #7

Im new to all this, how do I hook it? And after that, unhook? Also, I blocked the money, how to unblock it?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-12-2013 , 01:04   Re: Client_death and round_end
Reply With Quote #8

un/register_forward
set_msg_block(gmsgMoney, BLOCK_NOT/BLOCK_SET)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
kungfulon
Junior Member
Join Date: Aug 2011
Location: Vietnam
Old 07-12-2013 , 01:14   Re: Client_death and round_end
Reply With Quote #9

Quote:
Originally Posted by GuskiS View Post
But if is killed last player, round_end happens before client_death, so money isn't counted correctly.
Try using Ham_Killed forward.
__________________
c++
kungfulon is offline
Send a message via Yahoo to kungfulon
Old 07-12-2013, 10:17
GuskiS
This message has been deleted by GuskiS. Reason: Nvm, fixed it.
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-12-2013 , 10:55   Re: Client_death and round_end
Reply With Quote #10

Ok, I finally got it to work, thank you for your help.
One more question. I have HLTV event, for cycle with get_players to get all players, after cycle there is register_forward. Problem is that register_forward is being executed before the cycle has stopped. Thats what my debug showed me:
PHP Code:
HLTVEvent()
{
  for(
blabla)
  
console_print(debug1)
console_print(debug2)
register_forward
}

fwPlaybackEvent()
{
for(
blabla)
  
console_print(debug3)
console_print(debug4)
unregister_forward

The output was:
debug2
debug4
debug1
debug3

Why is that?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Reply


Thread Tools
Display Modes

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:24.


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