Jump to content
Sign in to follow this  
bertram

Switch case that checks what weapon a player has

Recommended Posts

I'm trying to create a script that removes a player's weapon but with a switch case for different weapons.

 

if (!(weapons player isEqualTo [])) then {
switch (currentWeapon player) do {
{
case "arifle_Mk20_plain_F":
hint "F2000 Removed";
player removeWeapon (primaryWeapon player);
};
{
case "SMG_05_F":
hint "Mp5k removed";
player removeWeapon (primaryWeapon player);
};
} else {hint "No weapon equipped"}
};

The script checks if the player has a weapon and if they do goes by the classname of the weapon for each case. However, I'm doing something wrong here as the player's weapon never gets removed nor does the hint for no weapon go off. A previous attempt at making this fired the first case every time except for when the player had no weapon which fired the appropriate hint. From this I can say I'm pretty certain my if statement is fine and I'm just not doing the switch case correctly.

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  

×