Это демонстрация создания списка товаров, иначе - панелей
Введите "PANEL", чтобы вывести панель со списком оружия, каждое со своей ценой. Для работы скрипта нужно создать .fxt файл с текстом, который приведён после скрипта. Создание таких файлов описано в разделе "Статьи".
// $PLAYER_ACTOR $PLAYER_GROUP $ONMISSION
{$CLEO}
0000:
while true //1
wait 0
if //2
player.Defined(0)
then
if and //3
not actor.Dead($PLAYER_ACTOR)
not actor.Driving($PLAYER_ACTOR)
0ADC: test_cheat "PANEL"
then
player.CanMove(0,0)
08D4: 0@ = create_panel_with_title 'PNL1' position 250.0 170.0 width 70.0 columns 2 interactive 1 background 1 alignment 1
08DB: set_panel 0@ column 0 header 'DUMMY' data 'PNL2' 'PNL3' 'PNL4' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
08D6: set_panel 0@ column 1 alignment 1 //0 - Center, 1 - Left, 2 - Right
08EE: set_panel 0@ column 1 row 0 text_1number GXT 'DOLLAR' number 700
08EE: set_panel 0@ column 1 row 1 text_1number GXT 'DOLLAR' number 750
08EE: set_panel 0@ column 1 row 2 text_1number GXT 'DOLLAR' number 1200
while true //4
wait 0
if or //5
actor.Dead($PLAYER_ACTOR)
0741: actor $PLAYER_ACTOR busted
00E1: player 0 pressed_key 15
then
break
else
if //6
00E1: player 0 pressed_key 16
then
08D7: 1@ = panel 0@ active_row
gosub @Give
end //6
end //5
end //4
08DA: remove_panel 0@
player.CanMove(0,1)
end //3
end //2
end //1
:Give //3@ - Model, 4@ - Weapon ID, 5@ - Ammo, 6@ - Cost
if
1@ == 0 //AK47
then
3@ = #AK47
4@ = 30
5@ = 120
6@ = 700
else
if
1@ == 1 //M4
then
3@ = #M4
4@ = 31
5@ = 120
6@ = 750
else
3@ = #SNIPER
4@ = 34
5@ = 25
6@ = 1200
end
end
2@ = player.Money(0)
if
002D: 2@ >= 6@ // (int)
then
6@ *= -1
model.Load(3@)
038B: load_requested_models
actor.GiveWeaponAndAmmo($PLAYER_ACTOR,4@,5@)
model.Destroy(3@)
player.Money(0) += 6@
else
03E5: show_text_box 'PNL5'
end
wait 300
return
Содержимое .fxt файла:
PNL1 Weapon
PNL2 AK47
PNL3 M4
PNL4 Sniper
PNL5 You don't have enough money
Введите "PANEL", чтобы вывести панель со списком оружия, каждое со своей ценой. Для работы скрипта нужно создать .fxt файл с текстом, который приведён после скрипта. Создание таких файлов описано в разделе "Статьи".
// $PLAYER_ACTOR $PLAYER_GROUP $ONMISSION
{$CLEO}
0000:
while true //1
wait 0
if //2
player.Defined(0)
then
if and //3
not actor.Dead($PLAYER_ACTOR)
not actor.Driving($PLAYER_ACTOR)
0ADC: test_cheat "PANEL"
then
player.CanMove(0,0)
08D4: 0@ = create_panel_with_title 'PNL1' position 250.0 170.0 width 70.0 columns 2 interactive 1 background 1 alignment 1
08DB: set_panel 0@ column 0 header 'DUMMY' data 'PNL2' 'PNL3' 'PNL4' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
08D6: set_panel 0@ column 1 alignment 1 //0 - Center, 1 - Left, 2 - Right
08EE: set_panel 0@ column 1 row 0 text_1number GXT 'DOLLAR' number 700
08EE: set_panel 0@ column 1 row 1 text_1number GXT 'DOLLAR' number 750
08EE: set_panel 0@ column 1 row 2 text_1number GXT 'DOLLAR' number 1200
while true //4
wait 0
if or //5
actor.Dead($PLAYER_ACTOR)
0741: actor $PLAYER_ACTOR busted
00E1: player 0 pressed_key 15
then
break
else
if //6
00E1: player 0 pressed_key 16
then
08D7: 1@ = panel 0@ active_row
gosub @Give
end //6
end //5
end //4
08DA: remove_panel 0@
player.CanMove(0,1)
end //3
end //2
end //1
:Give //3@ - Model, 4@ - Weapon ID, 5@ - Ammo, 6@ - Cost
if
1@ == 0 //AK47
then
3@ = #AK47
4@ = 30
5@ = 120
6@ = 700
else
if
1@ == 1 //M4
then
3@ = #M4
4@ = 31
5@ = 120
6@ = 750
else
3@ = #SNIPER
4@ = 34
5@ = 25
6@ = 1200
end
end
2@ = player.Money(0)
if
002D: 2@ >= 6@ // (int)
then
6@ *= -1
model.Load(3@)
038B: load_requested_models
actor.GiveWeaponAndAmmo($PLAYER_ACTOR,4@,5@)
model.Destroy(3@)
player.Money(0) += 6@
else
03E5: show_text_box 'PNL5'
end
wait 300
return
Содержимое .fxt файла:
PNL1 Weapon
PNL2 AK47
PNL3 M4
PNL4 Sniper
PNL5 You don't have enough money
Комментариев нет:
Отправить комментарий