RnBoy15 Posted January 17, 2012 Share Posted January 17, 2012 So, i wanted to create a simple script, if I sit in a sports car and press key, then i can take it to a place where is a red circle, and if I am in the circle and in the car stopped, then the export is done, gives me some money and thats all. The script for me seems okay, but if i sit in a sport car and press the key, I instantly get the cash, export finished... its like the conditions of the script is allways true, but i cant find the problem, pls HELP... // This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------$DRIVEBYMODE = 0 $PLAYER_ACTOR = Actor.EmulateFromPlayer($PLAYER_CHAR):NONAME_15wait 0 if Player.Defined($PLAYER_CHAR)else_jump @NONAME_15 if or Actor.DrivingVehicleType($PLAYER_ACTOR, #CHEETAH) Actor.DrivingVehicleType($PLAYER_ACTOR, #BANSHEE) Actor.DrivingVehicleType($PLAYER_ACTOR, #ELEGY) Actor.DrivingVehicleType($PLAYER_ACTOR, #INFERNUS) Actor.DrivingVehicleType($PLAYER_ACTOR, #TURISMO) Actor.DrivingVehicleType($PLAYER_ACTOR, #SULTAN) Actor.DrivingVehicleType($PLAYER_ACTOR, #BULLET)else_jump @NONAME_15 jump @NONAME_109 :NONAME_109wait 0 if 0AB0: key_pressed 53 else_jump @NONAME_15 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_4' 03C0: [email protected] = actor $PLAYER_ACTOR car [email protected] = Marker.CreateIconAndSphere(0, -2315.53, 1544.93, 18.7734)jump @NONAME_196 :NONAME_196wait 0 if 0100: actor $PLAYER_ACTOR in_sphere -2315.53 1544.93 18.7734 radius 4.0 4.0 4.0 sphere 0 in_car jump @NONAME_308 else_jump @NONAME_196 if 0AB0: key_pressed 53 else_jump @NONAME_196 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_6' jump @NONAME_15 :NONAME_308wait 0 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_7' Car.RemoveReferences([email protected])Player.Money($PLAYER_CHAR) += 100000jump @NONAME_15 Link to comment Share on other sites More sharing options...
Deji Posted January 17, 2012 Share Posted January 17, 2012 {$CLEO .cs}const stage = [email protected] player_car = [email protected] blip1 = [email protected] blip1_created = [email protected]:while true wait 0 if 0256: player $PLAYER_CHAR defined then if or 00DD: actor $PLAYER_ACTOR driving_car_with_model #CHEETAH 00DD: actor $PLAYER_ACTOR driving_car_with_model #BANSHEE 00DD: actor $PLAYER_ACTOR driving_car_with_model #ELEGY 00DD: actor $PLAYER_ACTOR driving_car_with_model #INFERNUS 00DD: actor $PLAYER_ACTOR driving_car_with_model #TURISMO 00DD: actor $PLAYER_ACTOR driving_car_with_model #SULTAN 00DD: actor $PLAYER_ACTOR driving_car_with_model #BULLET then if stage == 0 then if 0AB0: key_pressed 53 then 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_4' // btw, this makes a sound too, so you might not hear the above sound... 03C0: player_car = actor $PLAYER_ACTOR car gosub @CleanBlips 02A7: blip1 = create_icon_marker_and_sphere 0 at -2315.53 1544.93 18.7734 stage = 1 blip1_created = 1 end end if stage == 1 then if 0100: actor $PLAYER_ACTOR in_sphere -2315.53 1544.93 18.7734 radius 4.0 4.0 4.0 sphere 0 in_car then 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_7' 0109: player $PLAYER_CHAR money += 100000 gosub @CleanBlips stage = 2 // set this to 0 if you wanna allow more exports end end else gosub @CleanBlips stage = 0 end else gosub @CleanBlips stage = 0 endend:CleanBlipsif blip1_created == 1then 0164: disable_marker blip1 blip1_created = 0endreturn Now would be a great time to learn to code in a higher level! Link to comment Share on other sites More sharing options...
RnBoy15 Posted January 17, 2012 Author Share Posted January 17, 2012 (edited) Thank you man! from where can i learn this high level scripting? You mind if I ask you some questions? 1. what does stage == 0 and stage ==1 means? 2. if somewhere in the script appears gosub @Allay , the :Allay procedure will be done, but if on the end of :Allay there is a return , than it means it will continue the unfinished procedure where the gosub @Allay was? Edited January 17, 2012 by RnBoy15 Link to comment Share on other sites More sharing options...
RnBoy15 Posted January 17, 2012 Author Share Posted January 17, 2012 {$CLEO .cs}const stage = [email protected] player_car = [email protected] blip1 = [email protected] blip1_created = [email protected]:while true wait 0 if 0256: player $PLAYER_CHAR defined then if or 00DD: actor $PLAYER_ACTOR driving_car_with_model #CHEETAH 00DD: actor $PLAYER_ACTOR driving_car_with_model #BANSHEE 00DD: actor $PLAYER_ACTOR driving_car_with_model #ELEGY 00DD: actor $PLAYER_ACTOR driving_car_with_model #INFERNUS 00DD: actor $PLAYER_ACTOR driving_car_with_model #TURISMO 00DD: actor $PLAYER_ACTOR driving_car_with_model #SULTAN 00DD: actor $PLAYER_ACTOR driving_car_with_model #BULLET then if stage == 0 then if 0AB0: key_pressed 53 then 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_4' // btw, this makes a sound too, so you might not hear the above sound... 03C0: player_car = actor $PLAYER_ACTOR car gosub @CleanBlips 02A7: blip1 = create_icon_marker_and_sphere 0 at -2315.53 1544.93 18.7734 stage = 1 blip1_created = 1 end end if stage == 1 then if 0100: actor $PLAYER_ACTOR in_sphere -2315.53 1544.93 18.7734 radius 4.0 4.0 4.0 sphere 0 in_car then 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_7' 0109: player $PLAYER_CHAR money += 100000 gosub @CleanBlips stage = 2 // set this to 0 if you wanna allow more exports end end else gosub @CleanBlips stage = 0 end else gosub @CleanBlips stage = 0 endend:CleanBlipsif blip1_created == 1then 0164: disable_marker blip1 blip1_created = 0endreturn Now would be a great time to learn to code in a higher level! it works, but how can i make it that so if i exit the car, i can still bring the car to the point? because if i exit, the export ends too Link to comment Share on other sites More sharing options...
Silent Posted January 17, 2012 Share Posted January 17, 2012 Thank you man! from where can i learn this high level scripting? You mind if I ask you some questions? 1. what does stage == 0 and stage ==1 means? 2. if somewhere in the script appears gosub @Allay , the :Allay procedure will be done, but if on the end of :Allay there is a return , than it means it will continue the unfinished procedure where the gosub @Allay was? 1. It compares the value from "stage" with 0 and 1 (in these cases). 2. Yep. Link to comment Share on other sites More sharing options...
Deji Posted January 18, 2012 Share Posted January 18, 2012 Read code like a book with missing words. if // if the player is playing (not wasted or busted)... 0256: player $PLAYER_CHAR defined then if or // ... and is driving one of these models of car... 00DD: actor $PLAYER_ACTOR driving_car_with_model #CHEETAH 00DD: actor $PLAYER_ACTOR driving_car_with_model #BANSHEE 00DD: actor $PLAYER_ACTOR driving_car_with_model #ELEGY 00DD: actor $PLAYER_ACTOR driving_car_with_model #INFERNUS 00DD: actor $PLAYER_ACTOR driving_car_with_model #TURISMO 00DD: actor $PLAYER_ACTOR driving_car_with_model #SULTAN 00DD: actor $PLAYER_ACTOR driving_car_with_model #BULLET then[...] if stage == 1 then // then check if the player is in the sphere for export if 0100: actor $PLAYER_ACTOR in_sphere -2315.53 1544.93 18.7734 radius 4.0 4.0 4.0 sphere 0 in_car then 018C: play_sound 1058 at 0.0 0.0 0.0 03E5: show_text_box 'DRV_7' 0109: player $PLAYER_CHAR money += 100000 gosub @CleanBlips stage = 2 // set this to 0 if you wanna allow more exports end end So you just need to move the code which checks if the player is in the area for exports outside of the code that checks if the player is in a vehicle. Link to comment 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