aintaro Posted May 12, 2014 Share Posted May 12, 2014 Hello guys, I want a player to be teleported back to he's original spot when he disconnects from the server but it doesn't work, here is my code: server side : function loggedOut() triggerClientEvent("closeTuneInterface", root, closeTuneInterface) end addEventHandler("onPlayerLogout",getRootElement(),loggedOut) client side part: function closeTuneInterface() if (isPedInVehicle(getLocalPlayer())) then local vehicle = getPedOccupiedVehicle ( getLocalPlayer()) setElementPosition(vehicle, 1910, -1758 , 14 ) setElementFrozen ( vehicle, false ) setCameraTarget(getLocalPlayer()) setCameraTarget ( getLocalPlayer() ) setHideWorldInterface(false) if (GUIEditor.window[1]) then givePlayerInput(false) destroyElement ( GUIEditor.window[1] ) GUIEditor.window[1] = nil end if (GUIEditor.window[2]) then destroyElement ( GUIEditor.window[2] ) GUIEditor.window[2] = nil end else setElementPosition(getLocalPlayer(), 1910, -1758 , 14 ) setCameraTarget(getLocalPlayer()) setCameraTarget ( getLocalPlayer() ) end end addEvent("closeTuneInterface", true) addEventHandler("closeTuneInterface", root, closeTuneInterface) Link to comment
#RooTs Posted May 12, 2014 Share Posted May 12, 2014 Use the Save-sistem https://community.multitheftauto.com/ind ... ls&id=3940 Link to comment
Anubhav Posted May 13, 2014 Share Posted May 13, 2014 Server : function closeTuneInterface() if (isPedInVehicle(getLocalPlayer())) then local vehicle = getPedOccupiedVehicle ( getLocalPlayer()) setElementPosition(vehicle, 1910, -1758 , 14 ) setElementFrozen ( vehicle, false ) setCameraTarget(getLocalPlayer()) setCameraTarget ( getLocalPlayer() ) setHideWorldInterface(false) if (GUIEditor.window[1]) then givePlayerInput(false) destroyElement ( GUIEditor.window[1] ) GUIEditor.window[1] = nil end if (GUIEditor.window[2]) then destroyElement ( GUIEditor.window[2] ) GUIEditor.window[2] = nil end else setElementPosition(getLocalPlayer(), 1910, -1758 , 14 ) setCameraTarget(getLocalPlayer()) setCameraTarget ( getLocalPlayer() ) end end addEvent("closeTuneInterface", true) addEventHandler("closeTuneInterface", source, closeTuneInterface) Client:: function loggedOut() local logout = addEventHandler("onPlayerLogout",getRootElement(),closeTuneInterface) triggerClientEvent("closeTuneInterface", source, logout) end 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