View previous topic :: View next topic |
Author |
Message |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Sun Oct 20, 2013 4:14 am Post subject: Combo-box Questions !! |
|
|
Hello people ! i need some help regarding combo boxes . i am working on a trainer it has many hacks in it , so i thought of making a combobox to list the hacks now my problem is i want to enable the hack in a way .. hmm lets say
i have a combo box and have 4 enteries ;- energy , life , ammo , and damage hacks and i choose life from dropdown menu and click ACTIVATE button then that hack gets activated how to connect the entery to that button ???
also my second question is how can i show description of the hack life ?
like when i choose the hack " life " from the dropbox it must show a description about it below the dropbox or somewhere in trainer !!
anyone got any idea how to do this if yes please tell me too so i can do what i want !!
thanks in advance
Regards !!
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25794 Location: The netherlands
|
Posted: Sun Oct 20, 2013 5:17 am Post subject: |
|
|
In the button click check the ItemIndex property of the combobox
-1=nothing selected
0=first item
1=second item
...
e.g:
Code: |
if myform.somecombobox.ItemIndex==0 then doEnergy() end
|
As for the description give the combobox an "OnSelect" function
When that function is called, check the itemindex of the combobox, and then set the caption of a label to the proper description
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Sun Oct 20, 2013 5:45 am Post subject: |
|
|
Sir i didnt understood what u said i tried after reading ur post but i didnt got much of it here is what i am trying to do
Code: | function ComboSpeed ()
index = combobox_getItemIndex(UDF1_CEComboBox1);
if index == -1 then return end;
if index == 0 then
speedhack_setSpeed(2.00)
elseif index == 1 then
speedhack_setSpeed(5.00)
end
end
|
now for example i have 2 enteries 1 is which sets speed hack to 2 and another which sets speed to 5 now i want to make a button which can execute them and a different description for them like for 1st entry it must b set speed 2x and second entery set speed 5x !! can u give make a small script of above example that will make me understand the thing more clearly
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25794 Location: The netherlands
|
Posted: Sun Oct 20, 2013 10:01 am Post subject: |
|
|
Here is an example that does what you wish
Check out the form's event properties and the lua code
Description: |
|
 Download |
Filename: |
example.ct |
Filesize: |
1.53 KB |
Downloaded: |
1086 Time(s) |
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Sun Oct 20, 2013 2:31 pm Post subject: |
|
|
Thanks Darkbyte your answer was helpful but i dont know why here i am facing problem i am getting acess voilations when i am setting captions
Code: | --Creates first the form
local f = createForm( true );
f.caption = [[Cloud App V1]]
f.left = 417
f.top = 105
f.width = 366
f.height = 376
f.align = 0
f.enabled = true
f.visible = true
-- Creating the objects
local g = createGroupBox( f );
g.caption = [[HACKS]]
g.left = 9
g.top = 13
g.width = 348
g.height = 196
g.align = 0
g.enabled = true
g.visible = true
local l = createListBox( f );
l.caption = [[L]]
l.left = 20
l.top = 35
l.width = 260
l.height = 156
l.align = 0
l.enabled = true
l.visible = true
local b = createButton( f );
b.caption = [[LOAD]]
b.left = 285
b.top = 135
b.width = 64
b.height = 56
b.align = 0
b.enabled = true
b.visible = true
local c = createLabel( f );
c.caption = [[DESCRIPTION :-]]
c.left = 16
c.top = 224
c.width = 85
c.height = 16
c.align = 0
c.enabled = true
c.visible = true
local d = createLabel( f );
d.caption = [[D]]
d.left = 17
d.top = 251
d.width = 49
d.height = 16
d.align = 0
d.enabled = true
d.visible = true
local s = listbox_getItems( l );
strings_add( s, 'NITRO' );
strings_add( s, 'SPEEDBRAKERS' );
strings_add( s, '....' );
strings_add( s, '....' );
function listHacks ()
index = listbox_getItemIndex(f_l);
if index == -1 then return end;
if index == 0 then
control_setCaption(f_d,'INFINITE NITRO')
elseif index == 1 then
control_setCaption(f_d,'INFINITE SPEED BRAKERS ')
end
end
setMethodProperty(f_l, "OnSelectionChange", listHacks)
|
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25794 Location: The netherlands
|
Posted: Sun Oct 20, 2013 3:04 pm Post subject: |
|
|
A combobox is not a listbox or decendant of listbox
Also, the old naming convention formname_objectname does not work on runtime generated objects. Only on form designer forms only
And because you didn't set the Name property f.l also wont work.
But since you already have a pointer to l you can just use that.
So, instead of
Code: |
index = listbox_getItemIndex(f_l);
|
Do
Code: |
index = l.itemindex
|
And the other object references need to be fixed as well
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
abhijeet1001 Advanced Cheater
Reputation: 0
Joined: 10 Apr 2013 Posts: 87
|
Posted: Mon Oct 21, 2013 11:45 am Post subject: |
|
|
Thanks darkbyte I got it to work
Just edited the reference news and made
Code: |
Index= l.getItemIndex(l)
|
|
|
Back to top |
|
 |
|