Jump to content

HERE IS MY CODE


dantinkakkar

Recommended Posts

dantinkakkar

There are no compile problems. The code is being compiled properly. But when I test it with the game - Carl sits as a passenger all right, but the car does not even BUDGE. Please HELP ASAP.

 

P.S. I know the comments are overflowing into new lines. Ignore them. In SannyBuilder they are not.

 

 

{$VERSION 3.04}{$CLEO .cs}//-------------MAIN---------------thread 'DansMod' //Name file as Dansmod.cs:DansMod_02 //To search for a suitable car, and board it. Also to save the player's weapon.wait 08@ = false //DRIVE-BY MODE SWITCH9@ = false //CAR MOVING/STOPPED SWITCH10@ = 30.0 //MAX. SPEEDif   Player.Defined($PLAYER_CHAR) //Player has to exist.else_jump @DansMod_02 //If player does not exist, code restarts.wait 0if   not Actor.Driving($PLAYER_ACTOR) //Player has to be on foot.else_jump @DansMod_02 //If player is not on foot, code restarts.wait 0if and //If player presses TAB + C, then car is boarded.00E1:   player 0 pressed_key 4 //4 is the ACTION/SECONDARY FIRE key [default - TAB]00E1:   player 0 pressed_key 18 //19 is the key for CROUCH [default - C]// Player has to press ACTION/SECONDARY FIRE + CROUCH [default - TAB + C]else_jump @DansMod_02 //This will be repeated until the player presses TAB + C  wait 00@ = -1 //0@ set to any value, as we can take any carActor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@) //Get the player's coordinates073E: get_car_in_sphere 1@ 2@ 3@ radius 10.0 model -1 handle_as 0@ //Search for a car in 10.0 radius of the playerif   not 0@ == -1 //The car should be decided, or else the loop restarts.else_jump @DansMod_02 //If a car is not found, the script searches again.wait 00470: 4@ = actor $PLAYER_ACTOR current_weapon //Save player's current weapon05CA: AS_actor $PLAYER_ACTOR enter_car 0@ passenger_seat -1 10000 ms //Let player sit in any passenger seat in 10 seconds. :DansMod_04             //Give the player a weapon to use.if and                   //Check if player is using melee or non-drive-by-compatible weapons   not 4@ == #CHNSAW   not 4@ == #KNIFECUR   not 4@ == #GOLFCLUB   not 4@ == #FLOWERA   not 4@ == #GUN_DILDO1   not 4@ == #GUN_CANE   not 4@ == #GUN_DILDO2   not 4@ == #GUN_VIBE1   not 4@ == #GUN_VIBE2   not 4@ == 0   not 4@ == #BRASSKNUCKLE   not 4@ == #NITESTICK   not 4@ == #BAT   not 4@ == #SHOVEL   not 4@ == #POOLCUE   not 4@ == #KATANA   not 4@ == #GRENADE   not 4@ == #MOLOTOV   not 4@ == #TEARGAS   not 4@ == #SATCHEL   not 4@ == #BOMB   not 4@ == #SPRAYCAN   not 4@ == #NVGOGGLES   not 4@ == #IRGOGGLES   not 4@ == #GUN_PARAelse_jump @DansMod_08 //If player is found to be in posession of an incompatible weapon for a drive-by, he will automatically be handed a #TEC9   wait 0 01B9: set_actor $PLAYER_ACTOR armed_weapon_to 4@ //Give a #TEC9 or the player chosen Drive-By Compatible weapon. wait 1if   not Actor.InCar($PLAYER_ACTOR, 0@) //Check whether player is in the carelse_jump @DansMod_5 //If player is in the car, go to @DansMod_5wait 0Car.RemoveReferences(0@) //Forget the car.jump @DansMod_02 //Restart the loop.:DansMod_5 //Sets journey settings and starts journey towards target.0AB6: store_target_marker_coords_to 5@ 6@ 7@ //Get map target coordinates and store them.Car.DriveTo(0@, 5@, 6@, 7@) //Drive to target [something has gone HORRIBLY WRONG over here, i can tell...    Car.SetToNormalDriver(0@) //The drive should be at normal mentality.Car.SetMaxSpeed(0@, 10@) //The car's maximum speed is set: default 30.0 km/h.Car.ImmuneToNonPlayer(0@, true) //Making the car bulletproof, dent-proof, etc, or damageable in any way by anyone else.:DansMod_6 //Drive-By Activation & De-Activation, Journey Pause & Resume, and Speed Increase & Decrease chain starts. This is for activation of drive-bys.if   Actor.InCar($PLAYER_ACTOR, 0@) //The player should be in the car.else_jump @DansMod_16 //The loop restarts if the player is not in the car.wait 0if and   8@ == false //DRIVE-BY SWITCH should be set to "OFF"   00E1:   player 0 pressed_key 16 //16 is the key for SPRINT [default - SPACE (BAR) ]   00E1:   player 0 pressed_key 17 //17 is the key for FIRING [default - RCTRL, LALT] else_jump @DansMod_9 //Checks for drive-by deactivation process, as drive-by is no the intention due to absence of keypresses required.wait 00501: set_player $PLAYER_CHAR driveby_mode 1 //DRIVE-BY activated8@ = true //DRIVE-BY SWITCH set to "ON" jump @DansMod_9 //Go to next stage of switch circle.:DansMod_070633: AS_actor $PLAYER_ACTOR exit_car //Leaves the car and restarts the loop. jump @DansMod_16:DansMod_08 //Assigns the player a #TEC9 if he does not have a drive-by compatible weapon.4@ = #TEC9 //Give the player a #TEC9 for the drive-by.jump @DansMod_04 //Back to weapon assignment label.:DansMod_9if   Actor.InCar($PLAYER_ACTOR, 0@) ///Is the player in the car??else_jump @DansMod_16 //If not, restart loop.wait 0if and   8@ == true //DRIVE-BY SWITCH should be set to "ON"   00E1:   player 0 pressed_key 18 //18 is the key for CROUCH [default - C]   00E1:   player 0 pressed_key 17 //17 is the key for FIRING [default - RCTRL, LALT] else_jump @DansMod_10 //Checks for drive-by deactivation0501: set_player $PLAYER_CHAR driveby_mode 0 //SWITCH OFF DRIVE-BY8@ = false //Set DRIVE-BY SWITCH to "OFF"jump @DansMod_10 :DansMod_10if   Actor.InCar($PLAYER_ACTOR, 0@) //Is the player in the car??else_jump @DansMod_16 //If not, restart loop.wait 0if    00E1:   player 0 pressed_key 14 //JUMP KEY [default - LSHIFT]else_jump @DansMod_11 //Proceed to next link in chainwait 0if   not 9@ == false //if car is NOT STOPPEDelse_jump @DansMod_11 //Skip and go to resume journey if car is stopped.wait 0Car.LockInCurrentPosition(0@, true) //STOP CAR9@ = true //Car is stopped.jump @DansMod_11 //Go to RESUME-JOURNEY:DansMod_12 //If car is moving and not paused, code jumps here, and skips "RESUME-JOURNEY"jump @DansMod_13:DansMod_13if   Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if and //Check for TAB + Y   00E1:   player 0 pressed_key 4 //TAB KEY   00E1:   player 0 pressed_key 11 //Y KEYelse_jump @DansMod_14 //if not pressed, resumewait 010@ += 5.0 //increase speed by 5 km/hCar.SetMaxSpeed(0@, 10@)jump @DansMod_14 :DansMod_14if   Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if and //Check for TAB + N   00E1:   player 0 pressed_key 4 //TAB KEY   00E1:   player 0 pressed_key 10 //N KEYelse_jump @DansMod_6wait 010@ -= 5.0Car.SetMaxSpeed(0@, 10@)jump @DansMod_6:DansMod_11 if   Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if   9@ == true //Car is moving, thenelse_jump @DansMod_12 //if car is moving, resume in chainwait 0if //if player presses LSHIFT, then go ahead, else skip to next   00E1:   player 0 pressed_key 14else_jump @DansMod_12wait 0Car.SetToNormalDriver(0@)Car.SetMaxSpeed(0@, 10@)Car.ImmuneToNonPlayer(0@, true)Car.DriveTo(0@, 5@, 6@, 7@) //Resume journey9@ == falsejump @DansMod_12 :DansMod_16Car.RemoveReferences(0@)jump @DansMod_02 

 

