Zokan Posted January 15, 2012 Share Posted January 15, 2012 You can start or stop a resource if you go into a marker? MFG Zokan Link to comment
Thelastride Posted January 15, 2012 Share Posted January 15, 2012 Find on mta community.This section is for help with code.We can't give you whole code Link to comment
mjau Posted January 15, 2012 Share Posted January 15, 2012 he asked if he can do it and as far as i know yes startResource stopResource createMarker Event_: onMarkerHit Link to comment
Zokan Posted January 15, 2012 Author Share Posted January 15, 2012 I have it so, but it does not work marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) function startTheResource ( thePlayer, command, resourceName ) if ( mil_protection ) then local resource = getResourceFromName ( resourceName ) local start = startResource ( mil_protection ) end end addEventHandler ( "onMarkerHit", marker, startTheResource ) Link to comment
Thelastride Posted January 15, 2012 Share Posted January 15, 2012 I have it so, but it does not work Its completely wrong.You mixing onResourceStart arguments with onMarkerHit. What resouce you want to start.If its just one then marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) function startTheResource () resourceName = "mil_protection" local resource = getResourceFromName ( resourceName ) local start = startResource ( resource ) end addEventHandler ( "onMarkerHit", marker, startTheResource ) Link to comment
Zokan Posted January 16, 2012 Author Share Posted January 16, 2012 I've tried it so. Please corrected me when something is wrong'm still new and do not understand how true ... Script: marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) toxogletb = 0 function tooglelstart( pla ) if getElementType ( pla ) == "player" then if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then if (toxogletb == 0) then if ( mil_protection ) then local resource = getResourceFromName ( mil_protection ) local start = startResource ( mil_protection ) elseif (toxogletb == 1) then stopResource(mil_protection) end end end end addEventHandler ("onMarkerHit", marker, tooglelstart) Link to comment
FatalTerror Posted January 16, 2012 Share Posted January 16, 2012 Like that? marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) toxogletb = 0 addEventHandler("onMarkerHit", getRootElement(), function(markerHit) local resource = getResoruceFromName("mil_protection") -- Resource to stop if(source == marker)then if (getElementType(markerHit) == "player")then if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(markerHit)), aclGetGroup ( "Admin" ) ) then if (toxogletb == 0) then startResource (resource) elseif (toxogletb == 1) then stopResource (resource) end end end end end) Link to comment
Zokan Posted January 16, 2012 Author Share Posted January 16, 2012 No it not work it come an error message: ERROR: test/test:28: attempt to ca ll global 'getResoruceFromName' (a nil value) Link to comment
FatalTerror Posted January 16, 2012 Share Posted January 16, 2012 No it not work it come an error message:ERROR: test/test:28: attempt to ca ll global 'getResoruceFromName' (a nil value) Epic fail... Sorry Remplace "getResoruceFromName" per "getResourceFromName" marker = createMarker (222, -1956, 1, "cylinder", 1.5, 38, 255, 0, 255, getRootElement()) toxogletb = 0 addEventHandler("onMarkerHit", getRootElement(), function(markerHit) local resource = getResourceFromName("mil_protection") -- Resource to stop if(source == marker)then if (getElementType(markerHit) == "player")then if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(markerHit)), aclGetGroup ( "Admin" ) ) then if (toxogletb == 0) then startResource (resource) elseif (toxogletb == 1) then stopResource (resource) end end end end end) Link to comment
Zokan Posted January 16, 2012 Author Share Posted January 16, 2012 now come an error message: WARNING: test/test.lua:28: Access denied @ 'startResource' Link to comment
FatalTerror Posted January 16, 2012 Share Posted January 16, 2012 The ressource must have admin rights. Set it on ACL https://wiki.multitheftauto.com/wiki/ACL 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