Jump to content

[Help] Funcion


Recommended Posts

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

@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

 

 

Link to comment
  • Moderators
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)

 

  • Like 1
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...