Jump to content

[HELP] DESTROY WANTEDLEVEL


#RooTs

Recommended Posts

Posted (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

547e765fe0b4f2955962f6a8c02fca02.png

createPickup (1548, -1681, 13, 3, 1239, 60000 ) 

Can someone help me?

Sorry my english...

More or less like this:

Edited by Guest
  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Posted

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) 

Posted
local test = createPickup (1548, -1681, 13, 3, 1247, 60000 ) 
  
addEventHandler("onPickupHit",test, 
function(player) 
setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) 
destroyElement(test) 
end) 

Posted

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 

Posted (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 by Guest
Posted

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

Posted

You can remove line 8, forgot to remove it, and when you started the resource. did you wait 10 seconds before the pickup created?

Posted

Pickup is not destroyed when Esto inside the vehicle and when I'm out of the vehicle does not eliminate the level

55f5ab225bbb9a4727c18380ba991a8b.png

c0c9b699686fc606ad4c8f7ad5c9ca28.png

Posted

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 ?

Posted

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

Posted

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) 
  
  
  

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...