Jump to content

Bug or what?


`Dmz

Recommended Posts

Posted

Hi, MTA community. I have one problem with server side event onMarkerHit, it doesn't works, but when I write similar script client-side, it works, so is it bug or scripting mistake?

vokJuodas = createMarker(197.1796875, 168.767578125, 1002.0234375, "cylinder", 1.5, 1, 1, 1)
setElementInterior(vokJuodas,3) 	
addEventHandler("onMarkerHit", vokJuodas, function ()
triggerClientEvent("vokPuolimas", getRootElement())
end)

Posted

Maybe you can show me how because I haven't any idea how to do it, I tried it to do it with event onPlayerMarkerHit, but it was the same thing like with onMarkerHit event.

Posted

I don't works this is my code look maybe i did something wrong here? :|

indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
addEventHandler( "onMarkerHit", getResourceRootElement(),
function( )
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
)

Posted

Try this:

function markerHit( )
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
 
addEventHandler( "onRecourseStart", getResourceRootElement(),
function( )
       indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
addEventHandler( "onMarkerHit", this, markerHit )
end
)

Posted
indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
function markerHit()
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
addEventHandler ("onMarkerHit", getRootElement(), markerHit)

this should work

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
function markerHit()
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
addEventHandler ("onMarkerHit", getRootElement(), markerHit)

this should work

No it don't works to.

Posted

are u sure? cause i tryed it and does it what it says, "Boo" that says when i enter in the marker.

the script its server-side

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
are u sure? cause i tryed it and does it what it says, "Boo" that says when i enter in the marker.

the script its server-side

Yes this is server-side, but it don't works I don't lie. Maybe something wrong with my all script :?: but what then if it is.

Posted

must be your other script parts because this code works i tested it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Try this:
function markerHit( )
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
 
addEventHandler( "onRecourseStart", getResourceRootElement(),
function( )
       indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
addEventHandler( "onMarkerHit", this, markerHit )
end
)

This should work, but the variable this is not defined!

The code with the variable this defined

this = getResourceRootElement(getThisResource())
 
function markerHit( )
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
 
addEventHandler( "onRecourseStart", getResourceRootElement(),
function( )
       indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
addEventHandler( "onMarkerHit", this, markerHit )
end
)

Why looking here, while my post is up there /\ :)

Posted
Try this:
function markerHit( )
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
 
addEventHandler( "onRecourseStart", getResourceRootElement(),
function( )
       indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
addEventHandler( "onMarkerHit", this, markerHit )
end
)

This should work, but the variable this is not defined!

The code with the variable this defined

this = getResourceRootElement(getThisResource())
 
function markerHit( )
if ( source == indJuodas ) then
outputChatBox("Boo")
end
end
 
addEventHandler( "onRecourseStart", getResourceRootElement(),
function( )
       indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1)
setElementInterior(indJuodas,6)
addEventHandler( "onMarkerHit", this, markerHit )
end
)

You have to read wiki more often.

https://wiki.multitheftauto.com/wiki/AddEventHandler

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...