Pedro Silveira

[HELP] PROBLEM WITH OUTPUTCHATBOX!

Recommended Posts

Hello, i made this code:

local marker2 = createMarker(1215.326953125, 6.1982421875, 999.921875, "cylinder", 1.2, 255, 10, 10, 0)
setElementInterior(marker2, 2)
setElementDimension(marker2, 10)

mensagem2 = function(thePlayer)
	if isElementWithinMarker(thePlayer, marker2) then
		outputChatBox("#C71585Você deseja um boquete por #FF69B4R$ 100,00#C71585, meu bem? Digite #FF69B4/boquete!", l_5_0, 255, 255, 255, true)
	end
end
addEventHandler("onMarkerHit", getRootElement(), mensagem2) 

But always i restart the script and they show the message if i inside the interior 2 and dimension 10.

NOTE: I have another function like this and she don't show the message.

Anyone can help me? Thanks!

Share this post


Link to post

Sry, but it's hard to understand what you want, cause your english is pretty bad.
What exactly is the problem?
 

Share this post


Link to post

1) It was for him to show the output message only if the player was on top of the marker. But when entering the dimension of the script it shows the message as if the player was in the marker. I have another function equal to this in the script and it does not give this problem. It is written in the same way only as changing the function name obviously.

2) Another question I have is how to set the player drunk. Do you know how to do this?

Thanks.

Share this post


Link to post

1. You mean when the player is in the same dimension, but another position (not in the marker), the output does still come?
Are there other player on the server?
"l_5_0" is not the player, "thePlayer" is the player.
And why don't you just attach the event on the marker (instead of getRootElement())?

2. https://wiki.multitheftauto.com/wiki/SetPedWalkingStyle
126 is "MOVE_DRUNKMAN"

 

Edited by Bonus

Share this post


Link to post

try this

local marker2 = createMarker(1215.326953125, 6.1982421875, 999.921875, "cylinder", 1.2, 255, 10, 10, 0)
setElementInterior(marker2, 2)
setElementDimension(marker2, 10)

mensagem2 = function(thePlayer)
	if source == marker2 then
		outputChatBox("#C71585Você deseja um boquete por #FF69B4R$ 100,00#C71585, meu bem? Digite #FF69B4/boquete!", thePlayer, 255, 255, 255, true)
	end
end
addEventHandler("onMarkerHit", getRootElement(), mensagem2) 

what is 1_5_0? you probably want to add the player there also the event will return the marker as the source so you can just compare it with marker2 instead of using isElementWithinMarker.

Share this post


Link to post

1: I haven't understood what is wrong exactly, but I recommend using the matchingDimension parameter.

2: Replace getRootElement() with resourceRoot.

3: Check if the parameter 'thePlayer' is actually a player element.

4: Your code was probably decompiled; keep in mind that we don't provide help with leaked/stolen script.

Share this post


Link to post

Use root or get root element to get output msg I suggest u to always use MTA wiki first before u start scripting anything try to search the function u want to script here is the code below u can look out !

 a marker.


local myMarker = createMarker(-2596.625, 579.358, 15.626, 'cylinder', 2.0, 255, 0, 0, 150) -- create myMarker

function MarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler
    local elementType = getElementType( hitElement ) -- get the hit element's type
    outputChatBox( elementType.." inside myMarker", getRootElement(), 255, 255, 0 ) -- attach the element's type with the text, and output it
end

 

 

Edited by Khadeer143

Share this post


Link to post

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.