AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   A task for both players (https://forums.alliedmods.net/showthread.php?t=164420)

bibu 08-11-2011 09:45

A task for both players
 
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 


Exolent[jNr] 08-11-2011 10:04

Re: A task for both players
 
Use the data parameter in set_task() to hold both victim and attacker id's.

bibu 08-11-2011 10:22

Re: A task for both players
 
Something like this?

PHP Code:

set_task0.5"check_dead"iAttacker"iVictim" );

public 
check_deadiAttackeriVictim )
     
//check first and make_deathmsg 


hleV 08-11-2011 10:38

Re: A task for both players
 
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 }

Exolent[jNr] 08-11-2011 10:39

Re: A task for both players
 
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.

ConnorMcLeod 08-11-2011 10:41

Re: A task for both players
 
new params[2]
params[0] = killer
params[1] = victim

set_task(flTaskTime, szTaskName, iTaskIndex, params, sizeof(params))


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

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