#1 01-08-2008 07:33

flashTrash
From: Н.Новгород
Registered: 21-02-2007
Posts: 260
Website

Бензомод

Бензо-спидометро-мод. Написан с нуля(кроме кусков относящихся к спидометру, которые скопи-пастил).
Как ясно из названия - добавляет бензин и спидометр.

{$CLEO}
var
 2@ :Integer
 3@ :Integer
 4@ :Integer
 5@ :Integer
 6@ :Integer
 7@ :Integer
 9@ :Array 7 of Integer
 16@ :Integer
 17@ :Integer
 18@ :Array 7 of Integer
 19@ :Integer
 20@ :Integer
 21@ :Integer
 22@ :Integer
 23@ :Integer
 24@ :Integer
 25@ :Integer
 26@ :Integer
 32@ :Integer
 33@ :Integer
 30@ :Integer
end // var
const
playerCar = 9@ 
BenzoBak = 4@
rashod = 6@
gear = 30@
GasolineCost = 17@
WantedMultyple = 26@
end // const
03A4: name_thread 'GASOLINE' 
0A92: create_custom_thread "A3C.s"
18@ = random(4, 98)
19@ = random(4, 98)
20@ = random(4, 98)
21@ = random(4, 98)
22@ = random(4, 98)
23@ = random(4, 98)
24@ = random(4, 98)

:benzin
while true
wait 0
if 
  Player.Defined($PLAYER_CHAR)
