Raised This Month: $ Target: $400
 0% 

call function on death, once per map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SCHWEDEN
Member
Join Date: Dec 2007
Location: 127.0.0.1
Old 10-09-2010 , 09:26   call function on death, once per map
Reply With Quote #1

PHP Code:
public hook_DeathMsg()
{
    new 
iVictim read_data(2);
    
functionHere(iVictim);

I do this to call a function/method on iVictim everytime he dies, but I want it only to happen once per map, not every death.

How would I go about doing that? I think I need some kind of counter right?
__________________

SCHWEDEN is offline
Send a message via MSN to SCHWEDEN
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-09-2010 , 09:36   Re: call function on death, once per map
Reply With Quote #2

Example:
PHP Code:
new gVariable33 ]

public 
hook_DeathMsg()
{
    new 
iVictim read_data(2);
    if( !
gVariableiVictim ] )
    {
         
functionHere(iVictim);
         
gVariableiVictim ] = true
    
}

__________________
alan_el_more is offline
Old 10-09-2010, 09:37
shuttle_wave
This message has been deleted by shuttle_wave.
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 10-09-2010 , 09:38   Re: call function on death, once per map
Reply With Quote #3

Quote:
Originally Posted by alan_el_more View Post
Example:
PHP Code:
new gVariable33 ]

public 
hook_DeathMsg()
{
    new 
iVictim read_data(2);
    if( !
gVariableiVictim ] )
    {
         
functionHere(iVictim);
         
gVariableiVictim ] = true
    
}

y not use a boolen?
__________________
JailBreak Mod with Plugin API ( 90% ) Public
shuttle_wave is offline
SCHWEDEN
Member
Join Date: Dec 2007
Location: 127.0.0.1
Old 10-10-2010 , 12:57   Re: call function on death, once per map
Reply With Quote #4

Quote:
Originally Posted by shuttle_wave View Post
y not use a boolen?
How do you mean?
__________________

SCHWEDEN is offline
Send a message via MSN to SCHWEDEN
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-10-2010 , 16:42   Re: call function on death, once per map
Reply With Quote #5

Quote:
Originally Posted by SCHWEDEN View Post
How do you mean?
Not entirely sure what he means but it might be this:

PHP Code:
new bool:gVariable33 

public 
hook_DeathMsg() 

    new 
iVictim read_data(2); 
    if( !
gVariableiVictim ] ) 
    { 
         
functionHere(iVictim); 
         
gVariableiVictim ] = true 
    


__________________
fysiks is offline
SCHWEDEN
Member
Join Date: Dec 2007
Location: 127.0.0.1
Old 10-10-2010 , 16:43   Re: call function on death, once per map
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Not entirely sure what he means but it might be this:

PHP Code:
new bool:gVariable33 

public 
hook_DeathMsg() 

    new 
iVictim read_data(2); 
    if( !
gVariableiVictim ] ) 
    { 
         
functionHere(iVictim); 
         
gVariableiVictim ] = true 
    


Which method is the correct one?
__________________

SCHWEDEN is offline
Send a message via MSN to SCHWEDEN
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-10-2010 , 16:44   Re: call function on death, once per map
Reply With Quote #7

Quote:
Originally Posted by SCHWEDEN View Post
Which method is the correct one?
Both will work the same. Mine is technically the most correct form.
__________________
fysiks is offline
SCHWEDEN
Member
Join Date: Dec 2007
Location: 127.0.0.1
Old 10-10-2010 , 18:26   Re: call function on death, once per map
Reply With Quote #8

Worked great (Y) fysiks
__________________

SCHWEDEN is offline
Send a message via MSN to SCHWEDEN
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 10-10-2010 , 22:49   Re: call function on death, once per map
Reply With Quote #9

You have to clear the var when the user disconnects (for fysiks's plugin)
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-11-2010 , 00:22   Re: call function on death, once per map
Reply With Quote #10

Quote:
Originally Posted by Mxnn View Post
You have to clear the var when the user disconnects (for fysiks's plugin)
It's not my code btw, I just added "bool:". Don't blame me for the code lol .
__________________
fysiks 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 10:28.


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