John_Scott Posted December 7, 2013 Share Posted December 7, 2013 Hi! I write a script to MTA DayZ, when the admin hit the marker, the skin was changed, food and drink was filed up, but only work the first function in the script: local skinMarker = createMarker ( -1485, 2631.3999023438, 57.799999237061, "cylinder", 1, 252, 252, 252, 30 ) local foodMarker = createMarker ( -1477.500488281, 2642.3999023438, 57.599998474121, "cylinder", 1, 0, 107, 255, 30 ) local drinkMarker = createMarker ( -1477.500488281, 2641.08, 57.599998474121, "cylinder", 1, 0, 107, 255, 30 ) function skinMarkerHit( playersource ) local accName = getAccountName ( getPlayerAccount ( playersource ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) or aclGetGroup ( "SuperModerator" )) then setElementData(playersource, "skin", "217") --Skin beállítása outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Felvetted a munkaruhát.", playersource, 255, 255, 255, true) else outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Nem vagy admin", playersource, 255, 255, 255, true) end end function foodMarkerHit( playersource ) local accName = getAccountName ( getPlayerAccount ( playersource ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) or aclGetGroup ( "SuperModerator" )) then setElementData(playersource, "food", "1000") --Étel feltöltése outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Kivettél egy csokit.", playersource, 255, 255, 255, true) else outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Nem vagy admin", playersource, 255, 255, 255, true) end end function drinkMarkerHit( playersource ) local accName = getAccountName ( getPlayerAccount ( playersource ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) or aclGetGroup ( "SuperModerator" )) then setElementData(playersource, "drink", "1000") --Ital feltöltése outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Kivettél egy jéghideg üdítőt", playersource, 255, 255, 255, true) else outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Nem vagy admin", playersource, 255, 255, 255, true) end end addEventHandler( "onMarkerHit", skinMarker, skinMarkerHit ) addEventHandler( "onMarkerHit", foodMarker, foodMarkerHit ) addEventHandler( "onMarkerHit", drinkMarker, drinkMarkerHit ) Link to comment
TrapLord Studios™ Posted December 7, 2013 Share Posted December 7, 2013 Try this : local skinMarker = createMarker ( -1485, 2631.3999023438, 57.799999237061, "cylinder", 1, 252, 252, 252, 30 ) local foodMarker = createMarker ( -1477.500488281, 2642.3999023438, 57.599998474121, "cylinder", 1, 0, 107, 255, 30 ) local drinkMarker = createMarker ( -1477.500488281, 2641.08, 57.599998474121, "cylinder", 1, 0, 107, 255, 30 ) function skinMarkerHit( playersource ) local accName = getAccountName ( getPlayerAccount ( playersource ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) or aclGetGroup ( "SuperModerator" )) then setElementData(playersource, "skin", "217") --Skin beállítása outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Felvetted a munkaruhát.", playersource, 255, 255, 255, true) else outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Nem vagy admin", playersource, 255, 255, 255, true) end end function foodMarkerHit( playersource ) local accName = getAccountName ( getPlayerAccount ( playersource ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) or aclGetGroup ( "SuperModerator" )) then setElementHealth (player,getElementHealth (player) 100) --Étel feltöltése outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Kivettél egy csokit.", playersource, 255, 255, 255, true) else outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #0489B1Nem vagy admin", playersource, 255, 255, 255, true) end end function drinkMarkerHit( playersource ) local accName = getAccountName ( getPlayerAccount ( playersource ) ) Link to comment
John_Scott Posted December 7, 2013 Author Share Posted December 7, 2013 You code's end is lost Link to comment
TrapLord Studios™ Posted December 7, 2013 Share Posted December 7, 2013 I only replaced setElementData(playersource, "food", "1000") with setElementHealth (player,getElementHealth (player) 100) Link to comment
John_Scott Posted December 7, 2013 Author Share Posted December 7, 2013 No, not this is the problem, the script not perceive when i go to marker Link to comment
TrapLord Studios™ Posted December 7, 2013 Share Posted December 7, 2013 I see, you have to add the Event - So that it triggers, your function. onMarkerHit Link to comment
John_Scott Posted December 7, 2013 Author Share Posted December 7, 2013 I see, you have to add the Event - So that it triggers, your function. onMarkerHit Sorry, i don't understand Link to comment
TrapLord Studios™ Posted December 7, 2013 Share Posted December 7, 2013 IN order for your function to work it needs to be triggered - So you need to add the event - onMarkerHit Link to comment
John_Scott Posted December 7, 2013 Author Share Posted December 7, 2013 IN order for your function to work it needs to be triggered - So you need to add the event - onMarkerHit Witch event? Where? Link to comment
TrapLord Studios™ Posted December 7, 2013 Share Posted December 7, 2013 The event where, the player's food level is restored. 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