Edited by dantinkakkar
Link to comment
Share on other sites

 

I know the comments are overflowing into new lines.

A lot of comments are very useful for us to can help icon14.gif

 

 

This conditional check is invalid:

 

if and //Check if player is using melee or non-drive-by-compatible weapons

not 4@ == #CHNSAW

not 4@ == #KNIFECUR

not 4@ == #GOLFCLUB

not 4@ == #FLOWERA

not 4@ == #GUN_DILDO1

not 4@ == #GUN_CANE

not 4@ == #GUN_DILDO2

not 4@ == #GUN_VIBE1

not 4@ == #GUN_VIBE2

not 4@ == 0

not 4@ == #BRASSKNUCKLE

not 4@ == #NITESTICK

not 4@ == #BAT

not 4@ == #SHOVEL

not 4@ == #POOLCUE

not 4@ == #KATANA

not 4@ == #GRENADE

not 4@ == #MOLOTOV

not 4@ == #TEARGAS

not 4@ == #SATCHEL

not 4@ == #BOMB

not 4@ == #SPRAYCAN

not 4@ == #NVGOGGLES

not 4@ == #IRGOGGLES

not 4@ == #GUN_PARA

else_jump @DansMod_08

 

1. The max amount of conditions in a conditional check is 7

In sanny docu is written that the max amount is 9 but this don't work correct ingame

