Meshare Posted February 20, 2013 Posted February 20, 2013 hi all Please fix error -- server: function resourceStart () executeSQLCreateTable("E", "ma STRING") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStart) addEvent("N1",true) addEventHandler("N1",getRootElement(), function() local getData = executeSQLQuery("SELECT * FROM E WHERE ma = '"..getPlayerName(source).."'") triggerClientEvent(source, "B", root, getData) end ) -- client: addEventHandler("onClientGUIClick",root, function() if ( source == button ) then triggerServerEvent("N1",getLocalPlayer()) end end ) addEvent("B",true) addEventHandler("B",root, function(data_) local row = guiGridListAddRow(List) for v=1,#getData do guiGridListSetItemText(List, row, 1, getData[v].ma, false, false) end end )
tosfera Posted February 20, 2013 Posted February 20, 2013 Just a quick reply for now; I would use executeSQLQuery Okee so if you post me your errors I'll take a look.
tosfera Posted February 20, 2013 Posted February 20, 2013 If you're not posting your errors, then how can I fix them?
Meshare Posted February 20, 2013 Author Posted February 20, 2013 Error : attempt to get length of global 'getData' (a nil value)
tosfera Posted February 20, 2013 Posted February 20, 2013 Error : attempt to get length of global 'getData' (a nil value) a nil value -> doesn't exist. So, you should give the getData to the client function as a parameter.
Meshare Posted February 20, 2013 Author Posted February 20, 2013 me give give the getData ! see line 14 i want if press button then add player name in list and save name player in list
Scripting Moderators Sarrum Posted February 20, 2013 Scripting Moderators Posted February 20, 2013 Replace 'getData' to 'data_' in client-side.
Meshare Posted February 20, 2013 Author Posted February 20, 2013 ok change addEvent("B",true) addEventHandler("B",root, function(getData) local row = guiGridListAddRow(List) for v=1,#getData do guiGridListSetItemText(List, row, 1, getData[v].ma, false, false) end end ) None Error in debugscript 3 and Has not added the name in the list
TAPL Posted February 20, 2013 Posted February 20, 2013 If you haven't insert any data, you won't have any data to get it, And i don't see where you have insert the data.
Meshare Posted February 20, 2013 Author Posted February 20, 2013 function resourceStart () executeSQLCreateTable("E", "ma STRING") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStart) addEvent("N1",true) addEventHandler("N1",getRootElement(), function() setElementData(root,"NamePl",getPlayerName(source)) executeSQLInsert( "E", "'".. getElementData(root,"NamePl") .."'" ) local getData = executeSQLQuery("SELECT * FROM E WHERE ma = '"..getElementData(root,"NamePl").."'") triggerClientEvent(source, "B", root, getData) end ) Thank now been added to the name of the player to the list Error : Do Be if restart script - remove name ! i wnat if restart script dont remove name .
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