furruz Posted August 17, 2013 Share Posted August 17, 2013 I'm working on a hunger script on MTA Paradise. I want to save on SQL the value of the hunger bar when the player quits. I got the function to get the bar value but it is only Client-side. How can i pass the bar value information to the server to save it on SQL? Link to comment
furruz Posted August 18, 2013 Author Share Posted August 18, 2013 my codes: [Client] function onQuitGame( player, hambre1 ) local hambre1 = exports.hunger:getHungerState(player) triggerServerEvent ( "guardarhambre", getLocalPlayer(), hambre1 ) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) [server] function hambreHandler ( player, hambre1 ) hambre = hambre1 --setElementData(player,"hambre",hambre1) exports.sql:query_free( "UPDATE characters SET hunger = "..hambre.." WHERE characterID = " .. tonumber( getCharacterID( player ) ) ) end addEvent( "guardarhambre", true ) addEventHandler( "guardarhambre", getRootElement(), hambreHandler ) It does not save the data. No errors in log Link to comment
furruz Posted August 18, 2013 Author Share Posted August 18, 2013 im thinking about making the hunger script by my own (serverside based). The hunger script i use is workin on client. Link to comment
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