..:D&G:.. Posted February 13, 2016 Posted February 13, 2016 Hello guys, I am trying to sync the player's animation from client side to server side, but the event is not triggered... --Client function startMiningSpot(hitPlayer) if (hitPlayer == getLocalPlayer()) and (source == miningSpot) then triggerServerEvent("syncMiningAnim", resourceRoot, hitPlayer, source) outputChatBox("Message shows!") end end addEventHandler( "onClientMarkerHit", getRootElement(), startMiningSpot) --Server function syncMining(hitElement, marker) exports.global:applyAnimation(hitElement, "chainsaw", "CSAW_1", -1, true, false, false) setElementPosition(hitElement, getElementPosition(miningSpot)) setPedRotation(hitElement, getElementData(miningSpot, "msRotation")) outputChatBox("Don't show", hitElement) end addEvent("syncMiningAnim", true) addEventHandler("syncMiningAnim", getRootElement(), syncMining) I know it's kinda late for scripting but maybe I missed something? Because the message from server side doesn't show and the function doesn't give any errors... Maybe I'm too tired? Thanks. MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Bonus Posted February 13, 2016 Posted February 13, 2016 Try this function startMiningSpot(hitPlayer) if (hitPlayer == getLocalPlayer()) then triggerServerEvent("syncMiningAnim", hitPlayer, source) end end addEventHandler( "onClientMarkerHit", miningSpot, startMiningSpot) function syncMining(marker) exports.global:applyAnimation(client, "chainsaw", "CSAW_1", -1, true, false, false) setElementPosition(client, getElementPosition(marker)) setPedRotation(client, getElementData(marker, "msRotation")) outputChatBox("Don't show", client) end addEvent("syncMiningAnim", true) addEventHandler("syncMiningAnim", getRootElement(), syncMining)
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