Possible Opening/Closing windows bug:
#1

Hello,

I wanted to try out the new "ability" of opening/closing the windows of a car.

I started scripting and at first I made a command to check my car's windows' state.
Without doing anything, just created a vehicle the command says that the car's windows' status are like this:
PHP код:
Driver: -1Passenger: -1Back Left: -1Back Right: -
Which basically means they're closed.

However, I made a command to open the windows and it came out like this:
PHP код:
Driver0Passenger0Back Left0Back Right
And now they're open.

I then proceeded making a command (yeah, I know, I could've make all of this into one command) that'd close the windows and the windows' state came out:
PHP код:
Driver1Passenger1Back Left1Back Right
And now they're closed again.

I then made a command like that checks the vehicle windows' status and if they're open (0) it says "Open", Closed (1) says "Closed". I used the switch statement, e.g:

PHP код:
switch(driver){
    
        case 
0dst ""COL_GREEN"Open";
        case 
1dst ""COL_RED"Closed";
        default: 
dst "Missing";

So, my question is: Am I doing something wrong or it's possible a "bug". If I spawn a car and do like /checkwindows it says all the windows are missing (see the switch statement example) aka they're -1.

Shouldn't all cars have the state set to 1 which is closed?

As I said, I might be doing something wrong. Tried this all out myself since on the wiki there's no explanation yet.

Thanks for your time.
Reply
#2

-1 means 'unset'. This is the default state (rolled up).
Reply
#3

Would be nice having a parameter like we've the siren one now so we don't gotta set each of the vehicle's parameter to 1.
Found out what I needed, though. Thank you nevertheless, I'll +rep you.
Reply
#4

Essentially you can just do this:
pawn Код:
switch(driver){
     
        case 0: dst = ""COL_GREEN"Open";
        case -1, 1: dst = ""COL_RED"Closed";
        default: dst = "Missing";
}
Can't you?
Reply
#5

It should be

case 0: Open
case 1: Closed
Case -1: Closed (default)
Reply
#6

@Threshold: I did that in the first place but it didn't work out now it does (lol). Thank you as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)