UAEpro Posted June 10, 2011 Posted June 10, 2011 (edited) FIXED Everyting الحين بيي حمودي يقول .. وش تبرمج ض1 Edited June 11, 2011 by Guest تيم سبيك بروجيمر ts3server://ts.pg.sa
Castillo Posted June 10, 2011 Posted June 10, 2011 Try with this: function addlike() local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE mapName='".. tostring(mapName) .."'") local update = result[1]["ratingLike"] +1 executeSQLUpdate ( "MapName2", "ratingLike = '".. update .."'","mapName = '" .. tostring(mapName) .. "'") end addCommandHandler ( "like", addlike ) --------------- function addunlike() local result = executeSQLQuery("SELECT ratingUnLike FROM MapName2 WHERE mapName='".. tostring(mapName) .."'") local update = result[1]["ratingUnLike"] +1 executeSQLUpdate ( "MapName2", "ratingUnLike = '".. update .."'","mapName = '" .. tostring(mapName) .. "'") end addCommandHandler ( "unlike", addunlike ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
UAEpro Posted June 10, 2011 Author Posted June 10, 2011 my Table was executeSQLCreateTable ( "MapName2","map_name TEXT,ratingLike INTEGER, ratingUnlike INTEGER" ) so i edit the line local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE mapName='".. tostring(mapName) .."'") but also i got error attempt to index field '?' ( a nil value) line 19 line 19 = local update = result[1]["ratingLike"] +1 function addlike() local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") local update = result[1]["ratingLike"] +1 executeSQLUpdate ( "MapName2", "ratingLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") end addCommandHandler ( "like", addlike ) --------------- function addunlike() local result = executeSQLQuery("SELECT ratingUnLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") local update = result[1]["ratingUnLike"] +1 executeSQLUpdate ( "MapName2", "ratingUnLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") end addCommandHandler ( "unlike", addunlike ) تيم سبيك بروجيمر ts3server://ts.pg.sa
Castillo Posted June 10, 2011 Posted June 10, 2011 function addlike() local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") local update = tonumber(result[1]["ratingLike"]) + 1 executeSQLUpdate ( "MapName2", "ratingLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") end addCommandHandler ( "like", addlike ) --------------- function addunlike() local result = executeSQLQuery("SELECT ratingUnLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") local update = tonumber(result[1]["ratingUnLike"]) + 1 executeSQLUpdate ( "MapName2", "ratingUnLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") end addCommandHandler ( "unlike", addunlike ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
UAEpro Posted June 10, 2011 Author Posted June 10, 2011 (edited) i know what is the problem result[1]["ratingLike"] i think = nil Edited June 10, 2011 by Guest تيم سبيك بروجيمر ts3server://ts.pg.sa
Castillo Posted June 10, 2011 Posted June 10, 2011 Is the table created? does the map exists in the table? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
UAEpro Posted June 10, 2011 Author Posted June 10, 2011 in line #12 outputChatBox("This map has #00FF00 ".. result[1].ratingLike .." Likes", g_Root, 225, 170, 90, true) in the chat box i sow 0 Likes ^^ and yes there is a table i edit the table and make the like 5 and i got like 5 in the chatbox so everything is ok up edit : 5 likes in all maps >.< WTF edit: now i know where the error edit FIXED Everyting تيم سبيك بروجيمر ts3server://ts.pg.sa
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