#RooTs Posted May 10, 2014 Posted May 10, 2014 (edited) I'm new to scripts, how can I create a "Pickup" that destroys 1 level of WantedLevel at a particular location on the map createPickup (1548, -1681, 13, 3, 1239, 60000 ) Can someone help me? Sorry my english... More or less like this: Edited May 10, 2014 by Guest
justn Posted May 10, 2014 Posted May 10, 2014 Well, you can use the event onPickupHit then you can use setPlayerWantedLevel
justn Posted May 10, 2014 Posted May 10, 2014 Huh ? anyways if you don't understand, then you can use this code local test = createPickup (1548, -1681, 13, 3, 1239, 60000 ) addEventHandler("onPickupHit",test, function(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) end)
#RooTs Posted May 10, 2014 Author Posted May 10, 2014 Pickup is not destroyed when Esto inside the vehicle
justn Posted May 10, 2014 Posted May 10, 2014 local test = createPickup (1548, -1681, 13, 3, 1247, 60000 ) addEventHandler("onPickupHit",test, function(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(test) end)
justn Posted May 10, 2014 Posted May 10, 2014 Try this function dede() setTimer(function() test = createPickup (1548, -1681, 13, 3, 1247, 60000 ) addEventHandler("onPickupHit",test,onHitStar) end,60000,1) end function onHitStar(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(test) removeEventHandler("onPickupHit",test,onHitStar) dede() end
justn Posted May 10, 2014 Posted May 10, 2014 (edited) This works, tested it myself. function dede() setTimer(function() test = createPickup (2720.3171386719, 2123.2409667969, 6.7327833175659, 3, 1247, 60000 ) addEventHandler("onPickupHit",test, function() setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(test) end) end,60000,0) end addEventHandler("onResourceStart",resourceRoot,dede) Edited May 12, 2014 by Guest
#RooTs Posted May 10, 2014 Author Posted May 10, 2014 META.xml type client or server ? <script src="star.lua" type="server"></script> still does not work, test on your local server give star sought https://community.multitheftauto.com/ind ... ls&id=5104
justn Posted May 10, 2014 Posted May 10, 2014 As MADE Said, it's server-sided . and it does work, I've tested it
#RooTs Posted May 10, 2014 Author Posted May 10, 2014 have to test with your level sought +2 and grab the star with and without vehicle [gamemode: play and deathmatch] meta.xml "Twerky" type="script" version="1.0.0" name="Destroy Star WantedLevel" description="Destroy Star WantedLevel" /> star.lua function dede() setTimer(function() test = createPickup (653.35773, -1769.18567, 13.57368, 3, 1247, 10000 ) addEventHandler("onPickupHit",test, function() setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(test) removeEventHandler("onPickupHit",test,onHitStar) end) end,10000,0) end addEventHandler("onResourceStart",resourceRoot,dede) not working with me
justn Posted May 10, 2014 Posted May 10, 2014 You can remove line 8, forgot to remove it, and when you started the resource. did you wait 10 seconds before the pickup created?
#RooTs Posted May 10, 2014 Author Posted May 10, 2014 Pickup is not destroyed when Esto inside the vehicle and when I'm out of the vehicle does not eliminate the level
justn Posted May 10, 2014 Posted May 10, 2014 Lol, you have it all wrong. the pickup was destroyed. you mean the wanted levels ? Did you want all of your wanted levels to be removed or only one of them ?
#RooTs Posted May 10, 2014 Author Posted May 10, 2014 this is correct, only not destroys when I'm inside the vehicle local test = createPickup (653.35773, -1769.18567, 13.57368, 3, 1247, 60000 ) addEventHandler("onPickupHit",test, function(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) end) and you added, destroyElement(test) and he not returned back Test localserver https://community.multitheftauto.com/ind ... ls&id=5104
RenanPG Posted May 11, 2014 Posted May 11, 2014 try this, but i haven't tested. test = createPickup (1660, 296, 21, 3, 1247, 6000 ) function destroy(player) destroyElement(test) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) function delay() test = createPickup (1660, 296, 21, 3, 1247, 6000 ) end setTimer ( delay, 6000, 1 ) end addEventHandler("onPickupHit",test,destroy)
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