botshara Posted August 5, 2015 Posted August 5, 2015 client-side -- HERE WILL BE SCRIPT local startJOB = createMarker ( 2208.328125, -2284.1962890625, 13.764669418335, "cylinder", 1.5, 255, 255, 0, 170 ) function startTheJob() setElementModel(getLocalPlayer(), 27) nextMarker = createMarker ( 2230.3369140625, -2283.4921875, 13.391557693481, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler ( "onClientMarkerHit", nextMarker, nextStage ) destroyElement(startJOB) end addEventHandler ( "onClientMarkerHit", startJOB, startTheJob ) What the fuck, when hit on marker then changes player clothes but the problem is that clothes changes else to players who is nearby at me. Please help to fix this script
xeon17 Posted August 5, 2015 Posted August 5, 2015 You have to check is the player who hit the marker is the local player. Try this: local startJOB = createMarker ( 2208.328125, -2284.1962890625, 13.764669418335, "cylinder", 1.5, 255, 255, 0, 170 ) function startTheJob(hitElement) if (hitElement == localPlayer) then setElementModel(localPlayer, 27) nextMarker = createMarker ( 2230.3369140625, -2283.4921875, 13.391557693481, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler ( "onClientMarkerHit", nextMarker, nextStage ) destroyElement(startJOB) end end addEventHandler ( "onClientMarkerHit", startJOB, startTheJob )
botshara Posted August 5, 2015 Author Posted August 5, 2015 You have to check is the player who hit the marker is the local player.Try this: local startJOB = createMarker ( 2208.328125, -2284.1962890625, 13.764669418335, "cylinder", 1.5, 255, 255, 0, 170 ) function startTheJob(hitElement) if (hitElement == localPlayer) then setElementModel(localPlayer, 27) nextMarker = createMarker ( 2230.3369140625, -2283.4921875, 13.391557693481, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler ( "onClientMarkerHit", nextMarker, nextStage ) destroyElement(startJOB) end end addEventHandler ( "onClientMarkerHit", startJOB, startTheJob ) Now skin changes only for me, the other players didnt see that I changed skin and I didnt see them is changed skin
xeon17 Posted August 6, 2015 Posted August 6, 2015 (edited) It's because it's made on client side and only the local player can see it. You have to create a custom event on server side to change the player's skin. This should work fine: Server: addEvent('setPlayerSkin', true) addEventHandler ('setPlayerSkin', root, function (model) if (model and tonumber(model)) then setElementModel(client,model) end end) Client: function startTheJob(hitElement) if (hitElement == localPlayer) then triggerServerEvent('setPlayerSkin',hitElement,27) nextMarker = createMarker ( 2230.3369140625, -2283.4921875, 13.391557693481, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler ( "onClientMarkerHit", nextMarker, nextStage ) destroyElement(startJOB) end end addEventHandler ( "onClientMarkerHit", startJOB, startTheJob ) Edited August 6, 2015 by Guest
DNL291 Posted August 6, 2015 Posted August 6, 2015 Change the event name "onPlayerSkin" to: "setPlayerSkin".
xeon17 Posted August 6, 2015 Posted August 6, 2015 Change the event name "onPlayerSkin" to: "setPlayerSkin". Done, thanks.
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