ertlflorian1 Posted January 12, 2013 Posted January 12, 2013 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)
Castillo Posted January 12, 2013 Posted January 12, 2013 Why it doesn't work? any errors? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted January 12, 2013 Posted January 12, 2013 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. Education is the most powerful weapon which you can use to change the world.
ertlflorian1 Posted January 12, 2013 Author Posted January 12, 2013 Error: [21:00:24] ERROR: Parkhaus\scripts\server2.lua:46: attempt to index field '?' (a nil value)
Castillo Posted January 12, 2013 Posted January 12, 2013 Which line is that? because that script only has 20 lines. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
ertlflorian1 Posted January 12, 2013 Author Posted January 12, 2013 This line if ( result [ 1 ] [ "Wert" ] == "1" ) then
Castillo Posted January 12, 2013 Posted January 12, 2013 Try copying it again. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
ertlflorian1 Posted January 12, 2013 Author Posted January 12, 2013 I have tried it the it works at triggerClientEvent but not on the outputChatBox and eschrankefunc?
Castillo Posted January 12, 2013 Posted January 12, 2013 Is "Wert" data set to "1"? also, seems like "result" is not returning what it should. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted January 12, 2013 Posted January 12, 2013 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. Education is the most powerful weapon which you can use to change the world.
ertlflorian1 Posted January 12, 2013 Author Posted January 12, 2013 If "Wert" == "1" triggerClientEvent conducted and it output Rows : 1 If no entery then it only output Rows : 0
ertlflorian1 Posted January 14, 2013 Author Posted January 14, 2013 Please help me sorry for double post
MR.S3D Posted January 16, 2013 Posted January 16, 2013 Please what???? Welcom to my server Q.5 Current game type in my server Drift my Email : [email protected] Programming level: 90%
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now