Jump to content

My character information panel not working.


Drdaleslie

Recommended Posts

This is the script: 

local charName = string.gsub(pedData[selectedChar].name, "_", " ")
        local nameWidth = dxGetTextWidth(charName, 1, Roboto32B)

        local sx = 420
        local sy = 325
        local x = (screenX - sx) / 2
        local y = (screenY - sy) / 2


            dxDrawRectangle(x - 350, y, sx - 20, 350, tocolor(0, 0, 0, 100))
            y = y + 500

            dxDrawText("FearCity Roleplay", x + 50, y - 950 , sx - 20, y, tocolor(255, 255, 255), 1, JollyLodger22, "center", "center")
            y = y + 20

            

            --Cash--
                    
            local money = (getElementData(localPlayer, "char.Money") or 0)

            dxDrawText("Készpénz: "..""..money.."$", x - 335 , y - 850 , sx - 20 , y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --Money on bank--

            dxDrawText("Banki Egyenleg:  ", x - 335, y - 800 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --AccountID--This is the only one what is work:
            local accountId = getElementData(localPlayer, "acc.dbID")

            dxDrawText("Account ID: "..""..accountId, x - 335, y - 750 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --Played time--

            dxDrawText("Játszott Percek:", x - 335, y - 700 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --Premium money--

            dxDrawText("Prémium Pont egyenleg:", x  - 335 , y - 650 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")

            y = y + 20   

            --Job--

            dxDrawText("Munkád:  ", x - 335, y - 600 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20


    
        dxDrawText(charName, 0, 0, screenX, screenY - 120, tocolor(255, 255, 255), 1, Roboto32B, "center", "bottom")
        dxDrawRectangle((screenX - nameWidth) / 2, screenY - 120, nameWidth, 2, tocolor(255, 255, 255))

 

script in picture: https://imgur.com/a/VVPE4h8

script in the game: https://imgur.com/a/eFIEaRS

 

Please help me do this script.

 


 

Link to comment

The other informations are not showing because you didn't put any getElementData for them

Example:

local getJob = getElementData(localPlayer, "myJob") or "N/A"
dxDrawText("Munkád:  "..getJob.."", x - 335, y - 600 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")

 

Edited by Hydra
Link to comment

Yea i know that, but i was put to the cash/money and still not working.

This is my script now: 

 

 


            dxDrawText("FearCity Roleplay", x + 50, y - 950 , sx - 20, y, tocolor(255, 255, 255), 1, JollyLodger22, "center", "center")
            y = y + 20

            

            --Cash--
                    
            local money = getElementData(localPlayer, "char.money") or 0

            dxDrawText("Készpénz: "..""..money.."$", x - 335 , y - 850 , sx - 20 , y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --Money on bank--

            local bankmoney = getElementData(localPlayer, "char.bankMoney") or 0

            dxDrawText("Banki Egyenleg:  "..""..bankmoney.."$", x - 335, y - 800 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --AccountID--
            local accountId = getElementData(localPlayer, "acc.dbID")

            dxDrawText("Account ID: "..""..accountId, x - 335, y - 750 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --Played time--

                local minutes = getElementData(localPlayer, "char.playedMinutes") or 0

            dxDrawText("Játszott Percek: "..""..minutes.." Perc", x - 335, y - 700 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            

            --Premium money--

            local premium = getElementData(localPlayer, "acc.premium") or 0
            dxDrawText("Prémium Pont egyenleg: "..""..premium.." PP", x  - 335 , y - 650 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

            --Job--

            local job = getElementData(localPlayer, "char.Job") or "Nincs"

            dxDrawText("Munkád: "..""..job, x - 335, y - 600 , sx - 20, y, tocolor(255, 255, 255), 1, Lato, "left", "center")
            y = y + 20

 

 

 

But still only the account id work, i thought its cause the game cant show this information before login, but idk how to fix that.

char. mean in my script, the sql database, (character)

 

server side script for that:

 

                                    setElementData(player, "char.Money", data.money)
                                    setElementData(player, "char.bankMoney", data.bankMoney)
                                    setElementData(player, "char.Job", data.job)
                                    setElementData(player, "char.playedMinutes", data.playedMinutes)

I need a function to char, and a local for data maybe. But i dont know

Edited by Drdaleslie
Link to comment

With: 

                            local datas = {
                                ["money"] = getElementData(sourcePlayer, "char.Money") or 0,
                                ["bankMoney"] = getElementData(sourcePlayer, "char.bankMoney") or 0,
                                ["job"] = getElementData(sourcePlayer, "char.Job") or 0,
                                ["playedMinutes"] = getElementData(sourcePlayer, "char.playedMinutes") or 0,        
                            }

I have a error message when i am press the login button. : [ERROR] sarp_accounts/sourceS.lua:409, attempt to index global 'data' (a nil value)

Edited by Drdaleslie
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...