iam2noob4u Posted December 19, 2014 Share Posted December 19, 2014 I'm having some trouble hiding pickups. For testing purposes I've simplified my script to this: addEventHandler("onResourceStart", root, function() local player = getRandomPlayer(); --lazy way of getting the only player on the server (which is me during testing) local x,y,z = getElementPosition(player); local pickup = createPickup(x+5, y, z, 2, 6, 1000, 100); setElementVisibleTo(pickup, root, false); end); Whether I use root or player as the second argument for setElementVisibleTo: the script creates the shovel pickup, but I can still see it. I'm pretty sure this is a bug - or intended behaviour that is not mentioned on the wiki, but I'd like to be sure before I submit a bug report Link to comment
ViRuZGamiing Posted December 19, 2014 Share Posted December 19, 2014 This does not work with all entities - vehicles, players and objects are exempt. This is because these objects are required for accurate sync (they're physical objects that contribute to the physics engine). This function is particularly useful for changing the visibility of markers, radar blips and radar areas. Link to comment
iam2noob4u Posted December 19, 2014 Author Share Posted December 19, 2014 vehicles, players and objects I'm creating a pickup. The reason vehicles, players and objects cannot be made invisible is because they have physics, pickups do not. Link to comment
DNL291 Posted December 20, 2014 Share Posted December 20, 2014 (edited) Do you want the pickup doesn't get visible for whom? If you want to show it just for a specific player, use this: setElementVisibleTo(pickup, root, false) setElementVisibleTo(pickup, player, true) Edit Yeah, nevermind. It doesn't work for pickups, forgot about the MTA Wiki note. Edited December 20, 2014 by Guest Link to comment
Anubhav Posted December 20, 2014 Share Posted December 20, 2014 This does not work with all entities - vehicles, players and objects are exempt. This is because these objects are required for accurate sync (they're physical objects that contribute to the physics engine). This function is particularly useful for changing the visibility of markers, radar blips and radar areas. Link to comment
iam2noob4u Posted December 20, 2014 Author Share Posted December 20, 2014 Again: the wiki note in no way makes clear that the function does not work on pickups. The explanation for the elements it doesn't work on is basically that it doesn't work on solid elements. Pickups aren't solid. There is no point in quoting the note multiple times, as it is not an answer to my question. The note clearly excludes vehicles, players and objects. It also mentiones some elements it is particularly useful on. Particularly doesn't mean "only". I'll add another 'needs checking' note to the page and just script my way around the problem Link to comment
Saml1er Posted December 20, 2014 Share Posted December 20, 2014 Again: the wiki note in no way makes clear that the function does not work on pickups. The explanation for the elements it doesn't work on is basically that it doesn't work on solid elements. Pickups aren't solid.There is no point in quoting the note multiple times, as it is not an answer to my question. The note clearly excludes vehicles, players and objects. It also mentiones some elements it is particularly useful on. Particularly doesn't mean "only". I'll add another 'needs checking' note to the page and just script my way around the problem Element is element. Pickups are also elements. Their collision is disabled. They are actually food objects. Link to comment
iam2noob4u Posted December 21, 2014 Author Share Posted December 21, 2014 Element is element. Pickups are also elements. I understand, this is not the issue. The function is to be called on elements so it's a good thing pickups are elements. Their collision is disabled. They are actually food objects. I think you are confusing the normal pickups (created with createPickup) with the race pickups (created with createObject). Link to comment
Saml1er Posted December 24, 2014 Share Posted December 24, 2014 Element is element. Pickups are also elements. I understand, this is not the issue. The function is to be called on elements so it's a good thing pickups are elements. Their collision is disabled. They are actually food objects. I think you are confusing the normal pickups (created with createPickup) with the race pickups (created with createObject). I thought they were same. 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