then
if and
Actor.Driving($PLAYER_ACTOR)
not Actor.DrivingBoat($PLAYER_ACTOR)
not Actor.DrivingFlyingVehicle($PLAYER_ACTOR)
not Actor.DrivingVehicleType($PLAYER_ACTOR,#BMX)
not Actor.DrivingVehicleType($PLAYER_ACTOR,#BIKE)
not Actor.DrivingVehicleType($PLAYER_ACTOR,#MTBIKE)
not $ONMISSION == 1
jf @benzin
03F0: enable_text_draw 1 
0390: load_txd_dictionary "SPEED2" 
038F: load_texture "1" as 1 // Load dictionary with 0390 first 
038F: load_texture "2" as 2 // Load dictionary with 0390 first 
038F: load_texture "3" as 3 // Load dictionary with 0390 first 
038F: load_texture "4" as 4 // Load dictionary with 0390 first 
038F: load_texture "5" as 5 // Load dictionary with 0390 first
038F: load_texture "r" as 6 // Load dictionary with 0390 first
038F: load_texture "sp" as 7 // Load dictionary with 0390 first 
038F: load_texture "spnight" as 8 // Load dictionary with 0390 first 
038F: load_texture "spar" as 9 // Load dictionary with 0390 first 
038F: load_texture "sparnight" as 10 // Load dictionary with 0390 first 
038F: load_texture "1n" as 11 // Load dictionary with 0390 first 
038F: load_texture "2n" as 12 // Load dictionary with 0390 first 
038F: load_texture "3n" as 13 // Load dictionary with 0390 first 
038F: load_texture "4n" as 14 // Load dictionary with 0390 first 
038F: load_texture "5n" as 15 // Load dictionary with 0390 first
038F: load_texture "rn" as 16 // Load dictionary with 0390 first
038F: load_texture "gasar" as 17 // Load dictionary with 0390 first 
038F: load_texture "gasover" as 18 // Load dictionary with 0390 first 
01BD: 5@ = current_time_in_ms 
3@ = -1

:benzo1
if
856E:   not car playerCar[16@] defined
jf @benzo2 
goto @benzin22_52 

:benzo2
if
80DB:   not actor $PLAYER_ACTOR in_car playerCar[16@] 
jf @benzin2_5
if
not 16@ == 6
jf @benzo3
16@ += 1
goto @benzo1

:benzo3
16@ = 25@
0209: 18@[16@] = random_int_in_ranges 4 98 
25@ += 1
if
not 25@ == 6
0AA0: gosub_if_false @benzo4
wait 0
goto @benzin22_52

:benzo4
25@ = 0
0AA1: return_if_false

:benzin22_52
Actor.Car(playerCar[16@],$PLAYER_ACTOR)

:benzin2_5
4@ = 18@[16@]
09C4: set_car playerCar[16@] gas_tank_explosion_enabled 1 

:benzin1_5
32@ = 0

:benzin2
wait 0
if
not Car.Wrecked(playerCar[16@])
jf @benzin45
if and
00DB:   actor $PLAYER_ACTOR in_car playerCar[16@] 
not $ONMISSION == 1
jf @benzin4
0AB1: call_scm_func @speedometer 3 4@ 5@ 3@ 5@ 3@
gosub @zapravko
if
not 0 >= 4@
jf @benzin5
0ABE:  vehicle playerCar[16@] engine_on
0AA0: gosub_if_false @engine_on
0AB8: get_vehicle playerCar[16@] current_gear_to gear
if
not gear == 5
0AA0: gosub_if_false @gear5
if
not gear == 4
0AA0: gosub_if_false @gear4
if
not gear == 3
0AA0: gosub_if_false @gear3
if
not gear == 2
0AA0: gosub_if_false @gear2
if
not gear == 1
0AA0: gosub_if_false @gear1
if
not gear == 0         //rear
0AA0: gosub_if_false @gear0
if
81C1:   not car playerCar[16@] stopped 
0AA0: gosub_if_false @carstopped
if
32@ >= rashod
jf @benzin2
4@ -= 1
goto @benzin1_5

:engine_on
09C4: set_car playerCar[16@] gas_tank_explosion_enabled 1 
0ABF: set_vehicle playerCar[16@] engine_state_to 1
0AA1: return_if_false

:gear0           //
rashod = 10800    // rear
0AA1: return_if_false     //

:gear1
rashod = 6000
0AA1: return_if_false

:gear2
rashod = 7000
0AA1: return_if_false

:gear3
rashod = 8500
0AA1: return_if_false

:gear4
rashod = 9600
0AA1: return_if_false

:gear5
rashod = 108000
0AA1: return_if_false

:carstopped
rashod = 125000
0AA1: return_if_false

:benzin4
18@[16@] = 4@
goto @benzin

:benzin45
0391: release_txd_dictionary 
goto @benzin

:benzin5
02D4: car playerCar[16@] turn_off_engine 
09C4: set_car playerCar[16@] gas_tank_explosion_enabled 0 
18@[16@] = 4@

:benzin6
//wait 0
if
not Actor.Driving($PLAYER_ACTOR)
jf @benzin2
0391: release_txd_dictionary 
end
end //while

:speedometer
var
 12@ :Integer
end // var//8@ = 7 
9@ = 9 
3@ = 6
4@ = 1
5@ = 2
6@ = 3
7@ = 4
8@ = 5
008F: 0@ = integer 0@ to_float 
0@ /= 2.0
0@ += 155.0
03C0: 10@ = actor $PLAYER_ACTOR car 
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 7 position 550.0 360.0 size 180.0 160.0 RGBA 255 255 255 255 
03E3: set_texture_to_be_drawn_antialiased 1 
074B: draw_texture 17 position 550.0 356.0 scale 90.0 80.0 angle 0@ color_RGBA 255 255 255 255 
if or
0@ > 167.5
2@ == 1
jf @speedometer4
0@ > 155.0
jf @speedometer4
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 18 position 558.0 391.0 size 11.25 10.0 RGBA 255 255 255 60 

:speedometer5
01BD: 12@ = current_time_in_ms 
0062: 12@ -= 1@ // (int) 
12@ >= 1750
jf @speedometer3
2@ *= -1
01BD: 1@ = current_time_in_ms 
goto @speedometer3

:speedometer4
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 18 position 558.0 391.0 size 11.25 10.0 RGBA 190 0 0 255 
0@ > 155.0
jf @speedometer3
goto @speedometer5

:speedometer3
02E3: 17@ = car 10@ speed 
17@ *= 3.7 
17@ += 40.0
0AB8: get_vehicle 10@ current_gear_to 11@ 
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 3@(11@,6i) position 542.0 392.0 size 39.375 35.0 RGBA 255 255 255 255   //038D: draw_texture 1@(11@,6i) position 540.0 391.0 size 67.5 60.0 RGBA 255 255 255 255 
03E3: set_texture_to_be_drawn_antialiased 1 
not 17@ > 320.0
jf @speedometer6
074B: draw_texture 9@ position 550.0 360.0 scale 225.0 200.0 angle 17@ color_RGBA 255 255 255 255   //1,125
0AB2: ret 2 1@ 2@

:speedometer6
0208: 17@ = random_float_in_ranges 310.0 330.0 
074B: draw_texture 9@ position 550.0 360.0 scale 225.0 200.0 angle 17@ color_RGBA 255 255 255 255   //1,125
0AB2: ret 2 1@ 2@

:zapravko
if and
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA 2123.3806 928.5721 cornerB 2106.8508 911.447 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA 2156.116 2755.251 cornerB 2139.3486 2740.3503 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA 2194.8752 2484.6067 cornerB 2210.6038 2466.6272 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA 1587.3915 2205.6235 cornerB 1604.3937 2191.3142 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA -1690.4707 409.2204 cornerB -1661.2582 417.7699 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA -2406.9104 965.6361 cornerB -2415.9421 986.1729 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA -1322.9725 2686.8352 cornerB -1335.1208 2666.2117 stopped
jf @zapravko2
if and
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA -2240.0842 -2567.7544 cornerB -2245.656 -2554.0215 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA -1616.8291 -2719.7837 cornerB -1595.7903 -2707.2815 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA -100.651 -1178.0348 cornerB -81.0769 -1162.0487 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA 652.7013 -575.2865 cornerB 658.194 -555.3245 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA 1937.6512 -1784.6312 cornerB 1945.447 -1762.0051 stopped
81AB:   not car playerCar[16@] sphere 0 in_rectangle_cornerA -1482.6179 1871.4877 cornerB -1458.9929 1854.3845 stopped
jf @zapravko2
return

:zapravko2
if and
33@ >= 500
not 4@ >= 100
0AA1: return_if_false
0AB1: call_scm_func @speedometer 3 4@ 5@ 3@ 5@ 3@
if
not Actor.InZone($PLAYER_ACTOR,'VE')
then
    if and
    not Actor.InZone($PLAYER_ACTOR,'BONE')
    not Actor.InZone($PLAYER_ACTOR,'FLINTC')
    not Actor.InZone($PLAYER_ACTOR,'RED')
    then
        GasolineCost = 1000
        WantedMultyple = Player.WantedLevel($PLAYER_CHAR)
        WantedMultyple += 1
        GasolineCost *= WantedMultyple
    else
        GasolineCost = 900
        WantedMultyple = Player.WantedLevel($PLAYER_CHAR)
        WantedMultyple += 1
        GasolineCost *= WantedMultyple
        goto @add_gasoline
    end
else
    GasolineCost = 1200
    WantedMultyple = Player.WantedLevel($PLAYER_CHAR)
    WantedMultyple += 1
    GasolineCost *= WantedMultyple
    goto @add_gasoline
end

:add_gasoline
GasolineCost -= 1
if
010A:   player $PLAYER_CHAR money > GasolineCost
jf @nomoneys 
GasolineCost += 1
GasolineCost *= -1    
4@ += 1
Player.Money($PLAYER_CHAR) += GasolineCost
32@ = 0
33@ = 0
goto @zapravko

:nomoneys
if
88FE:   not text_box_displayed 
0AA1: return_if_false
03E5: show_text_box 'NOMONEY'
return

Файл A3C.s

{$CLEO .s}
0000:

:A3C
wait 0
0@ = 0
04CE: 1@ = create_icon_marker_without_sphere 55 at -1673.3113 415.5818 6.8497  // san fierro east bassein 
04CE: 2@ = create_icon_marker_without_sphere 55 at -2407.5476 974.9628 44.9663  // chinatown 
04CE: 3@ = create_icon_marker_without_sphere 55 at -1329.8654 2665.9988 49.6674    //el q1 
04CE: 4@ = create_icon_marker_without_sphere 55 at 603.6575 1703.6644 7.1044   //bone c1 
04CE: 5@ = create_icon_marker_without_sphere 55 at 2114.6245 920.1982 10.8203    //lv 1 icon
04CE: 6@ = create_icon_marker_without_sphere 55 at 2148.3494 2747.8782 10.8203   // lv 2 icon
04CE: 7@ = create_icon_marker_without_sphere 55 at 2202.2673 2473.8806 10.8203    //lv 3 icon
04CE: 8@ = create_icon_marker_without_sphere 55 at 1596.6096 2198.6833 10.8203   //lv 4 ic
04CE: 9@ = create_icon_marker_without_sphere 55 at -2243.6313 -2559.158 31.9219  // san fierro east bassein 
04CE: 10@ = create_icon_marker_without_sphere 55 at -1606.2698 -2714.0828 48.5335  // chinatown 
04CE: 11@ = create_icon_marker_without_sphere 55 at -90.1793 -1169.6742 2.3974    //el q1 
04CE: 12@ = create_icon_marker_without_sphere 55 at 655.2332 -565.256 16.3359   //bone c1 
04CE: 13@ = create_icon_marker_without_sphere 55 at 1943.4669 -1773.2439 13.3906    //lv 1 icon
04CE: 14@ = create_icon_marker_without_sphere 55 at -1469.8339 1864.4039 32.6328    //lv 1 icon

:A3C_save
wait 0
0A8D: 0@ = read_memory 0xBA68A7 size 1 virtual_protect 1
if
not 0@ == 0
jf @A3C_save
0164: disable_marker 1@  
0164: disable_marker 2@  
0164: disable_marker 3@  
0164: disable_marker 4@  
0164: disable_marker 5@  
0164: disable_marker 6@  
0164: disable_marker 7@  
0164: disable_marker 8@  
0164: disable_marker 9@  
0164: disable_marker 10@ 
0164: disable_marker 11@ 
0164: disable_marker 12@ 
0164: disable_marker 13@
//0A93: end_custom_thread

:A3C_save_done
wait 0
if or
09FA:   is_menu_closed 
03D9:   save_done
jf @A3C_save_done
goto @A3C

В любой файл .fxt, по желанию, добавить:

LG_57 A3C

Жду конструктивной критики=)

Last edited by flashTrash (01-08-2008 10:55)

Offline

#2 01-08-2008 07:43

Noob
Registered: 28-06-2008
Posts: 44

Re: Бензомод

Компилироовать 3 скрипта? Или какой из них?

Offline

#3 01-08-2008 08:08

flashTrash
From: Н.Новгород
Registered: 21-02-2007
Posts: 260
Website

Re: Бензомод

Первые два компилить обязательно. Строку

LG_57 A3C

можно добавить в ЛЮБОЙ файл .fxt (этакие Клео-gxt файлы). Прочитай инструкцию к плагину gxthook и всё поймёшь.

Offline

#4 01-08-2008 09:20

Centrino Duo
Registered: 08-05-2008
Posts: 99

Re: Бензомод

Скриншот можно? у мну прост шас нема чистого сана,поставил на сейв ал,вылетает

Offline

#5 01-08-2008 10:31

Seemann
Registered: 07-08-2006
Posts: 2,155

Re: Бензомод

@flashTrash -

9@ :Array 7 of Integer
18@ :Array 7 of Integer

плохие новости. массивы хранятся там же где и переменные. это значит, что 9@[1] это тоже самое что 10@. Поэтому когда ты пишешь в массив, ты на самом деле меняешь локальные переменные, а значит затираешь предыдущие значения.

Offline

#6 01-08-2008 10:51

flashTrash
From: Н.Новгород
Registered: 21-02-2007
Posts: 260
Website

Re: Бензомод

@Seemann
для меня это не новостьт smile . В переменных 9@ - 15@ хранятся машины. Использовал для "памяти", что-то типо запоминания у какой машины скока бензина осталось. Аналогично с 18@ и иже с ними, только там хранятся числа значение бензина

Offline

#7 01-08-2008 11:12

Centrino Duo
Registered: 08-05-2008
Posts: 99

Re: Бензомод

а че у меня игра вылетает када сажусь в тачу:cry:

Offline

#8 01-08-2008 11:25

flashTrash
From: Н.Новгород
Registered: 21-02-2007
Posts: 260
Website

Re: Бензомод

извеняюсь за свою память...
Для работы нужен Клео версии 950 и выше
и скачай архив, там файл speed2.txd , его надо положить в папку models\txd

Offline

#9 01-08-2008 11:32

Centrino Duo
Registered: 08-05-2008
Posts: 99

Re: Бензомод

Я так и сделал,и ставил скрипт который в архиве,всеравно вылетает

Offline

#10 01-08-2008 11:39

flashTrash
From: Н.Новгород
Registered: 21-02-2007
Posts: 260
Website

Re: Бензомод

Centrino Duo
хм.. странно... тогда просьба:
поставь пожалуйсто плагин scmlog.cleo и после того как игра вылетит, скинь мне файл scmlog.log
у кого еще вылетает?

Offline

#11 01-08-2008 11:52

Centrino Duo
Registered: 08-05-2008
Posts: 99

Re: Бензомод

мля,он не пашет (скм лог).
D:\Games\GTA-San Andreas\cleo\plugins\scmlog\scmlog.cleo если он так лежит,то в лог не записывает ничего,D:\Games\GTA-San Andreas\cleo\scmlog.cleo если так,то после загрузки игры,игра вылетает  ио5 таки в лог ничего не записывается rolleyes

Last edited by Centrino Duo (01-08-2008 11:53)

Offline

#12 01-08-2008 14:32

Seemann
Registered: 07-08-2006
Posts: 2,155

Re: Бензомод

Мод работает. Правда с текстурой спидометра у меня какие-то глюки, больно мелкая она и текст нечитабельный. Заправки вроде работают

Кстати, насчет спидометра: лучше вот этого сложно что-то придумать, и хорошо если спидометр можно было отключать, чтобы не было как у меня - сразу два))

