Ride1234 Posted July 14, 2010 Share Posted July 14, 2010 Hello, I create pickups and have some problem with it. When I create pickup using server function createPickup it creates and works great, but if someone pick it up , it disappears on the all players. But I want, that every player can pick ip up, and these pickup wouldn't disappear on the other players. I mean, that each player can pick it up only one time. How to do it? p.s. if create pickup on client side it doesn't pick up. Link to comment
dzek (varez) Posted July 14, 2010 Share Posted July 14, 2010 maybe try something with? https://wiki.multitheftauto.com/wiki/SetElementVisibleTo but im not sure if pickup like this will be "pickable" by others (i mean, one player will pick up all the pickups) Link to comment
Ride1234 Posted July 14, 2010 Author Share Posted July 14, 2010 maybe try something with?https://wiki.multitheftauto.com/wiki/SetElementVisibleTo but im not sure if pickup like this will be "pickable" by others (i mean, one player will pick up all the pickups) I tried to destroy picked up pickup then create it again and hide to player, who picked up, bit it didn't work . Here is my code: function onPickupPickup(player) if(source == pickup[1]) then --[[ here is pickup's actions ]] destroyElement(pickup[1]) pickup[1] = createPickup (-3381.484131,-1083.058105,95.289009,3,1272,99999999999) -- i created the same pickup like it was setElementVisibleTo(pickup[1], getRootElement(), true) setElementVisibleTo(pickup[1], player, false) -- and hided it to player , who picked it up end end Pick up appeared again , but was not pickupable.. So i guess mta doesn't support per-player pickups.. Link to comment
Callum Posted July 14, 2010 Share Posted July 14, 2010 If you want it to be "per-player", use it client-side. Link to comment
dzek (varez) Posted July 14, 2010 Share Posted July 14, 2010 he said that it wasnt pickable when created clientside Link to comment
eAi Posted July 15, 2010 Share Posted July 15, 2010 Create it client side then use a colshape around it to detect when you hit it, then destroy it (and the colshape) when the player hits it. Link to comment
Ride1234 Posted July 15, 2010 Author Share Posted July 15, 2010 Create it client side then use a colshape around it to detect when you hit it, then destroy it (and the colshape) when the player hits it. I tried, but when one player pick ups the pickup it destroys for all players. Code: server side: triggerClientEvent(val,"createKeys",getRootElement()) client side: function createKeys2() key[1] = createPickup (-3231.484131,-2383.058105,81.289009,3,1272,9999999999) cls[1] = createColCircle ( -3231.484131,-2383.058105, 2.5 ) end addEvent("createKeys",true) addEventHandler( "createKeys", getRootElement(), createKeys2 ) function onClientColShapeHit() if(source == cls[1]) then outputChatBox("1",getLocalPlayer()) destroyElement(key[1]) destroyElement(cls[1]) end end addEventHandler("onClientColShapeHit",getRootElement(),onClientColShapeHit) pickup and colshape destroys for all players, and message sends too. Link to comment
DiSaMe Posted July 15, 2010 Share Posted July 15, 2010 You need to check if the player who hit the colshape is local player. Link to comment
Ride1234 Posted July 15, 2010 Author Share Posted July 15, 2010 You need to check if the player who hit the colshape is local player. Thank you, and all guys who helped me. It's works with colshapes. 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