Jump to content
Personal Best

Control structure script issue

Recommended Posts

I made a little script to check the player's uniform, following other topics I found and the script wiki. For some reason, it doesn't work properly.

 

_khokholUniform = ["LOP_U_UKR_Fatigue_Digit","LOP_U_UKR_Fatigue_TanMTP","LOP_U_UKR_Fatigue_DPMW_DPMD","LOP_U_UKR_Fatigue_IzlomTTsKO","LOP_U_UKR_Fatigue_TTsKO"]; 
 
if ((uniform GeorgeCluny) in _khokholUniform) then 
{ 
systemChat "Success"; 
}
else
{
systemChat "Failure";
};

it spits out both systemChat messages at once and also outputs an error saying

'|#|else'
Error Undefined variable in expression: else

whatever the player is wearing.

I'm not very experienced in scripting. Any help would be appreciated

Share this post


Link to post
Share on other sites

For me all looks good.

U should check ur code for invisible characters. Maybe there is such nearby the else.

Invisible chars are a common problem when copying code out of forums.

You can use a software which is able to show invisible chars like some office applications. Maybe notepad++ has an option for it as well.

  • Thanks 1

Share this post


Link to post
Share on other sites
6 minutes ago, sarogahtyp said:

For me all looks good.

U should check ur code for invisible characters. Maybe there is such nearby the else.

Invisible chars are a common problem when copying code out of forums.

You can use a software which is able to show invisible chars like some office applications. Maybe notepad++ has an option for it as well.

I actually already solved my problem. I restructured my code a little bit. Now it looks like this:

_khokholUniform = ["LOP_U_UKR_Fatigue_Digit","LOP_U_UKR_Fatigue_TanMTP","LOP_U_UKR_Fatigue_DPMW_DPMD","LOP_U_UKR_Fatigue_IzlomTTsKO","LOP_U_UKR_Fatigue_TTsKO"]; 
 
if ((uniform GeorgeCluny) in _khokholUniform) then [{systemChat "Success";}, {systemChat "Failure";}];

Works like a charm.

Thank you for the response.

  • Confused 1

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

×