Jump to content
Sign in to follow this  
McKeewa

Auto LoadOut depending of IDs

Recommended Posts

Hi there

I'm tying to script something (not-so) special.

I would like a box (through addaction), that when someone activate it, the box get is ID, compare it to his list and equip the guy following the stuff behind the ID, in the script.

I Hope it's clear enough

I think to work with getPlayerUID

something like :

_unit = getPlayerUID select 1;

if _unit == "789456123" {
_unit addweapon "pewpew";
}

if _unit == "741852963" {
_unit addweapon "panpan";
}

I really don't know how to make that kind of codes.

could someone help me ? :bounce3:

Share this post


Link to post
Share on other sites

Box init lint:

this addAction ["Equip me", {
switch(getPlayerUID(player)) do {
	case "789456123": {
		//Whatever weapons\stuff you want
	};
	case "111111111": {
		//Another special gear for another uid
	};
	default {
		//Everyone else gets this
	};
};
}];

create as many cases as you want

Share this post


Link to post
Share on other sites

Seems to be quite simple, thank you, I'll check that

If I want to put it in a .sqf (for more clearness) is there any big changes ?

Share this post


Link to post
Share on other sites
Seems to be quite simple, thank you, I'll check that

If I want to put it in a .sqf (for more clearness) is there any big changes ?

Make sure it gets run on every client ( eg call it from a init or init.sqf)

Share this post


Link to post
Share on other sites

Ok, I tried it,

It works, but it doesn't work.

I mean.

this addAction ["Equip me", {

switch(getPlayerUID(player)) do {

case "789456123": {

//Whatever weapons\stuff you want

};

case "111111111": {

//Another special gear for another uid

};

default {

hint "prout";

removeallweapons this;

//Everyone else gets this

};

};

}];

I tried it In MP, and editor (with the default), the script works, but nothing happens

When I Action the addAction, the "prout" appear, but guns are always here. I this this is the "this" that doesn't work ... Maybe I need to put a select a te beginning of the script.

---------- Post added at 23:30 ---------- Previous post was at 23:20 ----------

box addAction ["Equip me", {

_u = _this select 1;

switch(getPlayerUID(player)) do {

case "76561197999941840": {

this addweapon "R3F_HK417S_HG";

};

case "111111111": {

//Another special gear for another uid

};

default {

hint "prout";

removeallweapons _u;

};

};

}];

Like this, it's work, in the init.sqf

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×