Log in to reply
 

[SOLVED] Need Help on Int Calcul (Checkbox)



  • Hi everyone, my first mods is pending approval on 5 mods , it'll be realesed soon. (Car Shop)

    Anyway, I'm actually coding a new mods "Gang Ped Menu" and in the sub menu "Buy Guns" i'm having some big problem lol.
    Where any help will be really appreciated and could make me save a lot of time so maybe i could sleep a bit lol :P
    To summaries I'm making a sub menu where you have to check(box) which gun you want buy and after that valid your order with a standard button named Valid.
    But i need some logic in it so i made 2 int for each buyable gun checkbox 1 for gun yes/no one for the Cost.
    They are called as pistol/bpistol pistol2/bpistol2 spistol/bspistol etc..
    Those are check in Valid button activation whit =
    if (pistol.Checked) { int pistol = 1; bpistol = 25000; }
    else { int pistol = 0; bpistol = 0; }
    When it's done for each , Then
    I summaries them in 2 int called -bnum and -bcost
    by doing (always in valid button activation)=
    bnum = pistol + pistol2 + spistol (+ etc..)
    bcost = bpistol + bpistol2 + bspistol (+ etc..)

    Whith it in theory i could do a few logic to launch or not the order and a total cost to take on playermoney

    So i'm doing
    if (bnum == 0) {UI.Notify("You have to check what you want ordering"); }
    if (bnum >= 3) {UI.Notify("You can't order more than 2 weapon at the same time");}
    if (bnum <= 2)if(bnum > 0)
    {
    if (bcost > Game.Player.Money){ UI.Notify("You need more money to do this"); }

                if (bcost < Game.Player.Money)
                { UI.Notify("That works")
    			}
    

    But has I sayed it's not as easy as I thinked :
    The bnum is not calculating properly i'm having only "You have to check what you want ordering" and "You can't order more than 2 weapon at the same time"
    I've seen that at the start of the game when no checkbox are checked it is working propely showing "You have to check what you want ordering" but
    when I check one or two of them unlogicly it show "You have to check what you want ordering"
    and when I check more then 2 of them logicly it show "You can't order more than 2 weapon at the same time"

    So I havn't find a way to do it properly i've also tried to put - if (xxxx.Checked) and - bnum/bcost claculation in onTick to do it always but it doesn't work too
    I also tried spliting like in valid button activation: bnum/bcost calcul and in onTick : - if (xxxx.Checked)
    I tried the last reversed too but still not working.

    I Actually have no more idea on how to do it, So i'm taking any purpose even if it makeme change the whole code.
    Any help will be really really appreciated acutally !
    I should have spend somethinglike 12/14h on trying solving it lol.
    Thanks in advance !



  • @Kangouroux6 Are you using NativeUI or LemonUI for your menus?



  • Hi , sorry i miss this informations, i'm using lemon ui. But if needed i Can Switch ;) thanks for answering !





  • Ok so will re-post it on this discord !
    Thanks a lot for answering :)



  • Solved with the help of PiertoKaro99 Thanks a lot , here is the solution > https://discordapp.com/channels/695392892302262441/695631421917888523/885942553378164766
    To maybe help someone before closing for solved, Here is my error, I was doing everthing in private/Static so the values changed wasn't possible to acces. So with suppressing them allow me to get an Int value from a checkBox State, Just put the If(MyCheckBox = true) { do xx }else{ do xx} in the MyCheckBox_Activated Methods ! I Hope it will help !


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.