Booms Posted May 5, 2020 Posted May 5, 2020 local hatarped = createPed ( 71, 69.71004, -1532.15381, 5.13079); setElementData(hatarped, "katt", "hatar"); local hatarkapu = createObject(2909, 68.10683, -1526.46423, 4.85258); local kor = {createColSphere( 68.53889, -1526.16394, 4.84955, 12.5 )}; addEvent("sikeres", true); addEventHandler("sikeres", root, function(osszeg, localPlayer) if (localPlayer) then local pMoney = getPlayerMoney(localPlayer); if (pMoney >= osszeg) then setPlayerMoney(localPlayer, pMoney-osszeg); moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 2.5); local asd = 1; mit = setTimer( function() asd = asd + 1; local isInSpot = getElementsWithinColShape(kor[1], "player"); if not (#isInSpot > 0) or (asd > 12) then moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 4.85258); if (mit) then killTimer(mit); end end end ,1000,0) end end end ); The problem is: It watchs all of the player,who are staying in the colshape. I want to watch the localPlayer,who paid the terminal.
Moderators Patrick Posted May 5, 2020 Moderators Posted May 5, 2020 (edited) getElementsWithinColShape return every players who stay in the colshape in array, you should use isElementWithinColShape to check for a specific player. Edited May 5, 2020 by Patrick
Guty Posted May 14, 2020 Posted May 14, 2020 On 05/05/2020 at 13:47, Booms said: local hatarped = createPed ( 71, 69.71004, -1532.15381, 5.13079); setElementData(hatarped, "katt", "hatar"); local hatarkapu = createObject(2909, 68.10683, -1526.46423, 4.85258); local kor = {createColSphere( 68.53889, -1526.16394, 4.84955, 12.5 )}; addEvent("sikeres", true); addEventHandler("sikeres", root, function(osszeg, localPlayer) if (localPlayer) then local pMoney = getPlayerMoney(localPlayer); if (pMoney >= osszeg) then setPlayerMoney(localPlayer, pMoney-osszeg); moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 2.5); local asd = 1; mit = setTimer( function() asd = asd + 1; local isInSpot = getElementsWithinColShape(kor[1], "player"); if not (#isInSpot > 0) or (asd > 12) then moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 4.85258); if (mit) then killTimer(mit); end end end ,1000,0) end end end ); The problem is: It watchs all of the player,who are staying in the colshape. I want to watch the localPlayer,who paid the terminal. local hatarped = createPed ( 71, 69.71004, -1532.15381, 5.13079); setElementData(hatarped, "katt", "hatar"); local hatarkapu = createObject(2909, 68.10683, -1526.46423, 4.85258); local kor = {createColSphere( 68.53889, -1526.16394, 4.84955, 12.5 )}; addEvent("sikeres", true); addEventHandler("sikeres", root, function(osszeg, localPlayer) if (localPlayer) then local pMoney = getPlayerMoney(localPlayer); if (pMoney >= osszeg) then setPlayerMoney(localPlayer, pMoney-osszeg); moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 2.5); local asd = 1; mit = setTimer( function() asd = asd + 1; local within = isElementWithinColShape ( localPlayer, kor ) if within or (asd > 12) then moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 4.85258); if (mit) then killTimer(mit); end end end ,1000,0) end end end)
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