Jump to content

element data?


Bean666

Recommended Posts

is client element data and server element data shared?

what if i set an element data to a player on serverside

will the clientside getElementData still get the data i set on a player from the serverside?

i havent scripted for years and i just came back so im kinda confused again.

 

EDIT: SOLVED, lol sorry for this dumbass question. just came back 

Edited by Shaman123
Link to comment
  • Moderators
21 minutes ago, Shaman123 said:

is client element data and server element data shared?

By default: yes

bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] )

If synchronize is disabled: no


 

 

 

Link to comment

anyway, i created a table with markers, but why does it not go with onClientMarkerHit? can u check on this one?

it creates the markers within the tables, but the event onClientMarkerHit doesn't work anymore

For some reason, when i only had one marker, the event worked, but now markers are created from a table which is random, now it doesn't work, why?

for some reason when the marker is already created, the Markerhit event works, but if it wasnt created yet and it was created

by an event, the Markerhit event doesnt work.

and it gives me an error 

that the marker is nil on the onClientMarkerhit, which ofc only happens when i restart the script, since the marker isnt made yet since the creation of the marker triggered by an event.

local markers = { 
      { -2403.62598, -599.17444, 131.5 },
      {-2425.51172, -610.80096, 132.56250}, 
      { -2416.54712, -594.27307, 132.7115 }
} 

function setAlpha(localPlayer)
setElementAlpha(jobmarker, 150)
local v = math.random(#markers) 
marker = createMarker(markers[v][1], markers[v][2], markers[v][3], "cylinder", 3, 0, 240, 0) 
end
addEvent( "activate", true )
addEventHandler( "activate", localPlayer, setAlpha )

addEventHandler ( "onClientMarkerHit", marker, 
    function ( hitElement ) 
        if ( hitElement == localPlayer and getElementType ( hitElement ) == "player" ) then 
                outputChatBox("working")
                destroyElement(marker)
            end 
end
) 

 

Edited by Shaman123
Link to comment
10 minutes ago, Bilal135 said:

Try this,


addEventHandler ( "onClientMarkerHit", root, 
    function ( hitElement ) 
        if source == marker then
            if ( hitElement == localPlayer and getElementType ( hitElement ) == "player" ) then 
                outputChatBox("working")
                destroyElement(marker)    
            end
        end
    end
)

 

thanks.

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