xTravax Posted October 10, 2014 Share Posted October 10, 2014 i have made a resource which should work perfectly but for unknown reasons it doesnt function createPaintballEffect(hitElement,hitX,hitY,hitZ) daMarker = createMarker(hitX,hitY,hitZ,"corona",0.2,math.random(0,255),math.random(0,255),math.random(0,255),255) outputDebugString("made a marker") if getElementType(hitElement) == "player" or getElementType(hitElement) == "ped" or getElementType(hitElement) == "object" or getElementType(hitElement) == "vehicle" then attachElements(daMarker,hitElement) outputDebugString("attached elements") setTimer(destroyElement,5000,1,daMarker) else outputDebugString("wtf") return end end addEventHandler("onClientWeaponFire",root,createPaintballEffect) custom and built in debug methods dont show anything. Link to comment
xTravax Posted October 10, 2014 Author Share Posted October 10, 2014 sorry for doublepost, i have rewritten the script and got this function createPaintballEffect(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement) local daMarker = createMarker(hitX,hitY,hitZ,"corona",0.2,math.random(0,255),math.random(0,255),math.random(0,255),255) outputDebugString("made a marker") if getElementType(hitElement) == "player" or getElementType(hitElement) == "ped" or getElementType(hitElement) == "object" or getElementType(hitElement) == "vehicle" then attachElements(daMarker,hitElement) else return end setTimer(destroyElement,5000,1,daMarker) end addEventHandler("onClientPlayerWeaponFire",root,createPaintballEffect) it works fine but it outputs to debug that element is nil when i dont hit any object or vehicle or player or ped i thought ' else return end ' would prevent the debug messages? whats alternative to stop this debug warnings? also only attached markers are getting destroyed.. Link to comment
Anubhav Posted October 10, 2014 Share Posted October 10, 2014 function createPaintballEffect(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement) if hitElement then local daMarker = createMarker(hitX,hitY,hitZ,"corona",0.2,math.random(0,255),math.random(0,255),math.random(0,255),255) outputDebugString("made a marker") if getElementType(hitElement) == "player" or getElementType(hitElement) == "ped" or getElementType(hitElement) == "object" or getElementType(hitElement) == "vehicle" then attachElements(daMarker,hitElement) else return end setTimer(destroyElement,5000,1,daMarker) end end addEventHandler("onClientPlayerWeaponFire",root,createPaintballEffect) 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