BorderLine Posted May 9, 2013 Share Posted May 9, 2013 Hi everyone. I have a problem with this resource for DM/DD The problem is, when i pick up a vehiclechange to hunter, that will give me +1 in the count. But, if in the place of hunter vehicle change, there are mor than 1 pick up, and i if get 3 pickups at same time, the count will give me +3 I need change the event? or add another code?? Thanks function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then givePlayerMoney ( source, 1000 ) top = getElementData(source,"Hunters") or 0 setElementData(source,"Hunters",top+1) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) Link to comment
~DarkRacer~ Posted May 9, 2013 Share Posted May 9, 2013 put: -- SERVER !! addEvent("onMapStarting", true) addEventHandler("onMapStarting", getRootElement(), function() for i,v in ipairs(getElementsByType('player')) do setElementData(v, "Hunter", false) end end) then change your code to : function someoneReachedHunter(number, sort, model) if (getElementData(source, "Hunter") == false) then givePlayerMoney ( source, 1000 ) top = getElementData(source,"Hunters") or 0 setElementData(source,"Hunters",top+1) setElementData(source,"Hunter",true) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) Link to comment
BorderLine Posted May 9, 2013 Author Share Posted May 9, 2013 Just one problem. If i get any vehicle change, infernus, or whatever. giveme a 1 hunter Link to comment
~DarkRacer~ Posted May 9, 2013 Share Posted May 9, 2013 Just one problem. If i get any vehicle change, infernus, or whatever. giveme a 1 hunter function someoneReachedHunter(number, sort, model) if (model == 425) then if (getElementData(source, "Hunter") == false ) then givePlayerMoney ( source, 1000 ) top = getElementData(source,"Hunters") or 0 setElementData(source,"Hunters",top+1) setElementData(source,"Hunter",true) end end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) Sorry for that Link to comment
BorderLine Posted May 9, 2013 Author Share Posted May 9, 2013 thanks a lot working now! Link to comment
~DarkRacer~ Posted May 9, 2013 Share Posted May 9, 2013 thanks a lot working now! No Problem. Link to comment
codeluaeveryday Posted May 9, 2013 Share Posted May 9, 2013 This will bug if you play a map such as Vortex V7 which stacks hunters, they will get multiple hunters, use tables to check. 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