Jump to content
Sign in to follow this  
frosties

Using && and == to give a function

Recommended Posts

Hello,

Im trying to make it so that when a player has a certain rank, and have a certain backpack they get the mando console.

my code looks like:

[["Support Console", {(rank player == "Lieutenant") && typeOf (unitBackpack player) == "US_UAV_Pack_EP1"}] execVM "mando_missiles\mando_bombs\mando_giveme_console.sqf";

I have it working with either only rank or only backpack, but would like it so that the user must have BOTH the rank and the backpack....

EDIT.

Never mind, i added this code and SAVED the file before trying and it worked...

EDIT2:

How can i change (rank player == "Lieutenant") so that it ask "If player rank is greater then sergeant"

Edited by Frosties

Share this post


Link to post
Share on other sites

yes i have that page bookmarked, but its not easy to find a function always :)

Trying to write it so it would work but no joy.

my latest attempt:

["Support Console", {(rankId player >= "2") && typeOf (unitBackpack player) == "US_UAV_Pack_EP1"}] execVM "mando_missiles\mando_bombs\mando_giveme_console.sqf";

Share this post


Link to post
Share on other sites

(rankId player >= "2")

Why the ""? The returned value is a number, not a string:

(rankId player >= 2)

This should do the trick.

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  

×