Jump to content

Onmarkerhit don't works


Recommended Posts

 yourMarker = createMarker ( 1174, -1319, 16, "cylinder", 1, 0, 0, 255, 200 ) 
  
function YourFunction (  ) 
     outputChatBox("Yay it works!") 
end 
  
addEventHandler("onMarkerHit", yourMarker, YourFunction, false) 
  

Basicly: Your addEventHandler doesnt make any sence at all.

Link to comment

Oh you are correct, I didn't think of that before, but you INDEED have managed to make a mistake in only those two lines. Now since you didn't give me any relevant information

You know that we'd need to see openbox function and all other relevant things too

I can't help more than saying that you got a problem with client/server side syntax. Since you didn't tell me if it's server or client side, can't help you anymore. (Actually I could, but to make you debug your code yourself, I'll give you just a hint.)

HINT: onMarkerHit works just as it's supposed to. Triggers a serverside event for serverside markers.

EDIT: @vivalavido

 yourMarker = createMarker ( 1174, -1319, 16, "cylinder", 1, 0, 0, 255, 200 )  
function YourFunction (  ) 
     outputChatBox("Yay it works!") 
end  
addEventHandler("onMarkerHit", yourMarker, YourFunction, false) 
  

Basicly: Your addEventHandler doesnt make any sence at all.

Actually he CAN attach the event handler to root element, so I didn't whine about that

Link to comment
Oh you are correct, I didn't think of that before, but you INDEED have managed to make a mistake in only those two lines. Now since you didn't give me any relevant information
You know that we'd need to see openbox function and all other relevant things too

I can't help more than saying that you got a problem with client/server side syntax. Since you didn't tell me if it's server or client side, can't help you anymore. (Actually I could, but to make you debug your code yourself, I'll give you just a hint.)

HINT: onMarkerHit works just as it's supposed to. Triggers a serverside event for serverside markers.

EDIT: @vivalavido

 yourMarker = createMarker ( 1174, -1319, 16, "cylinder", 1, 0, 0, 255, 200 )  
function YourFunction (  ) 
     outputChatBox("Yay it works!") 
end  
addEventHandler("onMarkerHit", yourMarker, YourFunction, false) 
  

Basicly: Your addEventHandler doesnt make any sence at all.

Actually he CAN attach the event handler to root element, so I didn't whine about that

Doesn't work. Should I add it server side?

Or only 1 thing, only the local player who walk into the marker should get the screen, and if the rest of the script is in the client.lue and if i do it in server.lua you can't open the box.

Link to comment

Hmm you didn't get the hint then

Here is another one:

READ WIKI FFS!

"onMarkerHit" is CLEARLY marked as serverside event, but you are using client side syntax for createMarker (READ WIKI TO SEE THAT). So you are either having a clientside marker with serverside event or serverside event called on a nil value, since for serverside, your createMarker syntax is wrong. And it all could be achieved by just LOOKING AT WIKI.

Link to comment
Hmm you didn't get the hint then

Here is another one:

READ WIKI FFS!

"onMarkerHit" is CLEARLY marked as serverside event, but you are using client side syntax for createMarker (READ WIKI TO SEE THAT). So you are either having a clientside marker with serverside event or serverside event called on a nil value, since for serverside, your createMarker syntax is wrong. And it all could be achieved by just LOOKING AT WIKI.

Yesh, but there is nothing on wiki about addEventHandler("onMarkerHit", yourMarker, yourFunction, true)

Link to comment
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [bool getPropagated = true] ) 

There is.

And I already told you that vivalavido didn't give you a correct example.

What is bool?

:
bool="true" addEventHandler ( string eventName, element attachedTo, function handlerFunction, [bool getPropagated = true] ) 

?

Link to comment

PLEASE READ WIKI! Bool is not a string, it's a boolean value, either 1 or 0, true or false. You can't use onMarkerHit because it's server side event. While your code is client side. Now I'm not going to waste more of my time if you continue ignoring everything we try to say..

Link to comment
PLEASE READ WIKI! Bool is not a string, it's a boolean value, either 1 or 0, true or false...

This is actually wrong. 1 and 0 are numbers and will always return true. It's not C based language. Lua is different language and 1 and 0 don't count as boolean values.

nil and false will always be false, everything else is true, even 0.

Link to comment
PLEASE READ WIKI! Bool is not a string, it's a boolean value, either 1 or 0, true or false...

This is actually wrong. 1 and 0 are numbers and will always return true. It's not C based language. Lua is different language and 1 and 0 don't count as boolean values.

nil and false will always be false, everything else is true, even 0.

Ah, ok.

And robhol, I can learn, but I don't see the 'overeenkomst' between

print("Hello World")

and a script in MTA.
Link to comment
PLEASE READ WIKI! Bool is not a string, it's a boolean value, either 1 or 0, true or false...

This is actually wrong. 1 and 0 are numbers and will always return true. It's not C based language. Lua is different language and 1 and 0 don't count as boolean values.

nil and false will always be false, everything else is true, even 0.

Ah, ok.

And robhol, I can learn, but I don't see the 'overeenkomst' between

print("Hello World")

and a script in MTA.

Then you've either not read enough, or you're too dumb - hope it's the former and keep reading.

Link to comment
PLEASE READ WIKI! Bool is not a string, it's a boolean value, either 1 or 0, true or false...

This is actually wrong. 1 and 0 are numbers and will always return true. It's not C based language. Lua is different language and 1 and 0 don't count as boolean values.

nil and false will always be false, everything else is true, even 0.

Yes I'm aware of that. I just wanted to imply about the concept of a boolean not how it's done in lua. That it's a boolean value in like in binary(1 true, 0 false). I know that they are just numbers in lua. What I didn't think about though is that he has probably no idea what binary is

Link to comment
PLEASE READ WIKI! Bool is not a string, it's a boolean value, either 1 or 0, true or false...

This is actually wrong. 1 and 0 are numbers and will always return true. It's not C based language. Lua is different language and 1 and 0 don't count as boolean values.

nil and false will always be false, everything else is true, even 0.

Yes I'm aware of that. I just wanted to imply about the concept of a boolean not how it's done in lua. That it's a boolean value in like in binary(1 true, 0 false). I know that they are just numbers in lua. What I didn't think about though is that he has probably no idea what binary is

Binary is another thing than Decimaal. 0 = 0

1 = 1

10 = 2

11 = 3

100 = 4

101 = 5

110 = 6

111 = 7

1000 = 8

etc

Link to comment

A boolean value is either 1, or 0, obviously. When you're talking about it from an electronics perspective, this is represented by high/low voltage, from a programming perspective by true/false.. you can also think of it as one bit of data (one binary digit), yes/no, etc.

Link to comment

Binary is another thing than Decimaal. 0 = 0

1 = 1

10 = 2

11 = 3

100 = 4

101 = 5

110 = 6

111 = 7

1000 = 8

etc

Haven't stated otherwise.

For example 1000 = because 1 * 2^3 + 0 * 2^2 + 0 * 2^1 + 0 * 2^0 = 8

1000 basically means [true false false false], so only 2^3 is added to 0 and no other 2^n, because all other are false

Similarly 1001 ([true false false true]) means that you add 2^3 and 2^0 and no others. Which will make it 9. So binary is a boolean system.

I know I explained it pretty rubbishly, but that's related to my relatively low English skills not relatively low knowledge :D

Link to comment

Binary is another thing than Decimaal. 0 = 0

1 = 1

10 = 2

11 = 3

100 = 4

101 = 5

110 = 6

111 = 7

1000 = 8

etc

Haven't stated otherwise.

For example 1000 = because 1 * 2^3 + 0 * 2^2 + 0 * 2^1 + 0 * 2^0 = 8

1000 basically means [true false false false], so only 2^3 is added to 0 and no other 2^n, because all other are false

Similarly 1001 ([true false false true]) means that you add 2^3 and 2^0 and no others. Which will make it 9. So binary is a boolean system.

I know I explained it pretty rubbishly, but that's related to my relatively low English skills not relatively low knowledge :D

Yeh, but im talking about it from an electronics perspective.

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