Lil problem with if
#1

Alright so the problem is simple

1. It allows you to unlock vehicles that have faction ID: 0
2. Doesnt allow you to unlock vehicles that are above Faction 0 eventho if your faction ID is the same

PHP код:
if(VehInfo[somecar][VehFaction] != && VehInfo[somecar][VehFaction] == AccInfo[playerid][PlayerFaction] ||
            
VehInfo[somecar][VehFaction] == 0
IE: what should it work as? You can unlock your own cars & cars that have Faction ID:0 (works), and if you are part of faction ID:1 for example, you will be able to unlock faction cars that have same faction ID as yours (Faction ID's start from 1)
Reply
#2

It'll have something to do with the mixing of && and || on an if statement.

Maybe try breaking them up a bit.

if((VehInfo[somecar][VehFaction] != 0 && VehInfo[somecar][VehFaction] == AccInfo[playerid][PlayerFaction])|| VehInfo[somecar][VehFaction] == 0)


Not saying it'll work in the slightest, but it's always trouble with && and ||. You have to get that crap all perfect.

Another test maybe, is to make, before the if statement, a debug printf to the log, showing what the values actually are, when you are using this.

Use format, to make a string, and print the whole line out using printf.



Could also be beneficial to do individual if statements, if this won't work.
Reply
#3

Ive got an idea,ill see, one sec


EDIT: Fixed ty vm!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)