Skip to content

Instantly share code, notes, and snippets.

@user-grinch
Last active August 7, 2023 13:01
Show Gist options
  • Save user-grinch/ffe1ff38175495b8c37d2b020dcb4688 to your computer and use it in GitHub Desktop.
Save user-grinch/ffe1ff38175495b8c37d2b020dcb4688 to your computer and use it in GitHub Desktop.
[Settings]
Key=71
Drive Style = 4
Drive Style increase key= 0x26
Drive Style decrease key= 0x28
Drive Speed = 25.0
Drive Speed increase key = 0x27
Drive Speed decrease key = 0x25
; Enter as passenger script v2.0 by Grinch_
;
; Ascii table, http://www.asciitable.com/
;
; Driving Speed
; change in-game using increase/decrease cheat
;
; Min = 0
; Max = 40
;
;
; Driving Styles
; Change in-game using style key1 + (0/1/2/3/4/5)
;
; 0 = follows traffic lights, stops for obstacles
; 1 = follows traffic lights, drives into obstacles
; 2 = ignores traffic lights, drives around obstacles
; 3 = ignores traffic lights, drives into obstacles
; 4 = ignores traffic lights, stops for obstacles
; 5 = follows traffic lights, drives around obstacles
/*
Enter car as passenger script
Author: Grinch_
You'll need this for the script to compile,
https://forum.mixmods.com.br/f16-utilidades/t179-gta3script-while-true-return_true-e-return_false
*/
SCRIPT_START
{
LVAR_INT scplayer pplayer hped hveh pveh idoor pdoor vec pvec iseat hdriver hpassenger itotalpassenger
// ini
LVAR_INT ikey idrivestyle idrivestyleincreasekey idrivestyledecreasekey idrivespeedincreasekey idrivespeeddecreasekey iwantedlevel
LVAR_FLOAT fdrivespeed
NOP
GET_PLAYER_CHAR 0 scplayer
// INI check
IF DOES_FILE_EXIST "cleo\Enter as passenger.ini"
READ_INT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Key" ikey
READ_INT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Drive Style" idrivestyle // https://gtamods.com/wiki/00AE
READ_INT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Drive Style increase key" idrivestyleincreasekey
READ_INT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Drive Style decrease key" idrivestyledecreasekey
READ_INT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Drive Speed increase key" idrivespeedincreasekey
READ_INT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Drive Speed decrease key" idrivespeeddecreasekey
READ_INT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Key" ikey
READ_FLOAT_FROM_INI_FILE "cleo\Enter as passenger.ini" "Settings" "Drive Speed" fdrivespeed
ELSE
// ini doesn't exist
WHILE TRUE
PRINT_STRING "'Enter as passenger.ini' doesn't exist. Please reinstall" 1000
WAIT 900
ENDWHILE
ENDIF
WHILE TRUE
WAIT 0
IF IS_KEY_PRESSED ikey
IF IS_CHAR_IN_ANY_CAR scplayer
GET_CAR_CHAR_IS_USING scplayer hveh
GET_DRIVER_OF_CAR hveh hdriver
IF NOT hdriver = scplayer
CAR_SET_IDLE hveh
WHILE NOT IS_CAR_STOPPED hveh
WAIT 0
ENDWHILE
TASK_LEAVE_CAR scplayer hveh
WHILE NOT IS_CHAR_ON_FOOT scplayer
WAIT 0
ENDWHILE
SET_CAR_MISSION hveh 1
SET_CAR_DRIVING_STYLE hveh idrivestyle
SET_CAR_CRUISE_SPEED hveh fdrivespeed
ENDIF
hveh = NULL
ELSE
STORE_CLOSEST_ENTITIES scplayer hveh hped
IF hveh > 0
GET_VEHICLE_POINTER hveh pveh
GET_PED_POINTER scplayer pplayer
GET_VAR_POINTER idoor pdoor
GET_VAR_POINTER vec pvec
CALL_FUNCTION 0x650BB0 7 7 (FALSE FALSE FALSE pdoor pvec pveh pplayer) // CCarEnterExit::GetNearestCarPassengerDoor
CALL_FUNCTION_RETURN 0x64F1E0 2 2 (idoor,pveh) iseat // CCarEnterExit::ComputePassengerIndexFromCarDoor
TASK_ENTER_CAR_AS_PASSENGER scplayer hveh -1 iseat
GET_MAXIMUM_NUMBER_OF_PASSENGERS hveh itotalpassenger
STORE_WANTED_LEVEL 0 iwantedlevel
iseat = 0
WHILE TRUE
GET_CHAR_IN_CAR_PASSENGER_SEAT hveh iseat hpassenger
IF hpassenger > 0
AND NOT hpassenger = scplayer
SET_CHAR_STAY_IN_CAR_WHEN_JACKED hpassenger TRUE
ENDIF
IF iseat = itotalpassenger
BREAK
ENDIF
iseat += 1
ENDWHILE
WHILE IS_CHAR_GETTING_IN_TO_A_CAR scplayer
WAIT 0
ENDWHILE
IF IS_CHAR_IN_CAR scplayer hveh
ALTER_WANTED_LEVEL 0 iwantedlevel
ENDIF
ENDIF
ENDIF
WHILE IS_KEY_PRESSED ikey
WAIT 0
ENDWHILE
ENDIF
IF NOT hveh = NULL
AND IS_CHAR_IN_CAR scplayer hveh
GET_DRIVER_OF_CAR hveh hdriver
IF hdriver > 0
AND NOT hdriver = scplayer
CAR_SET_IDLE hveh
SET_CAR_MISSION hveh 1
SET_CAR_DRIVING_STYLE hveh idrivestyle
SET_CAR_CRUISE_SPEED hveh fdrivespeed
ENDIF
hdriver = NULL
ENDIF
IF IS_KEY_PRESSED idrivespeedincreasekey
IF fdrivespeed < 50.0
fdrivespeed += 5.0
IF NOT hveh = NULL
SET_CAR_CRUISE_SPEED hveh fdrivespeed
ENDIF
PRINT_HELP_FORMATTED "Speed set to %0.f" fdrivespeed
ELSE
PRINT_HELP_STRING "Max speed set"
ENDIF
WAIT 250
ENDIF
IF IS_KEY_PRESSED idrivespeeddecreasekey
IF fdrivespeed > 0.0
fdrivespeed -= 5.0
IF NOT hveh = NULL
SET_CAR_CRUISE_SPEED hveh fdrivespeed
ENDIF
PRINT_HELP_FORMATTED "Speed set to %0.f" fdrivespeed
ELSE
PRINT_HELP_STRING "Min speed set"
ENDIF
WAIT 250
ENDIF
IF IS_KEY_PRESSED idrivestyleincreasekey
IF idrivestyle < 5
idrivestyle += 1
IF NOT hveh = NULL
SET_CAR_DRIVING_STYLE hveh idrivestyle
ENDIF
PRINT_HELP_FORMATTED "Style set to %d" idrivestyle
ELSE
PRINT_HELP_STRING "Max style set"
ENDIF
WAIT 250
ENDIF
IF IS_KEY_PRESSED idrivestyledecreasekey
IF idrivestyle > 0
idrivestyle -= 1
IF NOT hveh = NULL
SET_CAR_DRIVING_STYLE hveh idrivestyle
ENDIF
PRINT_HELP_FORMATTED "Style set to %d" idrivestyle
ELSE
PRINT_HELP_STRING "Min style set"
ENDIF
WAIT 250
ENDIF
ENDWHILE
}
SCRIPT_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment