ChemistZombie Posted December 2, 2016 Share Posted December 2, 2016 Not sure if anyone have ever asked this before as this question is kinda simple (the search returns no results) but I'll post it here. So I'm trying to edit the default SA main.scm to change behavior of certain stuff (particularly car mods and missions). However, I'm confused with this one (I'm such a noob to coding like this so yeah). Because I wanted to use the SWAT tank for firefighter missions (since it has a water cannon that can put off fire, and I want something weird like this), I put this into the SCM. :R3_1138if or Actor.DrivingVehicleType($PLAYER_ACTOR, #FIRETRUK) Actor.DrivingVehicleType($PLAYER_ACTOR, #SWATVAN)jf @R3_1603 if $ONMISSION_FIREFIGHTER == 0 jf @R3_1603 if $HELP_TOGGLE_ODDJOB_SHOWN == 0 jf @R3_1224 if 88FE: not text_box_displayed jf @R3_1224 03E5: show_text_box 'FTUTOR' // Press ~k~~TOGGLE_SUBMISSIONS~ to toggle fire truck missions on or off.$HELP_TOGGLE_ODDJOB_SHOWN = 1 :R3_1224if not $13 == 3 jf @R3_1426 if 00E1: player 0 pressed_key 19 jf @R3_1419 :R3_1259if 00E1: player 0 pressed_key 19 jf @R3_1388 wait 0 if $ONMISSION == 1 jf @R3_1305 jump @R3_11 :R3_1305if or not Player.Defined($PLAYER_CHAR) not Actor.DrivingVehicleType($PLAYER_ACTOR, #FIRETRUK)jf @R3_1336 jump @R3_11 :R3_1336if 09BE: are_text_boxes_locked_to_any_thread jf @R3_1356 jump @R3_11 :R3_1356if 08B4: test $390 bit 1 jf @R3_1381 jump @R3_11 :R3_1381jump @R3_1259 :R3_138800BA: show_text_styled GXT 'FIRE_M' time 6000 style 5 // ~y~FIREFIGHTERwait 0 start_mission 123 // Firefighter Sub-Missionjump @R3_11 :R3_1419jump @R3_1603 :R3_1426if 00E1: player 0 pressed_key 14 jf @R3_1603 :R3_1443if 00E1: player 0 pressed_key 14 jf @R3_1572 wait 0 if $ONMISSION == 1 jf @R3_1489 jump @R3_11 :R3_1489if or not Player.Defined($PLAYER_CHAR) not Actor.DrivingVehicleType($PLAYER_ACTOR, #FIRETRUK) not Actor.DrivingVehicleType($PLAYER_ACTOR, #SWATVAN)jf @R3_1520 jump @R3_11 :R3_1520if 09BE: are_text_boxes_locked_to_any_thread jf @R3_1540 jump @R3_11 :R3_1540if 08B4: test $390 bit 1 jf @R3_1565 jump @R3_11 :R3_1565jump @R3_1443 :R3_157200BA: show_text_styled GXT 'FIRE_M' time 6000 style 5 // ~y~FIREFIGHTERwait 0 start_mission 123 // Firefighter Sub-Missionjump @R3_11 Basically I just added the SWAT tank as a valid vehicle. However, since the SWAT tank is also a police vehicle, it basically conflicts with the vigilante mission. I want it to be excluded from the valid vigilante vehicles list by adding something like this pseudocode "if it's a police vehicle, Hunter, or Hydra, but NOT SWAT tank, then jump to X" I could've actually put this kinda script :R3_1603if and Actor.DrivingPoliceVehicle($PLAYER_ACTOR) not Actor.DrivingVehicleType($PLAYER_ACTOR, #SWATVAN)jf @R3_2269 But the fact that I also wanted Hunter and Hydra (yes, I wanna use Hydra for vigilante) makes this thing harder. I can't just put this kinda thing on it :R3_1603if and Actor.DrivingPoliceVehicle($PLAYER_ACTOR) not Actor.DrivingVehicleType($PLAYER_ACTOR, #SWATVAN) Actor.DrivingVehicleType($PLAYER_ACTOR, #HYDRA) Actor.DrivingVehicleType($PLAYER_ACTOR, #HUNTER)jf @R3_2269 because it's like telling the game to make vigilante available if it's a police vehicle but it must be Hydra AND Hunter (which makes the code somewhat ridiculous). Also, there's no such thing as putting "and" inside the "if or" code, because it's just gonna make the code invalid. There must be some way to make something like that but it's probably a bit more complex. Can someone figure out how to do it? Link to comment https://gtaforums.com/topic/874464-using-if-or-with-and-in-sanny-builder/ Share on other sites More sharing options...
spaceeinstein Posted December 2, 2016 Share Posted December 2, 2016 (edited) You don't have to squeeze all your conditions under one if statement. You can split them apart: if or player in police vehicle player in hydra player in hunterthen if not player in swatvan then your code when in selected vehicles endendOr if you want to use an alternative syntax: if or player in police vehicle player in hydra player in hunterjf @continue_scriptif not player in swatvanjf @continue_scriptyour code when in selected vehicles:continue_script Edited December 2, 2016 by spaceeinstein Link to comment https://gtaforums.com/topic/874464-using-if-or-with-and-in-sanny-builder/#findComment-1069241604 Share on other sites More sharing options...
ChemistZombie Posted December 2, 2016 Author Share Posted December 2, 2016 OK then, will try that one. Link to comment https://gtaforums.com/topic/874464-using-if-or-with-and-in-sanny-builder/#findComment-1069243244 Share on other sites More sharing options...
Wesser Posted December 3, 2016 Share Posted December 3, 2016 (edited) What about excluding models before checking for inclusive ones? if80DD: not is_char_in_model $PLAYER_ACTOR model #SWATVANthen if or 056C: is_char_in_any_police_vehicle $PLAYER_ACTOR 00DD: is_char_in_model $PLAYER_ACTOR model #HUNTER 00DD: is_char_in_model $PLAYER_ACTOR model #HYDRA then [...] endendLaw enforcement vehicles: enforcer (427), predator (430), rhino (432), barracks (433), fbiranch (490), copbike (523), fbitruck (528), copcarla (596), copcarsf (597), copcarvg (598), copcarru (599), swatvan (601). Edited December 3, 2016 by Wesser dkluin and sswag 2 Link to comment https://gtaforums.com/topic/874464-using-if-or-with-and-in-sanny-builder/#findComment-1069244832 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now