Jump to content
Sign in to follow this  
frezinator

How to remove all weapons after respawning???

Recommended Posts

You can use this:

{

Waituntil {!alive _x};

Waituntil {alive _x};

Removeallweapons _x;} forEach [1,2,3,..];

Replace 1,2,3 with the players you want to remove the weapons from.

Share this post


Link to post
Share on other sites
You can use this:

{

Waituntil {!alive _x};

Waituntil {alive _x};

Removeallweapons _x;} forEach [1,2,3,..];

Replace 1,2,3 with the players you want to remove the weapons from.

how do I run this?

Also, does this works for dedicated server?

Share this post


Link to post
Share on other sites
how do I run this?

Also, does this works for dedicated server?

You run it through Init.sqf.

ExecVM "Removeweapons.sqf";

Im not really fimiliar with MP part of the script, but its is a very simple script, and it should be running ok in MP just as well as in SP...

Share this post


Link to post
Share on other sites

try this, in each player init line:

this addeventhandler ["respawn",{removeallweapons (_this select 0);}];

Share this post


Link to post
Share on other sites
You run it through Init.sqf.

ExecVM "Removeweapons.sqf";

Im not really fimiliar with MP part of the script, but its is a very simple script, and it should be running ok in MP just as well as in SP...

didn't work :(

---------- Post added at 06:22 ---------- Previous post was at 06:21 ----------

try this, in each player init line:

this addeventhandler ["respawn",{removeallweapons (_this select 0);}];

not working :(

Share this post


Link to post
Share on other sites
didn't work :(

You got the first one (waituntil script) into a file and gave it the name "removeweapons.sqf"?

Then, did you replace the [1,2,3] with the names you gave your units in the editor?

If so, ill have to test it out...

Share this post


Link to post
Share on other sites
You got the first one (waituntil script) into a file and gave it the name "removeweapons.sqf"?

Then, did you replace the [1,2,3] with the names you gave your units in the editor?

If so, ill have to test it out...

yes I did, I put all of that in notepad then I named it removeweapons.sqf. I also put the codes in the init.sqf and I named the players p1,p2,p3, including replacing [1,2,3,]. When I tested it, after I respawned I still have weapons..

Share this post


Link to post
Share on other sites
try this, in each player init line:

this addeventhandler ["respawn",{removeallweapons (_this select 0);}];

surely you dont need respawn event handler in init field which is triggered when you respawn anyway.

@frezinator put this in init field

removeAllWeapons this

this won't remove items like gps radio etc but will remove all weapons.

Share this post


Link to post
Share on other sites
surely you dont need respawn event handler in init field which is triggered when you respawn anyway.

@frezinator put this in init field

removeAllWeapons this

this won't remove items like gps radio etc but will remove all weapons.

I think he wants it just after the unit REspawn, not first dpawn

Share this post


Link to post
Share on other sites
I think he wants it just after the unit REspawn, not first dpawn

Yes ur right! I just want removeallweapons after players respawn.. did u found a way? I still can't find a solution :(

Share this post


Link to post
Share on other sites
I think he wants it just after the unit REspawn, not first dpawn

Sorry could you clarify this? When you are dead and respawn you respawn into new unit not old one as it is now a dead body so theoretically you only need to remove weapons from new units or am I wrong?

Share this post


Link to post
Share on other sites
Yes ur right! I just want removeallweapons after players respawn.. did u found a way? I still can't find a solution :(

I gonna have to test it out, ill give you an answere in an hour or so

---------- Post added at 15:42 ---------- Previous post was at 14:06 ----------

OK.

got it to work.

I did not manage to make it with variables, so its a bit clumsy...

SO, the Removeweapons.sqf is changed to "Removeweaponsp1.sqf", and inside there is this:

while {true} do {
waitUntil {!alive p1};
waitUntil {alive p1};
sleep 0.001;
removeallweapons p1;
sleep 0.001;
};

with p1 being your unit name.

now you need to copy and paste it for every unit you want, and change the following things inside the script:

while {true} do {
waitUntil {!alive [name here]};
waitUntil {alive [name here]};
sleep 0.001;
removeallweapons [name here];
sleep 0.001;
};

and change the script name to "Removeweapons[name here].sqf".

in the Init.sqf, you need to execVM all of those scripts. for example:

execVM "Removeweaponsp1.sqf";
execVM "Removeweaponsp2.sqf";
execVM "Removeweaponsp3.sqf";
execVM "Removeweaponsp4.sqf";

sorry its so clumsy and complicated, but could not make it work anyway easier.

P.S:

it is very wierd, I have a very similiar script that does work with variables:

_unit = _this select 0;

while {true} do
{
waitUntil {!alive _unit};
sleep 0.01;
waitUntil {alive _unit};
sleep 0.01;

[_unit] call _setLoadout;

sleep 0.1;
};

with the script being called with the following in the unit's init field:

nul = [this] execVM "Removeweapons.sqf";

but it doesnt work in this case, no metter what I did...

hope you understand how to use that...

Share this post


Link to post
Share on other sites
I gonna have to test it out, ill give you an answere in an hour or so

---------- Post added at 15:42 ---------- Previous post was at 14:06 ----------

OK.

got it to work.

I did not manage to make it with variables, so its a bit clumsy...

SO, the Removeweapons.sqf is changed to "Removeweaponsp1.sqf", and inside there is this:

while {true} do {
waitUntil {!alive p1};
waitUntil {alive p1};
sleep 0.001;
removeallweapons p1;
sleep 0.001;
};

with p1 being your unit name.

now you need to copy and paste it for every unit you want, and change the following things inside the script:

while {true} do {
waitUntil {!alive [name here]};
waitUntil {alive [name here]};
sleep 0.001;
removeallweapons [name here];
sleep 0.001;
};

and change the script name to "Removeweapons[name here].sqf".

in the Init.sqf, you need to execVM all of those scripts. for example:

execVM "Removeweaponsp1.sqf";
execVM "Removeweaponsp2.sqf";
execVM "Removeweaponsp3.sqf";
execVM "Removeweaponsp4.sqf";

sorry its so clumsy and complicated, but could not make it work anyway easier.

P.S:

it is very wierd, I have a very similiar script that does work with variables:

_unit = _this select 0;

while {true} do
{
waitUntil {!alive _unit};
sleep 0.01;
waitUntil {alive _unit};
sleep 0.01;

[_unit] call _setLoadout;

sleep 0.1;
};

with the script being called with the following in the unit's init field:

nul = [this] execVM "Removeweapons.sqf";

but it doesnt work in this case, no metter what I did...

hope you understand how to use that...

THank you so much !!!! I finished testing it!! it works like a charm!!!

I really appreciated for all the effort u put, just to figure, find, and make a script that works!!! THANK YOU SO MUCH!!!!!! it means a lot :)

its not that complicated and clumsy, as long it works! it's all good!!! :) I don't know how to make or write scripts but I can read and understand some scripting language :)

one more thing! This should work fine in dedicated server right?

Edited by frezinator

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  

×