Offline

#13 01-08-2008 16:09

Alexander
Registered: 19-08-2006
Posts: 184
Website

Re: Бензомод

лучше сохранять кол-во бензина в неиспользующихся байтах структуры авто

Offline

#14 01-08-2008 18:49

flashTrash
From: Н.Новгород
Registered: 21-02-2007
Posts: 260
Website

Re: Бензомод

@Seemann
Наверно это от разрешения монитора зависит...
Можно сделать вариант без спидометра, а значение бензина выводить статус-полоской, собственно я сначала так и сделал, но потом меня уломали на совмещение со спидометром.
@Alexander
Гениально... я б до такого нивжись не додумался, спасибо.

Пора садиться за обновление smile

Offline

#15 02-08-2008 01:49

Seemann
Registered: 07-08-2006
Posts: 2,155

Re: Бензомод

лучше сохранять кол-во бензина в неиспользующихся байтах структуры авто

yelmi уже давно так и сделал, кажется

Offline

#16 02-08-2008 15:05

Capushon
Registered: 13-08-2006
Posts: 350
Website

Re: Бензомод

@Alexander -
@Seemann -
что значит "сохранять кол-во бензина в неиспользующихся байтах структуры авто" ?
Пример ...


Сначала ты надежда и гордость,
Потом о спину ломают аршин. (c)БГ