If you don't believe it, read >here<

 

2. opcode 0470: returns an integer value and not a model name

read about weapon numbers in Sanny Builder Help: SCM Documentation: GTA SA: Weapon numbers

and try this tiny script to display what this opcode returns

 

{$CLEO .cs}:weaponnumber_check03A4: name_thread 'WEAPCK':WEAPCK_1wait 000D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @WEAPCK_10470: 4@ = actor $PLAYER_ACTOR current_weapon03F0: enable_text_draw 1045A: text_draw_1number  250.0  280.0 'NUMBER' 4@    // valuejump @WEAPCK_1

 

 

so your weaponcheck should look like this:

 

 

:DansMod_04if and  not 4@ == 9  not 4@ == 4  not 4@ == 2  not 4@ == 14  not 4@ == 10  not 4@ == 15  not 4@ == 11else_jump @DansMod_08:DansMod_05if and  not 4@ == 12  not 4@ == 13  not 4@ == 0  not 4@ == 1  not 4@ == 3  not 4@ == 5  not 4@ == 6else_jump @DansMod_08:DansMod_06if and  not 4@ == 7  not 4@ == 8  not 4@ == 16  not 4@ == 18  not 4@ == 17  not 4@ == 39  not 4@ == 40else_jump @DansMod_08:DansMod_07if and  not 4@ == 41  not 4@ == 44  not 4@ == 45  not 4@ == 46else_jump @DansMod_08

 

 

But it don't makes sense for your script

 

My tip:

Don't spend so much effort for a weapon check, because the user don't understand the problem.

The user just wanna do a driveby.

So just give him the neccesary weapon

 

 

:drivby_1wait 0 if   Model.Available(#TEC9)jf @drivby_1 01B2: give_actor $PLAYER_ACTOR weapon 32 ammo 99999 // Load the weapon model before using this wait 250 05CA: AS_actor $PLAYER_ACTOR enter_car 0@ passenger_seat 0 10000 ms

 

 

then check if the player is in the car to make him able for the driveby mode

 

 

if   Actor.InCar($PLAYER_ACTOR, 0@)jf @drivby_2 0713: actor $PLAYER_ACTOR driveby_actor -1 car -1 point 0.0 0.0 0.0 radius 300.0 8 0 firing_rate 100

 

 

 

 

 

 

Link to comment
Share on other sites

dantinkakkar

Thanks for helping out. I am having a problem here with opcode 0AB6. It doesn't work. I tried it out with an existing mod too, by changing 2 lines, instead of:

 

Car.DriveTo(0@, 1@, 2@, 3@) //1@, 2@, and 3@ are the coordinates of a place in Ganton.

 

 

I wrote something like this:

 

 

0AB6: store_target_marker_coords_to 5@ 6@ 7@ //Get map target coordinates and store them.Car.DriveTo(0@, 5@, 6@, 7@) //Drive to target [something has gone HORRIBLY WRONG over here, i can tell...

 

 

And thanks for the drive-by solution. Your solution is good, but how about if I choose seven of the most common melee/non-drive-by-compatible weapons, and check for them?

 

Anyways, thanks a lot. icon14.gificon14.gifrahkstar2.gif

Link to comment
Share on other sites

 

Thanks for helping out. I am having a problem here with opcode 0AB6. It doesn't work. I tried it out with an existing mod too, by changing 2 lines, instead of:

 

Car.DriveTo(0@, 1@, 2@, 3@) //1@, 2@, and 3@ are the coordinates of a place in Ganton.

 

 

I wrote something like this:

 

 

0AB6: store_target_marker_coords_to 5@ 6@ 7@ //Get map target coordinates and store them.Car.DriveTo(0@, 5@, 6@, 7@) //Drive to target [something has gone HORRIBLY WRONG over here, i can tell...

 

It needs first to set the marker on the map for each gameload

opcode 0AB6 works also as condition

so you can give a message to request the user to set the marker

 

if0AB6: store_target_marker_coords_to 0@ 1@ 2@ // IF and SET004D: jump_if_false @message00A7: car 0@ drive_to  0@ 1@ 2@jump @script:message00BA: show_text_styled GXT 'fem_off' time 1000 style 4  // set first the marker on the map

 

 

 

but how about if I choose seven of the most common melee/non-drive-by-compatible weapons, and check for them?

you can do a lot and check a lot, but i'm wondering why you wanna check if player doesn't have a non-drive-by-compatible weapon

it's much more easier to check if the player has compatible weapon because they are just a few

 

you can check for the player current weapon

 

if02D8:   actor $PLAYER_ACTOR current_weapon == 32

 

as well if player has the weapon in inventory and if yes, then set the current weapon

 

if0491:   actor $PLAYER_ACTOR has_weapon 32else_jump @next01B9: set_actor $PLAYER_ACTOR armed_weapon_to 32

 

 

you can check if player has the weapon in inventory but doesn't have it as current weapon

 

if0491:   actor $PLAYER_ACTOR has_weapon 32else_jump @nextif82D8: not  actor $PLAYER_ACTOR current_weapon == 32else_jump @next01B9: set_actor $PLAYER_ACTOR armed_weapon_to 32

 

 

you can check if player has one of the compatible weapons as current_weapon

 

if  or02D8:   actor $PLAYER_ACTOR current_weapon == 2202D8:   actor $PLAYER_ACTOR current_weapon == 2302D8:   actor $PLAYER_ACTOR current_weapon == 32else_jump @nextstart driveby

 

 

as well if he has one of the compatible weapons in inventory

 

if0491:   actor $PLAYER_ACTOR has_weapon 22else_jump @next101B9: set_actor $PLAYER_ACTOR armed_weapon_to 22:next1if0491:   actor $PLAYER_ACTOR has_weapon 23else_jump @next201B9: set_actor $PLAYER_ACTOR armed_weapon_to 23:next2if0491:   actor $PLAYER_ACTOR has_weapon 32else_jump @next301B9: set_actor $PLAYER_ACTOR armed_weapon_to 32

 

Link to comment
Share on other sites

dantinkakkar

 

It needs first to set the marker on the map for each gameload

opcode 0AB6 works also as condition

so you can give a message to request the user to set the marker

 

I had set the marker on the map beforehand. Still the car remained stationary!!

Link to comment
Share on other sites

 

It needs first to set the marker on the map for each gameload

opcode 0AB6 works also as condition

so you can give a message to request the user to set the marker

 

I had set the marker on the map beforehand. Still the car remained stationary!!

Have you corrected your script? the weapon check?

then post the updated script please

Edited by ZAZ
Link to comment
Share on other sites

dantinkakkar
{$VERSION 4.11}{$CLEO .cs}//-------------MAIN---------------thread 'DansMod' //Name file as Dansmod.cs:DansMod_02 //To search for a suitable car, and board it. Also to save the player's weapon.wait 08@ = false //DRIVE-BY MODE SWITCH9@ = false //CAR MOVING/STOPPED SWITCH10@ = 30.0 //MAX. SPEEDif  Player.Defined($PLAYER_CHAR) //Player has to exist.else_jump @DansMod_02 //If player does not exist, code restarts.wait 0if  not Actor.Driving($PLAYER_ACTOR) //Player has to be on foot.else_jump @DansMod_02 //If player is not on foot, code restarts.wait 0if and //If player presses TAB + C, then car is boarded.00E1:   player 0 pressed_key 4 //4 is the ACTION/SECONDARY FIRE key [default - TAB]00E1:   player 0 pressed_key 18 //19 is the key for CROUCH [default - C]// Player has to press ACTION/SECONDARY FIRE + CROUCH [default - TAB + C]else_jump @DansMod_02 //This will be repeated until the player presses TAB + C  wait 00@ = -1 //0@ set to any value, as we can take any carActor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@) //Get the player's coordinates073E: get_car_in_sphere 1@ 2@ 3@ radius 10.0 model -1 handle_as 0@ //Search for a car in 10.0 radius of the playerif  not 0@ == -1 //The car should be decided, or else the loop restarts.else_jump @DansMod_02 //If a car is not found, the script searches again.wait 00470: 4@ = actor $PLAYER_ACTOR current_weapon //Save player's current weapon05CA: AS_actor $PLAYER_ACTOR enter_car 0@ passenger_seat -1 10000 ms //Let player sit in any passenger seat in 10 seconds.:DansMod_04             //Give the player a weapon to use.if or                   //Check if player is using melee or non-drive-by-compatible weapons  4@ == #TEC9  4@ == #AK47  4@ == #M4  4@ == #MICRO_UZI  4@ == #MP5LNGelse_jump @DansMod_08 //If player is found to be in posession of an incompatible weapon for a drive-by, he will automatically be handed a #TEC9  wait 001B9: set_actor $PLAYER_ACTOR armed_weapon_to 4@ //Give a #TEC9 or the player chosen Drive-By Compatible weapon.wait 1if  not Actor.InCar($PLAYER_ACTOR, 0@) //Check whether player is in the carelse_jump @DansMod_5 //If player is in the car, go to @DansMod_5wait 0Car.RemoveReferences(0@) //Forget the car.jump @DansMod_02 //Restart the loop.:DansMod_5 //Sets journey settings and starts journey towards target.0AB6: store_target_marker_coords_to 5@ 6@ 7@ //Get map target coordinates and store them.Car.SetToNormalDriver(0@) //The drive should be at normal mentality.Car.ImmuneToNonPlayer(0@, true) //Making the car bulletproof, dent-proof, etc, or damageable in any way by anyone else.Car.SetMaxSpeed(0@, 10@) //The car's maximum speed is set: default 30.0 km/h.Car.DriveTo(0@, 5@, 6@, 7@) //Drive to target [something has gone HORRIBLY WRONG over here, i can tell...    :DansMod_6 //Drive-By Activation & De-Activation, Journey Pause & Resume, and Speed Increase & Decrease chain starts. This is for activation of drive-bys.if  Actor.InCar($PLAYER_ACTOR, 0@) //The player should be in the car.else_jump @DansMod_16 //The loop restarts if the player is not in the car.wait 0if and  8@ == false //DRIVE-BY SWITCH should be set to "OFF"  00E1:   player 0 pressed_key 16 //16 is the key for SPRINT [default - SPACE (BAR) ]  00E1:   player 0 pressed_key 17 //17 is the key for FIRING [default - RCTRL, LALT]else_jump @DansMod_9 //Checks for drive-by deactivation process, as drive-by is no the intention due to absence of keypresses required.wait 00501: set_player $PLAYER_CHAR driveby_mode 1 //DRIVE-BY activated8@ = true //DRIVE-BY SWITCH set to "ON"jump @DansMod_9 //Go to next stage of switch circle.:DansMod_070633: AS_actor $PLAYER_ACTOR exit_car //Leaves the car and restarts the loop.jump @DansMod_16:DansMod_08 //Assigns the player a #TEC9 if he does not have a drive-by compatible weapon.4@ = #TEC9 //Give the player a #TEC9 for the drive-by.jump @DansMod_04 //Back to weapon assignment label.:DansMod_9if  Actor.InCar($PLAYER_ACTOR, 0@) ///Is the player in the car??else_jump @DansMod_16 //If not, restart loop.wait 0if and  8@ == true //DRIVE-BY SWITCH should be set to "ON"  00E1:   player 0 pressed_key 18 //18 is the key for CROUCH [default - C]  00E1:   player 0 pressed_key 17 //17 is the key for FIRING [default - RCTRL, LALT]else_jump @DansMod_10 //Checks for drive-by deactivation0501: set_player $PLAYER_CHAR driveby_mode 0 //SWITCH OFF DRIVE-BY8@ = false //Set DRIVE-BY SWITCH to "OFF"jump @DansMod_10:DansMod_10if  Actor.InCar($PLAYER_ACTOR, 0@) //Is the player in the car??else_jump @DansMod_16 //If not, restart loop.wait 0if  00E1:   player 0 pressed_key 14 //JUMP KEY [default - LSHIFT]else_jump @DansMod_11 //Proceed to next link in chainwait 0if  not 9@ == false //if car is NOT STOPPEDelse_jump @DansMod_11 //Skip and go to resume journey if car is stopped.wait 0Car.LockInCurrentPosition(0@, true) //STOP CAR9@ = true //Car is stopped.jump @DansMod_11 //Go to RESUME-JOURNEY:DansMod_12 //If car is moving and not paused, code jumps here, and skips "RESUME-JOURNEY"jump @DansMod_13:DansMod_13if  Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if and //Check for TAB + Y  00E1:   player 0 pressed_key 4 //TAB KEY  00E1:   player 0 pressed_key 11 //Y KEYelse_jump @DansMod_14 //if not pressed, resumewait 010@ += 5.0 //increase speed by 5 km/hCar.SetMaxSpeed(0@, 10@)jump @DansMod_14:DansMod_14if  Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if and //Check for TAB + N  00E1:   player 0 pressed_key 4 //TAB KEY  00E1:   player 0 pressed_key 10 //N KEYelse_jump @DansMod_6wait 010@ -= 5.0Car.SetMaxSpeed(0@, 10@)jump @DansMod_6:DansMod_11if  Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if  9@ == true //Car is moving, thenelse_jump @DansMod_12 //if car is moving, resume in chainwait 0if //if player presses LSHIFT, then go ahead, else skip to next  00E1:   player 0 pressed_key 14else_jump @DansMod_12wait 0Car.SetToNormalDriver(0@)Car.SetMaxSpeed(0@, 10@)Car.ImmuneToNonPlayer(0@, true)Car.DriveTo(0@, 5@, 6@, 7@) //Resume journey9@ == falsejump @DansMod_12:DansMod_16Car.RemoveReferences(0@)jump @DansMod_02 

 

Link to comment
Share on other sites

this is the main problem:

 

if or //Check if player is using melee or non-drive-by-compatible weapons

4@ == #TEC9

4@ == #AK47

4@ == #M4

4@ == #MICRO_UZI

4@ == #MP5LNG

else_jump @DansMod_08

 

this check won't be passed because it's again wrong

as I said in previous post, opcode 0470: returns an integer value and not a model name

It means: YOU CAN NOT CHECK FOR WEAPON-MODEL NAMES AND ALSO NOT FOR WEAPON-MODEL ID NUMBERS

 

Weapons have a hardcoded number which have been discovered by modders

Example: if you wanna give the player a weapon you need to load the model

but then you have to give him the weapon by using this number

 

Model.Load(#TEC9):Loadmodelcheckwait 0if Model.Available(#TEC9)jf @Loadmodelcheck01B2: give_actor $PLAYER_ACTOR weapon 32 ammo 99999 // Load the weapon model before using this// 2. parameter of opcode  01B2: is the weapon number//read about weapon numbers in Sanny Builder Help: SCM Documentation: GTA SA: Weapon numbers

 

so it needs also to use this number in conditional checks

 

0470: 4@ = actor $PLAYER_ACTOR current_weaponif or4@ == 284@ == 294@ == 32else_jump @nextif  or02D8:   actor $PLAYER_ACTOR current_weapon == 2802D8:   actor $PLAYER_ACTOR current_weapon == 2902D8:   actor $PLAYER_ACTOR current_weapon == 32else_jump @nextif or  Actor.HasWeapon($PLAYER_ACTOR, 28)  Actor.HasWeapon($PLAYER_ACTOR, 29)  Actor.HasWeapon($PLAYER_ACTOR, 32)jf @next

 

 

----------------------------------------------------------------------------

 

The Drivebymode:

this is not the driveby-opcode which you need:

0501: set_player $PLAYER_CHAR driveby_mode 1 //DRIVE-BY activated

opcode 0501: belongs to the drivbymode as driver by keypress <look right> or < look left>

as well on bike without look right/ look left

 

you need this opcode:

 

0713: actor $PLAYER_ACTOR driveby_actor -1 car -1 point 0.0 0.0 0.0 radius 300.0 8 0 firing_rate 100// driveby mode

 

 

----------------------------------------------------------------------------

 

The weaponcheck for your drivebyscript:

 

all SMG are working full

 

pistols are working partialy, weapon is unvisible

Shotguns are working partialy, weapon is unvisible

Assault (MG) are working partialy, weapon is unvisible

Rifles are working partialy, weapon is unvisible

Minigun works partialy, weapon is unvisible

 

the game set automaticly to a SMG if the player have one if he is in a car and got the opcode 0713:

so the correct check would be:

 

if or// check if player has a driveby-compatible weapon (SMG)  Actor.HasWeapon($PLAYER_ACTOR, 28)  Actor.HasWeapon($PLAYER_ACTOR, 29)  Actor.HasWeapon($PLAYER_ACTOR, 32)jf @DANSMOD_05//Forget the car and Restart the script

 

 

----------------------------------------------------------------------------

 

The wait-Loop till player is in the car

 

you wrote:

 

wait 1

if

not Actor.InCar($PLAYER_ACTOR, 0@) //Check whether player is in the car

else_jump @DansMod_5 //If player is in the car, go to @DansMod_5

wait 0

Car.RemoveReferences(0@) //Forget the car.

jump @DansMod_02 //Restart the loop.

 

but in that second when these codes will be read is the player not in the car

 

you need to loop the check till the player is in the car

 

 

:DANSMOD_03//Loop till the player is in the carwait 0 if   Player.Defined($PLAYER_CHAR)jf @DANSMOD_05 if   not Car.Wrecked(0@)jf @DANSMOD_04 if   Actor.InCar($PLAYER_ACTOR, 0@)jf @DANSMOD_03//Loop till the player is in the car jump @DansMod_5 :DANSMOD_040792: disembark_instantly_actor $PLAYER_ACTOR// clean all tasks :DANSMOD_05Car.RemoveReferences(0@)//Forget the car.jump @DANSMOD_11//Restart the script.

 

 

-----------------------------------------------------------------------------

 

Test the script below, it works.

Btw. if the marker is not set, the car drives to a location at 0.0 0.0 0.0

 

{$CLEO .cs}//-------------MAIN---------------thread 'DansMod' //Threadname for the gta engine, max. 7 character are really valid (have no effect to scriptname):DansMod_02 //To search for a suitable car, and board it. Also to save the player's weapon.wait 08@ = false //DRIVE-BY MODE SWITCH9@ = false //CAR MOVING/STOPPED SWITCH10@ = 30.0 //MAX. SPEEDif Player.Defined($PLAYER_CHAR) //Player has to exist.else_jump @DansMod_02 //If player does not exist, code restarts.wait 0if not Actor.Driving($PLAYER_ACTOR) //Player has to be on foot.else_jump @DansMod_02 //If player is not on foot, code restarts.wait 0if and //If player presses TAB + C, then car is boarded.00E1:   player 0 pressed_key 4 //4 is the ACTION/SECONDARY FIRE key [default - TAB]00E1:   player 0 pressed_key 18 //19 is the key for CROUCH [default - C]// Player has to press ACTION/SECONDARY FIRE + CROUCH [default - TAB + C]else_jump @DansMod_02 //This will be repeated until the player presses TAB + C  wait 00@ = -1 //0@ set to any value, as we can take any carActor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@) //Get the player's coordinates073E: get_car_in_sphere 1@ 2@ 3@ radius 10.0 model -1 handle_as 0@ //Search for a car in 10.0 radius of the playerif not 0@ == -1 //The car should be decided, or else the loop restarts.else_jump @DansMod_02 //If a car is not found, the script searches again.if or// check if player has a driveby-compatible weapon  Actor.HasWeapon($PLAYER_ACTOR, 28)  Actor.HasWeapon($PLAYER_ACTOR, 29)  Actor.HasWeapon($PLAYER_ACTOR, 32)jf @DANSMOD_05//Forget the car and Restart the script Car.SetMaxSpeed(0@, 0.0)// let the car stop, otherwise the player follows in duckmode :D05CA: AS_actor $PLAYER_ACTOR enter_car 0@ passenger_seat -1 10000 ms:DANSMOD_03//Loop till the player is in the carwait 0 if   Player.Defined($PLAYER_CHAR)jf @DANSMOD_05 if   not Car.Wrecked(0@)jf @DANSMOD_04 if   Actor.InCar($PLAYER_ACTOR, 0@)jf @DANSMOD_03//Loop till the player is in the car jump @DansMod_5 :DANSMOD_040792: disembark_instantly_actor $PLAYER_ACTOR// clean all tasks :DANSMOD_05Car.RemoveReferences(0@)//Forget the car.jump @DANSMOD_11//Restart the script.:DansMod_5 //Sets journey settings and starts journey towards target.0AB6: store_target_marker_coords_to 5@ 6@ 7@ //Get map target coordinates and store them.Car.SetToNormalDriver(0@) //The drive should be at normal mentality.Car.ImmuneToNonPlayer(0@, true) //Making the car bulletproof, dent-proof, etc, or damageable in any way by anyone else.Car.SetMaxSpeed(0@, 10@) //The car's maximum speed is set: default 30.0 km/h.Car.DriveTo(0@, 5@, 6@, 7@) //Drive to target [something has gone HORRIBLY WRONG over here, i can tell...    0713: actor $PLAYER_ACTOR driveby_actor -1 car -1 point 0.0 0.0 0.0 radius 300.0 8 0 firing_rate 100// driveby mode:DansMod_6 //Drive-By Activation & De-Activation, Journey Pause & Resume, and Speed Increase & Decrease chain starts. This is for activation of drive-bys.if Actor.InCar($PLAYER_ACTOR, 0@) //The player should be in the car.else_jump @DansMod_16 //The loop restarts if the player is not in the car.wait 0if and 8@ == false //DRIVE-BY SWITCH should be set to "OFF" 00E1:   player 0 pressed_key 16 //16 is the key for SPRINT [default - SPACE (BAR) ] 00E1:   player 0 pressed_key 17 //17 is the key for FIRING [default - RCTRL, LALT]else_jump @DansMod_9 //Checks for drive-by deactivation process, as drive-by is no the intention due to absence of keypresses required.wait 0//0501: set_player $PLAYER_CHAR driveby_mode 1 //DRIVE-BY activated8@ = true //DRIVE-BY SWITCH set to "ON"jump @DansMod_9 //Go to next stage of switch circle.:DansMod_070633: AS_actor $PLAYER_ACTOR exit_car //Leaves the car and restarts the loop.jump @DansMod_16:DansMod_08 //Assigns the player a #TEC9 if he does not have a drive-by compatible weapon.4@ = #TEC9 //Give the player a #TEC9 for the drive-by.jump @DansMod_04 //Back to weapon assignment label.:DansMod_9if Actor.InCar($PLAYER_ACTOR, 0@) ///Is the player in the car??else_jump @DansMod_16 //If not, restart loop.wait 0if and 8@ == true //DRIVE-BY SWITCH should be set to "ON" 00E1:   player 0 pressed_key 18 //18 is the key for CROUCH [default - C] 00E1:   player 0 pressed_key 17 //17 is the key for FIRING [default - RCTRL, LALT]else_jump @DansMod_10 //Checks for drive-by deactivation//0501: set_player $PLAYER_CHAR driveby_mode 0 //SWITCH OFF DRIVE-BY8@ = false //Set DRIVE-BY SWITCH to "OFF"jump @DansMod_10:DansMod_10if Actor.InCar($PLAYER_ACTOR, 0@) //Is the player in the car??else_jump @DansMod_16 //If not, restart loop.wait 0if 00E1:   player 0 pressed_key 14 //JUMP KEY [default - LSHIFT]else_jump @DansMod_11 //Proceed to next link in chainwait 0if not 9@ == false //if car is NOT STOPPEDelse_jump @DansMod_11 //Skip and go to resume journey if car is stopped.wait 0Car.LockInCurrentPosition(0@, true) //STOP CAR9@ = true //Car is stopped.jump @DansMod_11 //Go to RESUME-JOURNEY:DansMod_12 //If car is moving and not paused, code jumps here, and skips "RESUME-JOURNEY"jump @DansMod_13:DansMod_13if Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if and //Check for TAB + Y 00E1:   player 0 pressed_key 4 //TAB KEY 00E1:   player 0 pressed_key 11 //Y KEYelse_jump @DansMod_14 //if not pressed, resumewait 010@ += 5.0 //increase speed by 5 km/hCar.SetMaxSpeed(0@, 10@)jump @DansMod_14:DansMod_14if Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if and //Check for TAB + N 00E1:   player 0 pressed_key 4 //TAB KEY 00E1:   player 0 pressed_key 10 //N KEYelse_jump @DansMod_6wait 010@ -= 5.0Car.SetMaxSpeed(0@, 10@)jump @DansMod_6:DansMod_11if Actor.InCar($PLAYER_ACTOR, 0@)else_jump @DansMod_16wait 0if 9@ == true //Car is moving, thenelse_jump @DansMod_12 //if car is moving, resume in chainwait 0if //if player presses LSHIFT, then go ahead, else skip to next 00E1:   player 0 pressed_key 14else_jump @DansMod_12wait 0Car.SetToNormalDriver(0@)Car.SetMaxSpeed(0@, 10@)Car.ImmuneToNonPlayer(0@, true)Car.DriveTo(0@, 5@, 6@, 7@) //Resume journey9@ == falsejump @DansMod_12:DansMod_16Car.RemoveReferences(0@)jump @DansMod_02 

 

 

I didn't correct any thing after player is in driveby mode

While this mode you should check if the car is not wrecked and i recomand also to check if Player.Defined($PLAYER_CHAR)

Edited by ZAZ
Link to comment
Share on other sites

dantinkakkar

Da car does not move even if I set the target. I have the latest CLEO installed... sad.gif

 

I'll try once again after removing my manual transmission mod. Maybe it's clashing with this one. After I try this out, I'll get back to you.

 

Thanks a lot.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.