Jump to content

Problem with MySQL


ertlflorian1

Recommended Posts

Posted

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) 

Posted

Why it doesn't work? any errors?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Which line is that? because that script only has 20 lines.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Try copying it again.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Is "Wert" data set to "1"? also, seems like "result" is not returning what it should.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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