Dzsozi (h03) Posted March 24, 2014 Share Posted March 24, 2014 Hi guys, so I have a skin shop resource, my problem is that it doesn't contains a "Cancel" function, which is about to get your skin back, which was before you entered a marker. I hope you understand me. So I tried to make it, but it's not working. It's like when you press enter (the button which select the skin), it not gets your skin back. I would be grateful if somebody could help me in this! Thanks. local skinek = { 2, 7, 12, 13, 16, 19, 20, 21, 22, 23, 24, 25, 26, } local index = { } local skinshopmarker = createMarker ( 199.1015625, -127.908203125, 1002.4151977539, "cylinder", 1.5, 245, 140, 20, 200 ) setElementInterior(skinshopmarker, 3) setElementDimension(skinshopmarker, 128) model = getElementModel(player) function Kivalaszt ( player ) showCursor ( player, true ) bindKey ( player, "backspace", "down", MegseSkin ) bindKey ( player, "enter", "down", Spawn ) bindKey ( player, "arrow_l", "down", ValasztasSkin ) bindKey ( player, "arrow_r", "down", ValasztasSkin ) fadeCamera ( player, true ) index [ player ] = 1 setElementPosition ( player, 215.9755859375, -132.9267578125, 1003.5078125 ) setPedRotation ( player, 90 ) --setElementRotation ( palyer, 0, 0, 0 ) setElementInterior(player, 3) setElementDimension(player, 128) setElementFrozen ( player, true ) setCameraMatrix ( player, 211.48049926758, -132.75520324707, 1003.0266723633, 212.47685241699, -132.76715087891, 1003.1111450195 ) setCameraInterior( player, 3 ) end addEventHandler("onMarkerHit", skinshopmarker, Kivalaszt) function MegseSkin ( player ) setElementModel(player, model) showCursor ( player, false ) setElementPosition ( player, 207.9072265625, -132.1884765625, 1003.3125 ) setPedRotation ( player, 173 ) setElementInterior(player, 3) setElementDimension(player, 128) setElementFrozen ( player, false ) setCameraTarget ( player, player ) end function ValasztasSkin ( player, key ) if ( key == "arrow_l" ) then if ( index [ player ] == 1 ) then index [ player ] = #skinek else index [ player ] = ( index [ player ] - 1 ) end else if ( index [ player ] == #skinek ) then index [ player ] = 1 else index [ player ] = ( index [ player ] + 1 ) end end --outputChatBox ( index [ player ] ) setElementModel ( player, skinek [ index [ player ] ] ) playSoundFrontEnd ( player, 32 ) end function Spawn ( player ) showCursor ( player, false ) playSoundFrontEnd ( player, 44 ) --outputChatBox("!", player, 0, 255, 0) unbindKey ( player, "backspace", "down", MegseSkin ) unbindKey ( player, "enter", "down", Spawn ) unbindKey ( player, "arrow_l", "down", ValasztasSkin ) unbindKey ( player, "arrow_r", "down", ValasztasSkin ) setElementPosition ( player, 207.9072265625, -132.1884765625, 1003.3125 ) setPedRotation ( player, 173 ) setElementInterior(player, 3) setElementDimension(player, 128) setElementFrozen ( player, false ) setCameraTarget ( player, player ) end Link to comment
WhoAmI Posted March 24, 2014 Share Posted March 24, 2014 Just save the skin before player enters the marker by using setElementData. Link to comment
Arnold-1 Posted March 24, 2014 Share Posted March 24, 2014 store it in a variable, i mean addEventHandler("onMarkerHit",skinshopmarker, function () model = getElementModel(source) end ) function cancel (thePlayer) setElementModel(thePlayer,model) end --idk which event would you use EDIT: WhoAmI, mine is better i think Link to comment
.:HyPeX:. Posted March 24, 2014 Share Posted March 24, 2014 That would only work client-side. I'd suggest you to use an element data if server-side, as WhoAmI Said. using a global variable server side should be like this: function HitMarker(Element, Dimension) model[Element] = getElementModel(Element) end addEventHandler("onMarkerHit", getRootElement(), HitMarker) Also, source of onMarkerHit element is the marker, not the player. https://wiki.multitheftauto.com/wiki/OnMarkerHit Link to comment
Dzsozi (h03) Posted March 24, 2014 Author Share Posted March 24, 2014 That would only work client-side. I'd suggest you to use an element data if server-side, as WhoAmI Said.using a global variable server side should be like this: function HitMarker(Element, Dimension) model[Element] = getElementModel(Element) end addEventHandler("onMarkerHit", getRootElement(), HitMarker) Also, source of onMarkerHit element is the marker, not the player. https://wiki.multitheftauto.com/wiki/OnMarkerHit Okay, thank you, I'll try it tomorrow and tell you what's the result 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