Jump to content

Problem with MySQL


ertlflorian1

Recommended Posts

Hi the Script with the MYSQL part dont work please help me!!

function oncolehit (thePlayer) 
    pname = getPlayerName (thePlayer) 
        if getElementType ( thePlayer ) == "player" then 
        veh = getPedOccupiedVehicle (thePlayer) 
        seat = getPedOccupiedVehicleSeat (thePlayer) 
            if veh and (seat == 0) then 
                local qh = dbQuery( handler2, "SELECT * FROM accounts WHERE Name = '"..pname.."'" ) 
                local result, num_affected_rows, errmsg = dbPoll ( qh, -1 ) 
                for result, row in pairs(result) do 
            if row then   
            if (row["Wert"] == "1") then 
    outputChatBox ("Danke das du das Parkhaus besuchst!", thePlayer, 0,255,0) 
    eschrankefunc () 
    end 
else 
    if getElementType ( thePlayer ) == "player" then 
        if veh and (seat == 0) then 
            triggerClientEvent (thePlayer, "openGUI", thePlayer, veh, pname) 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler ("onColShapeHit", cole, oncolehit) 

Link to comment

Try this:

function oncolehit ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        local pname = getPlayerName ( thePlayer ) 
        local veh = getPedOccupiedVehicle ( thePlayer ) 
        local seat = getPedOccupiedVehicleSeat ( thePlayer ) 
        if ( veh ) and ( seat == 0 ) then 
            local qh = dbQuery ( handler2, "SELECT * FROM accounts WHERE Name = '".. pname .."'" ) 
            local result, num_affected_rows, errmsg = dbPoll ( qh, -1 ) 
            if ( result and type ( result ) == "table" and result [ 1 ] ) then 
                if ( result [ 1 ] [ "Wert" ] == "1" ) then 
                    outputChatBox ( "Danke das du das Parkhaus besuchst!", thePlayer, 0, 255, 0 ) 
                    eschrankefunc ( ) 
                else 
                    triggerClientEvent ( thePlayer, "openGUI", thePlayer, veh, pname ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", cole, oncolehit ) 

Link to comment

Try this and see what it outputs to chat:

function oncolehit ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        local pname = getPlayerName ( thePlayer ) 
        local veh = getPedOccupiedVehicle ( thePlayer ) 
        local seat = getPedOccupiedVehicleSeat ( thePlayer ) 
        if ( veh ) and ( seat == 0 ) then 
            local qh = dbQuery ( handler2, "SELECT * FROM accounts WHERE Name = '".. pname .."'" ) 
            local result, num_affected_rows, errmsg = dbPoll ( qh, -1 ) 
            outputChatBox ( "Rows: ".. tostring ( num_affected_rows ) ) 
            if ( result and type ( result ) == "table" and result [ 1 ] ) then 
                if ( result [ 1 ] [ "Wert" ] == "1" ) then 
                    outputChatBox ( "Danke das du das Parkhaus besuchst!", thePlayer, 0, 255, 0 ) 
                    eschrankefunc ( ) 
                else 
                    triggerClientEvent ( thePlayer, "openGUI", thePlayer, veh, pname ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", cole, oncolehit ) 

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