McKeewa 7 Posted June 19, 2013 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
samatra 85 Posted June 19, 2013 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
McKeewa 7 Posted June 19, 2013 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
headswe 17 Posted June 19, 2013 Seems to be quite simple, thank you, I'll check thatIf 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
McKeewa 7 Posted June 19, 2013 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
samatra 85 Posted June 20, 2013 There is no "this" inside addAction executed code block. Learn about arguments passed by addAction: http://community.bistudio.com/wiki/addAction (Parameters of the called script upon activation) You'll need to use "player" instead of "this" Share this post Link to post Share on other sites