Jump to content

Triggering to server problem


Karuzo

Recommended Posts

Posted

Hey Guys,

I've started to make my userpanel but i just got a problem with the triggering .

I just want to trigger the selected item from my gridlist(it's a dx gridlist)

It outputs me "Triggered" but it just doesn't do the code after the outputChatBox, i dunno why.

Could you help me out please?

Here's my server-side file :

    addEvent("Fun_Shop",true) 
     
    function Fun_Shop_s(resgrid) 
    outputChatBox("Triggered") 
    local username = getElementData ( source, "username" ) 
    local   query = dbQuery(connect, "SELECT * FROM wcf1_user WHERE username = '"..username.."'") 
    local   result = dbPoll(query, -1) 
    local datas = result[1] 
            local rainbow = datas["rainbow"] 
            local money = datas["money"] 
            if rainbow == 1 then 
                outputChatBox("Du besitzt dieses Item bereits!",source, 125,0,0,false) 
            elseif rainbow == nil then 
                if money > 200000 then 
                    money = datas.money - 200000 
                    dbExec(connect,"UPDATE wcf1_user SET rainbow=?,money=? WHERE username=?",1,money,name) 
                    setElementData(source,"rainbow",1) 
                else 
                    outputChatBox("Du hast nicht genügend Geld!(200,000$)",source,125,0,0,false) 
                end 
            end 
    end 
    addEventHandler("Fun_Shop",root,Fun_Shop_s) 

And the client-side part:

    addEventHandler("onClientGUIClick", f_g_btn, 
        function() 
                if resgrid == nil then 
                    outputChatBox("Bitte wähle etwas aus!") 
                elseif resgrid then 
                    triggerServerEvent( "Fun_Shop" ,localPlayer, tostring( resgrid ) ) 
                end      
        end) 

btw , no debug errors.

Posted

So insert outputs after every line, find out exactly where it stops working. This is how you're best off to do debugging when MTA fails to catch the error for you.

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...