Hero192
Members-
Posts
512 -
Joined
-
Last visited
Everything posted by Hero192
-
I already using this function, I just want to add my script in more shops but to do that, I need a way to define each ped that got aimed to be able to get shop position. Like if I aim on ped in shop ls the player will return the cordination of shop ls, because I want to make a distance system for each shop. Like need to walk 200 meters far of shop to get paid. Well i think I had explained it well please anyone can show me the right way?
-
Well so I have a last question, how to get shop's position for each ped aimed on. For example: If I aim on the ped who exist in shop A, the script will get distance of shop A..etc Just give me a way to follow please
-
Alright, Is there's a way to check how many meters left to complet 200meters? if yes please tell me the way
-
No, Client doesn't work in client side, just defined it with localPlayer, well I will try what you told me, btw why this code cause lag?
-
Hello guys, I have this part of code suggested by tosfera, but the problem is , when the player leaves the store and become in interior 0, it causes lag. and my main problem is, I want when the player leaves the store he needs to move away of store about 200meters, then a message will output. BUT, sometime it outputs this message and give player's money even he didn't pass the distance necessary. I hope you guys can give me a hand, this is so annoying, I tried all my ways but with no result. function renderDistanceCheck () if (isPedDead(client) or getElementInterior(client) > 0) then return end if ((not isPedDead(client)) and getElementInterior(client) == 0) then local px,py,pz = 1199.13, -918.07, 43.12 local x,y,z = getElementPosition(client) local dist = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if (dist >= 200) then outputChatBox("Succesfully you passed 200meters away of shop") removeEventHandler ("onClientRender", root, renderDistanceCheck) end end end
-
But why this doesn't work? setTimer(removeEventHandler,5000,1,"onClientRender",root,dxDraw)
-
Can I know why this cause a warning, the warning on debug says, bad argument 3 setTimer(removeEventHandler,5000,1,"onClientRender",root,dxDraw)
-
As the title says, how can I make a direct xDraw progress bar?
-
Well guys, you both thanks alot for your hard works, I see how you help people and I personally appreciate that. Continue helping you're totally usefull to the community. @Bonus, sorry if I didn't explain my problem aswell, in that moment I was kinda confused. And I have no problem with how to deal with Lua, I just didn't find a way to check if the player is left an interior, I won't force him to leave from the interior. But by tosfera, my issue is fixed, thanks all. @Tosfera, special thanks to you dude, I wish all helpers to be like you, I never got an ignore by you, even sometime I was asking you alot and I felt that I was annoying but you just kept helping, that's why you are my favorit person in this community, personally I wish you to be an admin on this community and you deserve more.
-
thanks youuu alot tosfera you're the best man , what you had sent me via pm is working
-
Thanks alot for everything and for your time @ tosfera, you are really a good man glad to meet you here, I'll test it now and tell you the results
-
It works but I 5old you the problem in my first post
-
I wont force player to leave the store, i just want see if he is left to continue scripting
-
Anyone please can give me a hand
-
Dude sorry if i didnt explain my problem but I wont set the player his interior into 0 but i want to check if the player is out of interior. For example when the player rob a store and he left the store then give him a reward.. I hope you can undetstand what i mean
-
Well, Basically I am doing a mission inside an "Interior", and want to find a way to check when the player is left the interior that's mean he's on interior 0. The simple check, if getElementInterior(source) then == 0 end doesn't work in my case. So, I used to do this way in below, it print a Mission Passed on the leave, I want it be printed only if the dist is >= 100 meters addEvent("removePlayerAnim",true) addEventHandler("removePlayerAnim", root, function() setPedAnimation(source) _getElementInterior(source, 0) end) function _getElementInterior(element, int) if isElement(element) and getElementType(element) == "player" and int == 0 then timer = setTimer( function() local x, y, z = getElementPosition(element) local px, py, pz = 1199.1300048828, -918.07098388672, 43.124603271484 local dist = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if getElementInterior(element, int) == 0 and dist >= 100 then givePlayerMoney(element, 1000) outputChatBox("Mission Passed", element, 22,22,200) end end,1000,0) end end
-
Are you talking about this code that you had sent to me? it set player's interior not checking it local _setElementInterior = setElementInterior function setElementInterior ( element, int ) if isElement ( element ) and getElementType ( element ) == "player" and int == 0 then -- Do whatever you want here -- end return _setElementInterior ( element, int ) end Anyone?
-
I know it works in another way, but doesn't work because, I am doing a mission inside an interior > 0, so I have to make a timer untill the player leave the interior to continue what I wanted to do, and you know this timer cause lags .. so anyway?
-
I won't set player interior, I want to get the interior. Normal check like that doesn't work if getElementInterior(source) == 0 then --code end
-
Hello guys, I am scripting a mission, but i face a problem, I want to check when the player is on interior 0 I tried this way if getElementInterior(source) == 0 then -- code end But doesn't work. This way in below works but it cause lags, I want a proper way please addEvent("remove",true) addEventHandler("remove", root, function() setPedAnimation(source) getPlayerInterior(source, 0) end) local timer = nil function getPlayerInterior(player, int) timer = setTimer( function() if getElementInterior(player) == tonumber(int) then if isTimer(timer) then killTimer(timer) end end end,1000,0) end -Thanks in advance.
-
Can I just know why I have to use getLocalPlayer() and getRootElement() in client side, I mean in which case
-
Can I just know what's the difference between the first example and the second one? I mean if we attached root to the event and if we attached localplayer. --1st Example: function targeting ( target ) if ( target ) then --code end end addEventHandler ( "onClientPlayerTarget", getRootElement(), targeting ) --2nd Example: function targeting ( target ) if ( target ) then --code end end addEventHandler ( "onClientPlayerTarget", getLocalPlayer(), targeting )
-
Well, you are totally right man, I did the second one it worked but it cause lags, so now I want to start with the first idea, what I have to do , I mean which functions / events I have to use?, please give me the light to follow Note: thanks dude
-
Hello guys, I am doing a loc system which an object be over the player's head, I made it, but the problem is with the element doesn't follow the player in every interior / dimension only work in dim 0 & int 0. Can anyone tell me what I have to do?
-
Tnx alot, but who told you it's faster than pairs & ipairs?