3B00DG4MER Posted August 12, 2014 Share Posted August 12, 2014 Hi Guys, i'm Making a gamemode which it's RPG ....... i've problem onClientPlayerQuit i tried to make if player Quit then Save the Last position With Mysql here is Client: function playerQuit() local PosX,PosY,PosZ = getElementPosition(source) triggerServerEvent("onClientLogout", localPlayer,PosX,PosY,PosZ) end addEventHandler("onClientPlayerQuit", getRootElement(),playerQuit) and Here is Server: function quitPlayer( PosX,PosY,PosZ ) local id = getElementData(source,"id") local query = dbExec(connection, "UPDATE `??` SET `??` = '??' AND `??` = '??' AND `??` = '??' WHERE `??` = '??' LIMIT 1","accounts","PosX",PosX,"PosY",PosY,"PosZ",PosZ,"id",id) end addEvent("onClientLogout",true) addEventHandler ( "onClientLogout", getRootElement(), quitPlayer ) Link to comment
3B00DG4MER Posted August 12, 2014 Author Share Posted August 12, 2014 And whats the problem? it's don't update !!!!!!!!!!!! and there is nothing in debugscript, that's the problem !!!!! Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 local id = getElementData(source,"id") The player left, so you can't do this. Link to comment
3B00DG4MER Posted August 12, 2014 Author Share Posted August 12, 2014 local id = getElementData(source,"id") The player left, so you can't do this. i used this on another fuction setElementData(source,"id",row['id']) so what i can do ??? Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 Do that code (getElementData) in the 'playerQuit' function and send it withing the trigger. Link to comment
3B00DG4MER Posted August 12, 2014 Author Share Posted August 12, 2014 Do that code (getElementData) in the 'playerQuit' function and send it withing the trigger. i tried dat client: function playerQuit() local id = getElementData(source,"id") local PosX,PosY,PosZ = getElementPosition(source) triggerServerEvent("onUserLogout", source,PosX,PosY,PosZ,id) end addEventHandler("onClientPlayerQuit", getRootElement(),playerQuit) server: function quitPlayer( PosX,PosY,PosZ,id ) local query = dbExec(connection, "UPDATE `??` SET `??` = '??' AND `??` = '??' AND `??` = '??' WHERE `??` = '??' LIMIT 1","accounts","PosX",PosX,"PosY",PosY,"PosZ",PosZ,"id",id) end addEvent("onUserLogout",true) addEventHandler ( "onUserLogout", getRootElement(), quitPlayer ) Link to comment
Et-win Posted August 12, 2014 Share Posted August 12, 2014 Then or: It can't or: It's server-side, but I don't know what since I have no idea how db-codes work yet. Link to comment
3B00DG4MER Posted August 12, 2014 Author Share Posted August 12, 2014 Ty For ur HElp i fixed it i was problem with DB codes i used 'AND' instead ',' 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