Raised This Month: $ Target: $400
 0% 

A task for both players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 08-11-2011 , 09:45   A task for both players
Reply With Quote #1

I am using this in a damage fuction:

PHP Code:
make_deathmsgiAttackeriVictim0"UNKNOWN" ); 
Now sometimes this happens also when the victim is still alive, so I would need to have a task and check then if the victim is dead. But how can I use a task for both players? At the end it would be:

PHP Code:
if(is_user_connected(iAttacker) && is_user_connected(iVictim) && !is_user_alive(iVictim))
     
//make_deathmsg here 
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-11-2011 , 10:04   Re: A task for both players
Reply With Quote #2

Use the data parameter in set_task() to hold both victim and attacker id's.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 08-11-2011 , 10:22   Re: A task for both players
Reply With Quote #3

Something like this?

PHP Code:
set_task0.5"check_dead"iAttacker"iVictim" );

public 
check_deadiAttackeriVictim )
     
//check first and make_deathmsg 
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-11-2011 , 10:39   Re: A task for both players
Reply With Quote #4

Data parameter takes an array, not a string.
You will need to supply the size of the array as the next parameter.

Also, the header of the task function has the data array declared first, then the task id.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-11-2011 , 10:38   Re: A task for both players
Reply With Quote #5

Code:
new data[1]; data[0] = iVictim; set_task(0.5, "check_dead", iAttacker, data, sizeof data); public check_dead(data[], iAttacker) {     //data[0] contains victim's ID }
__________________
hleV is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-11-2011 , 10:41   Re: A task for both players
Reply With Quote #6

new params[2]
params[0] = killer
params[1] = victim

set_task(flTaskTime, szTaskName, iTaskIndex, params, sizeof(params))
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 03:26.


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