PashaBiceps Posted March 18, 2019 Share Posted March 18, 2019 Hi guys, why this function is going to everyone? Thanks in advance. function goBeach ( thePlayer, seat, jacked ) markergobeach = createMarker ( 2945.4387207031, -2053.7338867188, 2.8984375, "cylinder", 2, 255, 0, 0, 50, thePlayer ) BlipDiver = createBlipAttachedTo ( markergobeach , 41, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) if ( isElement ( objectmission ) ) then destroyElement ( objectmission ) end if ( isElement ( markertable ) ) then destroyElement ( markertable ) end givePlayerMoney ( thePlayer, 3000 ) --setElementModel(thePlayer, getElementData(thePlayer, "ownskin_Diverskin")) -- load back --removeElementData(thePlayer, "ownskin_Diverskin") outputChatBox("Tu encontras-te o saco com o dinheiro e conseguis-te 3000€, volta para a praia", thePlayer, 255, 255, 0) addEventHandler ( "onMarkerHit", markergobeach , donegobeach ) end Link to comment
Moderators IIYAMA Posted March 18, 2019 Moderators Share Posted March 18, 2019 @GodKraken Because there is nothing in the code that sets the marker and blip only available for a specific person. With the function setElementVisibleTo you can make specific elements visible/invisible for some players. https://wiki.multitheftauto.com/wiki/SetElementVisibleTo Or you can create the marker and blip clientside. (Marker created on the CLIENT/PLAYER computer) But you will need to learn to communicate between serverside and clientside. Learn the MTA way: Or a tool you can use to make this easier: https://gitlab.com/IIYAMA12/mta-communication-enchantment Examples Syntax Set-up Link to comment
Mr.Loki Posted March 18, 2019 Share Posted March 18, 2019 @IIYAMA he did use the last args of those functions which sets the visibility to thePlayer 1 Link to comment
Moderators IIYAMA Posted March 18, 2019 Moderators Share Posted March 18, 2019 44 minutes ago, Mr.Loki said: @IIYAMA he did use the last args of those functions which sets the visibility to thePlayer Ah yea true, my bad. But afaik that doesn't work for new joined players. Experimental. local normaliseVisibility = createElement("normaliseVisibility") addEventHandler("onPlayerJoin", root, function () setElementVisibleTo(normaliseVisibility, source, false) end) markergobeach = createMarker ( 2945.4387207031, -2053.7338867188, 2.8984375, "cylinder", 2, 255, 0, 0, 50, thePlayer ) BlipDiver = createBlipAttachedTo ( markergobeach , 41, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) setElementParent(markergobeach, normaliseVisibility) setElementParent(BlipDiver, normaliseVisibility) 1 Link to comment
PashaBiceps Posted March 18, 2019 Author Share Posted March 18, 2019 17 minutes ago, IIYAMA said: Ah yea true, my bad. But afaik that doesn't work for new joined players. Experimental. local normaliseVisibility = createElement("normaliseVisibility") addEventHandler("onPlayerJoin", root, function () setElementVisibleTo(normaliseVisibility, source, false) end) markergobeach = createMarker ( 2945.4387207031, -2053.7338867188, 2.8984375, "cylinder", 2, 255, 0, 0, 50, thePlayer ) BlipDiver = createBlipAttachedTo ( markergobeach , 41, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) setElementParent(markergobeach, normaliseVisibility) setElementParent(BlipDiver, normaliseVisibility) The checkpoint is already visible only to the player. The point is that if anyone goes through the invisible checkpoint, he takes it. And the outputChatBox is being displayed for everyone. Link to comment
Mr.Loki Posted March 18, 2019 Share Posted March 18, 2019 i suggest you just move it to the client and use some triggers Link to comment
Moderators IIYAMA Posted March 18, 2019 Moderators Share Posted March 18, 2019 Or you can use this function: https://wiki.multitheftauto.com/wiki/IsElementVisibleTo Within the donegobeach function. It is a little bit dirty, but it should do it's job. 1 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