Offline

#17 02-08-2008 21:52

yelmi
Registered: 10-12-2006
Posts: 134
Website

Re: Бензомод

yelmi уже давно так и сделал, кажется

Ага сделал, никак не выложу обновленный вариант, пока смотрим скрин.
index.php?action=dlattach;topic=6.0;attach=62;image

Offline

#18 02-08-2008 23:16

Centrino Duo
Registered: 08-05-2008
Posts: 99

Re: Бензомод

крутаа смотрится:clap:,када выложеш?

Offline

#19 03-08-2008 02:51

Seemann
Registered: 07-08-2006
Posts: 2,155

Re: Бензомод

@Capushon - каждой машине соответствует определенный набор данных (структура) в памяти игры, где хранятся номер модели, данные о физике и т.п. Некоторые байты в этой структуре не используются. И в них можно записывать свои значения, если использовать опкоды

0A97: 0@ = car 1@ struct
1@ += 1000 // какое то смещение до неиспользуемого байта
0A8C: write_memory 1@ size 1 value 1 virtual_protect 0

@yelmi - над интерфейсом возможно следовало бы подумать wink По крайней мере ту шкалу, которая выше всех, точно следовало бы опустить пониже, она прям по центру экрана торчит

Offline

#20 03-08-2008 12:04

yelmi
Registered: 10-12-2006
Posts: 134
Website

Re: Бензомод

Seemann wrote:

@yelmi - над интерфейсом возможно следовало бы подумать wink По крайней мере ту шкалу, которая выше всех, точно следовало бы опустить пониже, она прям по центру экрана торчит

Можно сделать и ниже, а вообще эта шкала бутет только при наличии нитро в авто.

Offline

Board footer

Powered by FluxBB