Hi, I'm trying to recreate the 'Murder' game in Gmod. One aspect of the game is that if the detective (the scoreboard is Detective=x) dies, he drops his gun (bow) and another bystander can pick it up. I want to recreate this but there is a problem: the murderer (scoreboard is Murderer=x) cannot pick up the gun and this is my problem. TLDR: How can I make a person with 0 score in 'Murderer' pick up a bow while someone with 1 score in 'Murderer' not able to pick up a bow
Hi, I'm trying to recreate the 'Murder' game in Gmod. One aspect of the game is that if the detective (the scoreboard is Detective=x) dies, he drops his gun (bow) and another bystander can pick it up. I want to recreate this but there is a problem: the murderer (scoreboard is Murderer=x) cannot pick up the gun and this is my problem. TLDR: How can I make a person with 0 score in 'Murderer' pick up a bow while someone with 1 score in 'Murderer' not able to pick up a bow
Thanks!
You can prevent an item from being picked up by setting its PickupDelay to a hight value:
the Age is so that the item does not despawn. PickupDelay is measured in ticks (20 ticks = 1 second). To allow a player to pick it up, you could reset the pickup delay when a player with the right score is within range.
/execute as @a[scores={Murderer=0}] at @s run data merge entity @e[tag=bow,limit=1,sort=nearest,distance=..2] {PickupDelay:0}
and then you could tag the player with a special tag so he can't pick up multiple bows:
/execute as @a[scores={Murderer=0},<strong>tag=!hasBow</strong>] at @s run data merge entity @e[tag=bow,limit=1,sort=nearest,distance=..2] {PickupDelay:0}
one more thing to note is, both the player with the score set to 0 and the player with the score set to 1 can be within the range of the bow so you might want to use a /give command instead when the right player is within range and remove the bow on the ground.
Hi, I'm trying to recreate the 'Murder' game in Gmod. One aspect of the game is that if the detective (the scoreboard is Detective=x) dies, he drops his gun (bow) and another bystander can pick it up. I want to recreate this but there is a problem: the murderer (scoreboard is Murderer=x) cannot pick up the gun and this is my problem. TLDR: How can I make a person with 0 score in 'Murderer' pick up a bow while someone with 1 score in 'Murderer' not able to pick up a bow
Thanks!
You can prevent an item from being picked up by setting its PickupDelay to a hight value:
the Age is so that the item does not despawn. PickupDelay is measured in ticks (20 ticks = 1 second). To allow a player to pick it up, you could reset the pickup delay when a player with the right score is within range.
and then you could tag the player with a special tag so he can't pick up multiple bows:
one more thing to note is, both the player with the score set to 0 and the player with the score set to 1 can be within the range of the bow so you might want to use a /give command instead when the right player is within range and remove the bow on the ground.
Command block engineer // Developer // #TeamTrees