Wojak Posted January 16, 2010 Share Posted January 16, 2010 I wanted to use markers as sensors for peds, but when I hit the attached markers nothing happens (MTA dos not detect it) Hitting the markers that aren’t attached triggers the function… My question is: Is this normal? If MTA cant detect hitting attached markers, I will try to find a nether way (the script is server side ) Link to comment
Wojak Posted January 16, 2010 Author Share Posted January 16, 2010 I wanted to use markers as sensors for peds, but when I hit the attached markers nothing happens (MTA dos not detect it) Hitting the markers that aren’t attached triggers the function… My question is: Is this normal? If MTA cant detect hitting attached markers, I will try to find a nether way (the script is server side ) Link to comment
robhol Posted January 16, 2010 Share Posted January 16, 2010 Post your script. If it's not in English, translate it. We're not psychic, you know. Link to comment
robhol Posted January 16, 2010 Share Posted January 16, 2010 Post your script. If it's not in English, translate it. We're not psychic, you know. Link to comment
Wojak Posted January 17, 2010 Author Share Posted January 17, 2010 I’ve performed some more tests and my conclusions are: -Server can attach the graphical part of the marker to a mowing element -But it can not attach the markers colshape to that element (it stays in its original creation position) -You can not hit a marker, that is within a marker (not 100% sure) and that makes it useless for my purposes... Post your script. If it's not in English, translate it. We're not psychic, you know. You didn’t need it to answer my question… Link to comment
Wojak Posted January 17, 2010 Author Share Posted January 17, 2010 I’ve performed some more tests and my conclusions are: -Server can attach the graphical part of the marker to a mowing element -But it can not attach the markers colshape to that element (it stays in its original creation position) -You can not hit a marker, that is within a marker (not 100% sure) and that makes it useless for my purposes... Post your script. If it's not in English, translate it. We're not psychic, you know. You didn’t need it to answer my question… Link to comment
robhol Posted January 17, 2010 Share Posted January 17, 2010 What's the point in creating a topic here and then refusing to provide information we need in order to help you? Just wondering. Link to comment
robhol Posted January 17, 2010 Share Posted January 17, 2010 What's the point in creating a topic here and then refusing to provide information we need in order to help you? Just wondering. Link to comment
50p Posted January 17, 2010 Share Posted January 17, 2010 What's the point in creating a topic here and then refusing to provide information we need in order to help you? Just wondering. ...You didn’t need it to answer my question… Link to comment
50p Posted January 17, 2010 Share Posted January 17, 2010 What's the point in creating a topic here and then refusing to provide information we need in order to help you? Just wondering. ...You didn’t need it to answer my question… Link to comment
Wojak Posted January 17, 2010 Author Share Posted January 17, 2010 Although it dos not mater, while the markers are useless, and I have to rewrite the whole thing, but I want to know, why the parameters in 'isElementWithinMarker' are invalid? (line 34 and 38) I’ve passed the data incorrectly or what? local panicped1 = createPed (79, 1601, -2620, 14 ) local panicSrange1 = createMarker(1601, -2620, 20,"cylinder",4,255,255,255,100) setElementID(panicSrange1,"shotrpanic1") local panicLrange1 = createMarker(1601, -2620, 20,"cylinder",50,255,255,255,100) setElementID(panicLrange1,"longpanic1") attachElements(panicSrange1,panicped1) attachElements( panicLrange1,panicped1) addEventHandler("onMarkerHit", getRootElement(), function(hitElement, matchingDimension) outputChatBox("hit" ) if getElementType( hitElement ) == "vehicle" then outputChatBox("veh" ) if getVehicleOccupant(hitElement) then outputChatBox("player" ) local markername = getElementID(source) local a,dontneded1 = string.find(markername, "longpanic") local b,dontneded2 = string.find(markername, "shotrpanic") if a then local panicped = getElementAttachedTo(source) if (getElementData(panicped, "pedTarget") == "non") and (getElementData(panicped, "pedStatus") == "live" ) then setElementData ( panicped, "pedTarget", "veh" ) dontWantBeDed(panicped, source, hitElement) end end if b then local panicped = getElementAttachedTo(source) if getElementData(panicped, "pedStatus") == "live" then setElementData ( aped, "pedStatus", "ded" ) dedAndBust(panicped, source, hitElement) end end end end end) function dontWantBeDed(thePed, theMarker, theVehicle) if (getElementData(thePed, "pedTarget") == "veh") and (getElementData(thePed, "pedStatus") == "live") and (isElementWithinMarker(theVehicle,theMarker)) then setPedAnimation ( thePed, "PED", "sprint_panic", -1, true, true, true) setTimer ( dontWantBeDed, 2000, 1, thePed ) elseif (getElementData(thePed, "pedTarget") == "veh") and (isElementWithinMarker(theVehicle,theMarker) == false) then setElementData ( thePed, "pedTarget", "non" ) doWotYouWant(thePed) end end function dedAndBust(thePed, theMarker, theVehicle) setPedAnimation ( thePed, "PED", "FALL_land", -1, false, true, true) setTimer (function() setElementHealth ( thePed, 100 ) setPedAnimation ( thePed, "PED", "getup_front", -1, false, true, true) setElementData ( aped, "pedStatus", "live" ) doWotYouWant(thePed) end, 5000, 1) end function doWotYouWant(thePed) if ( getElementData ( thePed, "pedStatus" ) == "live" ) and ( getElementData ( thePed, "pedTarget" ) == "non" ) then local rdmangle = math.random( 1, 359 ) setPedRotation( thePed, rdmangle ) setPedAnimation ( thePed, "PED", "WALK_gang1", -1, true, true, true) setTimer ( doWotYouWant, 8000, 1, thePed ) end end function startthisthing() local allpeds = getElementsByType ( "ped" ) for pedkey, aped in ipairs(allpeds) do setElementData ( aped, "pedTarget", "non" ) setElementData ( aped, "pedStatus", "live" ) setTimer(doWotYouWant, 1000, 1, aped) end end addEventHandler("onResourceStart", getRootElement(), startthisthing) Everything else works except: -Server can attach the graphical part of the marker to a mowing element-But it can not attach the markers colshape to that element (it stays in its original creation position) -You can not hit a marker, that is within a marker (not 100% sure) [edit] I’ve forgot passing the data at line 37 I hope that if someone will have the same problem, will use the search option Link to comment
Wojak Posted January 17, 2010 Author Share Posted January 17, 2010 Although it dos not mater, while the markers are useless, and I have to rewrite the whole thing, but I want to know, why the parameters in 'isElementWithinMarker' are invalid? (line 34 and 38) I’ve passed the data incorrectly or what? local panicped1 = createPed (79, 1601, -2620, 14 ) local panicSrange1 = createMarker(1601, -2620, 20,"cylinder",4,255,255,255,100) setElementID(panicSrange1,"shotrpanic1") local panicLrange1 = createMarker(1601, -2620, 20,"cylinder",50,255,255,255,100) setElementID(panicLrange1,"longpanic1") attachElements(panicSrange1,panicped1) attachElements( panicLrange1,panicped1) addEventHandler("onMarkerHit", getRootElement(), function(hitElement, matchingDimension) outputChatBox("hit" ) if getElementType( hitElement ) == "vehicle" then outputChatBox("veh" ) if getVehicleOccupant(hitElement) then outputChatBox("player" ) local markername = getElementID(source) local a,dontneded1 = string.find(markername, "longpanic") local b,dontneded2 = string.find(markername, "shotrpanic") if a then local panicped = getElementAttachedTo(source) if (getElementData(panicped, "pedTarget") == "non") and (getElementData(panicped, "pedStatus") == "live" ) then setElementData ( panicped, "pedTarget", "veh" ) dontWantBeDed(panicped, source, hitElement) end end if b then local panicped = getElementAttachedTo(source) if getElementData(panicped, "pedStatus") == "live" then setElementData ( aped, "pedStatus", "ded" ) dedAndBust(panicped, source, hitElement) end end end end end) function dontWantBeDed(thePed, theMarker, theVehicle) if (getElementData(thePed, "pedTarget") == "veh") and (getElementData(thePed, "pedStatus") == "live") and (isElementWithinMarker(theVehicle,theMarker)) then setPedAnimation ( thePed, "PED", "sprint_panic", -1, true, true, true) setTimer ( dontWantBeDed, 2000, 1, thePed ) elseif (getElementData(thePed, "pedTarget") == "veh") and (isElementWithinMarker(theVehicle,theMarker) == false) then setElementData ( thePed, "pedTarget", "non" ) doWotYouWant(thePed) end end function dedAndBust(thePed, theMarker, theVehicle) setPedAnimation ( thePed, "PED", "FALL_land", -1, false, true, true) setTimer (function() setElementHealth ( thePed, 100 ) setPedAnimation ( thePed, "PED", "getup_front", -1, false, true, true) setElementData ( aped, "pedStatus", "live" ) doWotYouWant(thePed) end, 5000, 1) end function doWotYouWant(thePed) if ( getElementData ( thePed, "pedStatus" ) == "live" ) and ( getElementData ( thePed, "pedTarget" ) == "non" ) then local rdmangle = math.random( 1, 359 ) setPedRotation( thePed, rdmangle ) setPedAnimation ( thePed, "PED", "WALK_gang1", -1, true, true, true) setTimer ( doWotYouWant, 8000, 1, thePed ) end end function startthisthing() local allpeds = getElementsByType ( "ped" ) for pedkey, aped in ipairs(allpeds) do setElementData ( aped, "pedTarget", "non" ) setElementData ( aped, "pedStatus", "live" ) setTimer(doWotYouWant, 1000, 1, aped) end end addEventHandler("onResourceStart", getRootElement(), startthisthing) Everything else works except: -Server can attach the graphical part of the marker to a mowing element-But it can not attach the markers colshape to that element (it stays in its original creation position) -You can not hit a marker, that is within a marker (not 100% sure) [edit] I’ve forgot passing the data at line 37 I hope that if someone will have the same problem, will use the search option 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