Skip to content

Instantly share code, notes, and snippets.

@JuniorDjjr
Created December 4, 2020 11:52
Show Gist options
  • Save JuniorDjjr/0182a604a4bd215cf5d266bd2b475fc9 to your computer and use it in GitHub Desktop.
Save JuniorDjjr/0182a604a4bd215cf5d266bd2b475fc9 to your computer and use it in GitHub Desktop.
// by Junior_Djjr - MixMods.com.br
// You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus
SCRIPT_START
{
LVAR_INT scplayer hMenu iItem iWeaponTypes[12] iWeaponCosts[12] hVendor iLocal
LVAR_FLOAT x y z
GET_PLAYER_CHAR 0 scplayer
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID1" iWeaponTypes[0]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID2" iWeaponTypes[1]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID3" iWeaponTypes[2]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID4" iWeaponTypes[3]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID5" iWeaponTypes[4]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID6" iWeaponTypes[5]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID7" iWeaponTypes[6]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID8" iWeaponTypes[7]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID9" iWeaponTypes[8]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID10" iWeaponTypes[9]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID11" iWeaponTypes[10]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "ID12" iWeaponTypes[11]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO1" iWeaponCosts[0]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO2" iWeaponCosts[1]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO3" iWeaponCosts[2]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO4" iWeaponCosts[3]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO5" iWeaponCosts[4]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO6" iWeaponCosts[5]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO7" iWeaponCosts[6]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO8" iWeaponCosts[7]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO9" iWeaponCosts[8]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO10" iWeaponCosts[9]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO11" iWeaponCosts[10]
READ_INT_FROM_INI_FILE "CLEO\Tools Shop.ini" "Items" "CO12" iWeaponCosts[11]
LOAD_TEXTURE_DICTIONARY TOOLSHP
LOAD_SPRITE 1 ICONBLIP
GET_TEXTURE_FROM_SPRITE 1 (timera)
ADD_CLEO_BLIP timera 2063.0359 -1870.0331 TRUE 255 255 255 255 (timerb)
ADD_CLEO_BLIP timera -2225.6467 419.0363 TRUE 255 255 255 255 (timerb)
ADD_CLEO_BLIP timera -1577.3505 -2716.1621 TRUE 255 255 255 255 (timerb)
ADD_CLEO_BLIP timera 1990.053 2627.3206 TRUE 255 255 255 255 (timerb)
WHILE TRUE
WAIT 0
// LS
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES 2063.0359 -1870.0331 13.3 200.0
x = 2063.0359
y = -1870.0331
z = 13.3
iLocal = 1
GOSUB Run
ENDIF
// SF
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES -2225.6467 419.0363 35.1796 200.0
x = -2225.6467
y = 419.0363
z = 34.8
iLocal = 2
GOSUB Run
ENDIF
// Angel Pine
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES -1577.3505 -2716.1621 48.5574 200.0
x = -1577.3505
y = -2716.1621
z = 48.5574
iLocal = 3
GOSUB Run
ENDIF
// LV
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES 1990.053 2627.3206 10.8253 200.0
x = 1990.053
y = 2627.3206
z = 10.8253
iLocal = 4
GOSUB Run
ENDIF
ENDWHILE
Run:
REQUEST_MODEL SWMOST
REQUEST_ANIMATION WEAPONS
WHILE NOT HAS_MODEL_LOADED SWMOST
OR NOT HAS_ANIMATION_LOADED WEAPONS
WAIT 0
ENDWHILE
SWITCH iLocal
CASE 1
CREATE_CHAR PEDTYPE_CIVMALE SWMOST 2060.6392 -1869.9933 13.3 (hVendor)
SET_CHAR_HEADING hVendor 270.0
BREAK
CASE 2
CREATE_CHAR PEDTYPE_CIVMALE SWMOST -2222.949 419.102 35.0 (hVendor)
SET_CHAR_HEADING hVendor 90.0
BREAK
CASE 3
CREATE_CHAR PEDTYPE_CIVMALE SWMOST -1576.0106 -2714.1799 48.3 (hVendor)
SET_CHAR_HEADING hVendor 140.0
BREAK
CASE 4
CREATE_CHAR PEDTYPE_CIVMALE SWMOST 1990.2102 2624.7971 10.5 (hVendor)
SET_CHAR_HEADING hVendor 0.0
BREAK
ENDSWITCH
MARK_MODEL_AS_NO_LONGER_NEEDED SWMOST
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN hVendor FALSE TRUE TRUE
TASK_PLAY_ANIM hVendor SHP_TRAY_POSE WEAPONS 2.0 ON OFF OFF OFF -1
WHILE LOCATE_CAMERA_DISTANCE_TO_COORDINATES x y z 220.0
WAIT 0
IF HAS_CHAR_BEEN_DAMAGED_BY_CHAR hVendor scplayer
OR IS_CHAR_DEAD hVendor
WHILE LOCATE_CAMERA_DISTANCE_TO_COORDINATES x y z 250.0
WAIT 0
ENDWHILE
BREAK
ENDIF
IF LOCATE_STOPPED_CHAR_ON_FOOT_3D scplayer x y z 1.0 1.0 1.0 TRUE
SET_PLAYER_CONTROL_PAD PAD1 OFF
TASK_TURN_CHAR_TO_FACE_CHAR scplayer hVendor
PRINT_HELP_FOREVER WARDH3
DISPLAY_RADAR OFF
CREATE_MENU WPTWPT (30.0 120.0) 90.0 2 TRUE TRUE 0 (hMenu)
SET_MENU_COLUMN hMenu 0 DUMMY WPTWP01 WPTWP02 WPTWP03 WPTWP04 WPTWP05 WPTWP06 WPTWP07 WPTWP08 WPTWP09 WPTWP10 WPTWP11 WPTWP12
REPEAT 12 timera
IF iWeaponTypes[timera] <= 0
ACTIVATE_MENU_ITEM hMenu timera OFF
ELSE
SET_MENU_ITEM_WITH_NUMBER hMenu 1 timera WPTCST iWeaponCosts[timera]
ENDIF
ENDREPEAT
WHILE LOCATE_CHAR_ON_FOOT_3D scplayer x y z 1.5 1.5 1.5 FALSE
AND NOT IS_BUTTON_PRESSED PAD1 TRIANGLE
WAIT 0
IF IS_SELECT_MENU_JUST_PRESSED
GET_MENU_ITEM_SELECTED hMenu iItem
IF iWeaponTypes[iItem] > 0
GET_WEAPONINFO iWeaponTypes[iItem] 1 (timera)
IF timera > 0
// Note: I don't have enough vars
CLEO_CALL GetAmmoClipFromWeaponType 0 (iWeaponTypes[iItem])(timera)
IF HAS_CHAR_GOT_WEAPON scplayer iWeaponTypes[iItem]
AND timera = 1
PRINT_NOW WPTHAS 2000 1
SET_CURRENT_CHAR_WEAPON scplayer iWeaponTypes[iItem]
ELSE
GET_WEAPONINFO iWeaponTypes[iItem] 1 (timera)
GET_WEAPONINFO_MODELS timera (timera timerb)
IF timera > 0
REQUEST_MODEL timera
ENDIF
IF timerb > 0
REQUEST_MODEL timerb
ENDIF
LOAD_ALL_MODELS_NOW
CHANGE_PLAYER_MONEY 0 CHANGE_MONEY_REMOVE iWeaponCosts[iItem]
CLEO_CALL GetAmmoClipFromWeaponType 0 (iWeaponTypes[iItem])(timera)
GIVE_WEAPON_TO_CHAR scplayer iWeaponTypes[iItem] timera
SET_CURRENT_CHAR_WEAPON scplayer iWeaponTypes[iItem]
CLEAR_PRINTS
ENDIF
ENDIF
ENDIF
ENDIF
ENDWHILE
DELETE_MENU hMenu
CLEAR_HELP
CLEAR_PRINTS
DISPLAY_RADAR ON
SET_PLAYER_CONTROL_PAD PAD1 ON
WHILE LOCATE_CHAR_ON_FOOT_3D scplayer x y z 1.5 1.5 1.5 FALSE
WAIT 0
ENDWHILE
ENDIF
ENDWHILE
REMOVE_CHAR_ELEGANTLY hVendor
REMOVE_ANIMATION WEAPONS
RETURN
}
SCRIPT_END
{
LVAR_INT iWeaponType //In
LVAR_INT i
GetAmmoClipFromWeaponType:
GET_WEAPONINFO iWeaponType 1 (i)
READ_STRUCT_OFFSET i 0x20 2 (i) //ammoClip
CLAMP_INT i 1 999 (i)
CLEO_RETURN 0 (i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment