Turbesz Posted May 16, 2021 Posted May 16, 2021 i tried with table, but does not work, create for all player, when i type the command local cpk = {} function teszt(player) cpk[player] = createMarker(1954.52979, -1367.25488, 24.27094, "corona", 1.5, 255, 0, 0, 150) addEventHandler("onMarkerHit", cpk[player],felvesz) end addCommandHandler("t",teszt) funny, because in another script this method worked... and now what wrong?
Moderators Patrick Posted May 16, 2021 Moderators Posted May 16, 2021 Since it's not client side, you can't create it only for "localPlayer". The only thing what you can do to make visible only for "player" who used the command. You have to use createMarker's 10th parameter. Quote visibleTo: This defines which elements can see the marker. Defaults to visible to everyone. See visibility.
Turbesz Posted May 16, 2021 Author Posted May 16, 2021 1 minute ago, Patrick said: Since it's not client side, you can't create it only for "localPlayer". I know, but i've used before this method with table and then the markers or peds appeared only to the player. Now when i change the createMarker to createPed, the ped also appears to everyone... with table.
Moderators Patrick Posted May 16, 2021 Moderators Posted May 16, 2021 3 minutes ago, Turbesz said: I know, but i've used before this method with table and then the markers or peds appeared only to the player. Now when i change the createMarker to createPed, the ped also appears to everyone... with table. This is not how it works. Tables are not affect element visibility. Probably you did it on client-side, where everything created only for "localPlayer". 1
Turbesz Posted May 16, 2021 Author Posted May 16, 2021 11 minutes ago, Patrick said: This is not how it works. Tables are not affect element visibility. Probably you did it on client-side, where everything created only for "localPlayer". Oh, i got it. And how can i solve it the onMarkerHit event for players? Because remove the marker from all players, if a player hit that. function felvesz(thePlayer, md) setElementData( thePlayer, 'm', source) if getElementType(thePlayer) == "vehicle" then destroyElement(getElementData(thePlayer, 'm') ) end end
Moderators Patrick Posted May 16, 2021 Moderators Posted May 16, 2021 46 minutes ago, Turbesz said: Oh, i got it. And how can i solve it the onMarkerHit event for players? Because remove the marker from all players, if a player hit that. function felvesz(thePlayer, md) setElementData( thePlayer, 'm', source) if getElementType(thePlayer) == "vehicle" then destroyElement(getElementData(thePlayer, 'm') ) end end People who can't see the marker, can hit it? Try to check is marker visible for "thePlayer" first, with isElementVisibleTo. 1
Turbesz Posted May 16, 2021 Author Posted May 16, 2021 4 hours ago, Patrick said: People who can't see the marker, can hit it? Try to check is marker visible for "thePlayer" first, with isElementVisibleTo. thanks
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now