KamikazeSripterul
Well-known member
- Joined
- Jun 30, 2019
- Messages
- 353
- Reaction score
- 23
On RP servers there are certain jobs. I want to know how many people are in the jobs' vehicles. I have done this so far however it isn't working properly, i get crash as i enter the game. I am not very experienced with this type of dialog.. Anyone help?
Code:
{$CLEO}
{$INCLUDE SF}
0000:
thread "JobsBrowse"
repeat
wait 0
until SAMP.Available()
Dialog.Create(0@, "Job Cars")
Dialog.SetRECT(0@, 1470, 250, 400, 500)
Dialog.AddListBox(0@, 0, 3, 3, 390, 490)
Dialog.SetVisible(0@, 0)
0B34: "jobcars" @jobcars
WHILE TRUE
WAIT 0
FOR 10@ = 0 TO 1000 STEP 1
IF SAMP.IsPlayerConnected(10@)
THEN
IF 00DD: actor 10@ driving_car_with_model #TOWTRUCK
THEN
1@ += 1
END
IF 00DD: actor 10@ driving_car_with_model #PIZZABOY
THEN
2@ += 1
END
IF OR
00DD: actor 10@ driving_car_with_model #PETRO
00DD: actor 10@ driving_car_with_model #RDTRAIN
THEN
3@ += 1
END
IF 00DD: actor 10@ driving_car_with_model #BUS
THEN
4@ += 1
END
IF 00DD: actor 10@ driving_car_with_model #TRASH
THEN
5@ += 1
END
IF 00DD: actor 10@ driving_car_with_model #TRACTOR
THEN
6@ += 1
END
IF 00DD: actor 10@ driving_car_with_model #SPEEDER
THEN
7@ += 1
END
END
END
IF Dialog.IsVisible(0@)
THEN
alloc 11@ 100
alloc 12@ 100
alloc 13@ 100
alloc 14@ 100
alloc 15@ 100
alloc 16@ 100
alloc 17@ 100
// 11@ = Mechanic
0AD3: 11@ = format "Mechanic: %d" 1@
Dialog.ListBoxInsertElement(0@, 0, 11@, 0, -1)
// 12@ = Pizza Boy
0AD3: 12@ = format "Pizza Boy: %d" 2@
Dialog.ListBoxInsertElement(0@, 0, 12@, 1, -1)
// 13@ = Trucker
0AD3: 13@ = format "Trucker: %d" 3@
Dialog.ListBoxInsertElement(0@, 0, 13@, 2, -1)
// 14@ = Bus Driver
0AD3: 14@ = format "Bus Driver: %d" 4@
Dialog.ListBoxInsertElement(0@, 0, 14@, 3, -1)
// 15@ = Garbage Man
0AD3: 15@ = format "Garbage Man: %d" 5@
Dialog.ListBoxInsertElement(0@, 0, 15@, 4, -1)
// 16@ = Farmer
0AD3: 16@ = format "Farmer: %d" 6@
Dialog.ListBoxInsertElement(0@, 0, 16@, 5, -1)
// 17@ = Boat Transporter
0AD3: 17@ = format "Boat Transporter: %d" 7@
Dialog.ListBoxInsertElement(0@, 0, 17@, 6, -1)
free 11@
free 12@
free 13@
free 14@
free 15@
free 16@
free 17@
END
END
:jobcars
SAMP.IsCommandTyped(20@)
Dialog.SetVisible(0@, 1)
SAMP.CmdRet()