AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Two IDs in one function (https://forums.alliedmods.net/showthread.php?t=296295)

iNvectus 04-17-2017 08:38

Two IDs in one function
 
Greetings.I have more of a question than needing help in certain code.The question is: How can I get two ids of two players in one function.Example: To make a duel/battle/fight/challenge come true I need two IDs, right? Uncle Google couldn't help me so far, so I guess you guys could help me.

HamletEagle 04-17-2017 08:46

Re: Two IDs in one function
 
You can add as many parameters as you want to your custom function.

Craxor 04-17-2017 08:50

Re: Two IDs in one function
 
As an example:

PHP Code:

// Set the same health to two different users.
my_functionid1id2 health)
{
    
set_user_healthid1health );
    
set_user_healthid2health )


The idea of using more parameters require just to USE THEM

P.S.: Ask Uncle Google if he knows about plugins who already do that.

eyal282 04-20-2017 10:37

Re: Two IDs in one function
 
Create a variable of Partner of a player.

new Partner[33];
--------
Set Partner[id] to -1 if he has no partner ( no duel takes place ).
--------
Set Partner[id] = target;
Set Partner[target] = id;

Do that if they have a duel.

---------

If it's like a JailBreak Last Request where there is only 1 duel at the time, create two integers of Guard and Prisoner

Do:
Guard = ID of guard.
Prisoner = ID of prisoner.

OciXCrom 04-20-2017 13:29

Re: Two IDs in one function
 
Why -1? 0 works fine.


All times are GMT -4. The time now is 18:02.

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