drhx Posted June 14, 2019 Share Posted June 14, 2019 I recently created a job for my server, pizza delivery, but there is a problem, even if I set the marker as invisible (setElementVisibleTo) it becomes invisible more when I step over it, it performs the function, how do I solve it? Link to comment
Moderators IIYAMA Posted June 14, 2019 Moderators Share Posted June 14, 2019 Use this function to check if the marker is visible to the player: https://wiki.multitheftauto.com/wiki/IsElementVisibleTo But why the marker hit event is still triggering in the first place, is even a mystery to me. Note: this is the tutorial section. Link to comment
drhx Posted June 15, 2019 Author Share Posted June 15, 2019 the marker is invisible, but the function is executed even though I'm using setElementVisibleTo, I'm using the meta as "server" I did not find the error yet Link to comment
Moderators IIYAMA Posted June 15, 2019 Moderators Share Posted June 15, 2019 3 hours ago, drhx said: the marker is invisible, but the function is executed even though I'm using setElementVisibleTo, I'm using the meta as "server" I did not find the error yet Yes, understood. So use the solution I gave you for now. Link to comment
MTA Anti-Cheat Team Dutchman101 Posted June 15, 2019 MTA Anti-Cheat Team Share Posted June 15, 2019 We cannot help you efficiently unless you provide full code @drhx Link to comment
drhx Posted June 15, 2019 Author Share Posted June 15, 2019 inimarker = createMarker (2102.8264160156, -1788.5377197266, 12.5546875, "cylinder", 1.5, 255, 0, 0) marker1 = createMarker (2067.9577636719, -1731.6177978516, 12.87615776062, "cylinder", 1.5, 255, 0, 0) inicio = createBlipAttachedTo(inimarker, 42) blip1 = createBlipAttachedTo(marker1, 41) vehjob = {} function inicio(player) if vehjob[player] and isElement(vehjob[player]) then destroyElement(vehjob[player]) vehjob[player] = nil end vehjob[player] = createVehicle(462, 2107.9953613281, -1781.9140625, 13.388528823853) outputChatBox("#FF0000Você Aceitou O Emprego De Entregador De Pizza!", player, 255,255,255,true) outputChatBox("#FF0000Entregue As Pizzas Nos Locais Marcados Em Seu GPS!", player, 255,255,255,true) outputChatBox("#FF0000Para Cancelar Seu Emprego Digite /cancelar!", player, 255,255,255,true) createPed (297, 2067.1535644531,-1731.5858154297, 14.206628799438, 268.24844360352) warpPedIntoVehicle(player, vehjob[player]) setElementVisibleTo(finblip, player, true) setElementVisibleTo(finmarker, player, true) end addEventHandler("onMarkerHit", inimarker, inicio) I wanted to leave the marker1 invisible until the player passed the "inimarker", after the player passed the "inimarker" the "marker1" would be visible and with function Link to comment
DNL291 Posted June 17, 2019 Share Posted June 17, 2019 You can use the last argument of the function for this. local inimarker = createMarker (2102.8264160156, -1788.5377197266, 12.5546875, "cylinder", 1.5, 255, 0, 0) local marker1 = createMarker (2067.9577636719, -1731.6177978516, 12.87615776062, "cylinder", 1.5, 255, 0, 0, 255, resourceRoot) local inicio = createBlipAttachedTo(inimarker, 42) local blip1 = createBlipAttachedTo( marker1, 41, 2, 255, 0, 0, 255, 0, 16383, resourceRoot ) local vehjob = {} function inicio(player) if getElementType(player) ~= "player" then return end if vehjob[player] and isElement(vehjob[player]) then destroyElement(vehjob[player]) vehjob[player] = nil end vehjob[player] = createVehicle(462, 2107.9953613281, -1781.9140625, 13.388528823853) outputChatBox("#FF0000Você Aceitou O Emprego De Entregador De Pizza!", player, 255,255,255,true) outputChatBox("#FF0000Entregue As Pizzas Nos Locais Marcados Em Seu GPS!", player, 255,255,255,true) outputChatBox("#FF0000Para Cancelar Seu Emprego Digite /cancelar!", player, 255,255,255,true) -- define a variable here, it should be for each player that enters the marker, so it must be stored in a table just like the vehicle is createPed (297, 2067.1535644531,-1731.5858154297, 14.206628799438, 268.24844360352) warpPedIntoVehicle(player, vehjob[player]) setElementVisibleTo(marker1, player, true) setElementVisibleTo(blip1, player, true) end addEventHandler("onMarkerHit", inimarker, inicio) Try it. Link to comment
drhx Posted June 19, 2019 Author Share Posted June 19, 2019 On 17/06/2019 at 13:39, DNL291 said: You can use the last argument of the function for this. local inimarker = createMarker (2102.8264160156, -1788.5377197266, 12.5546875, "cylinder", 1.5, 255, 0, 0) local marker1 = createMarker (2067.9577636719, -1731.6177978516, 12.87615776062, "cylinder", 1.5, 255, 0, 0, 255, resourceRoot) local inicio = createBlipAttachedTo(inimarker, 42) local blip1 = createBlipAttachedTo( marker1, 41, 2, 255, 0, 0, 255, 0, 16383, resourceRoot ) local vehjob = {} function inicio(player) if getElementType(player) ~= "player" then return end if vehjob[player] and isElement(vehjob[player]) then destroyElement(vehjob[player]) vehjob[player] = nil end vehjob[player] = createVehicle(462, 2107.9953613281, -1781.9140625, 13.388528823853) outputChatBox("#FF0000Você Aceitou O Emprego De Entregador De Pizza!", player, 255,255,255,true) outputChatBox("#FF0000Entregue As Pizzas Nos Locais Marcados Em Seu GPS!", player, 255,255,255,true) outputChatBox("#FF0000Para Cancelar Seu Emprego Digite /cancelar!", player, 255,255,255,true) -- define a variable here, it should be for each player that enters the marker, so it must be stored in a table just like the vehicle is createPed (297, 2067.1535644531,-1731.5858154297, 14.206628799438, 268.24844360352) warpPedIntoVehicle(player, vehjob[player]) setElementVisibleTo(marker1, player, true) setElementVisibleTo(blip1, player, true) end addEventHandler("onMarkerHit", inimarker, inicio) Try it. I made a test, I put it every time I go through the marker1 he write something in the chat, and even invisible if I go through the marker1 he performs the function and leaves the message Link to comment
DNL291 Posted June 19, 2019 Share Posted June 19, 2019 Have you used the function mentioned above? (isElementVisibleTo) Link to comment
drhx Posted June 21, 2019 Author Share Posted June 21, 2019 On 17/06/2019 at 18:39, DNL291 said: You can use the last argument of the function for this. local inimarker = createMarker (2102.8264160156, -1788.5377197266, 12.5546875, "cylinder", 1.5, 255, 0, 0) local marker1 = createMarker (2067.9577636719, -1731.6177978516, 12.87615776062, "cylinder", 1.5, 255, 0, 0, 255, resourceRoot) local inicio = createBlipAttachedTo(inimarker, 42) local blip1 = createBlipAttachedTo( marker1, 41, 2, 255, 0, 0, 255, 0, 16383, resourceRoot ) local vehjob = {} function inicio(player) if getElementType(player) ~= "player" then return end if vehjob[player] and isElement(vehjob[player]) then destroyElement(vehjob[player]) vehjob[player] = nil end vehjob[player] = createVehicle(462, 2107.9953613281, -1781.9140625, 13.388528823853) outputChatBox("#FF0000Você Aceitou O Emprego De Entregador De Pizza!", player, 255,255,255,true) outputChatBox("#FF0000Entregue As Pizzas Nos Locais Marcados Em Seu GPS!", player, 255,255,255,true) outputChatBox("#FF0000Para Cancelar Seu Emprego Digite /cancelar!", player, 255,255,255,true) -- define a variable here, it should be for each player that enters the marker, so it must be stored in a table just like the vehicle is createPed (297, 2067.1535644531,-1731.5858154297, 14.206628799438, 268.24844360352) warpPedIntoVehicle(player, vehjob[player]) setElementVisibleTo(marker1, player, true) setElementVisibleTo(blip1, player, true) end addEventHandler("onMarkerHit", inimarker, inicio) Try it. so how would he use it? I did not understand very well, I'm slow. local inimarker = createMarker (2102.8264160156, -1788.5377197266, 12.5546875, "cylinder", 1.5, 255, 0, 0) local marker1 = createMarker (2067.9577636719, -1731.6177978516, 12.87615776062, "cylinder", 1.5, 255, 0, 0, 255, resourceRoot) local inicio = createBlipAttachedTo(inimarker, 42) local blip1 = createBlipAttachedTo( marker1, 41, 2, 255, 0, 0, 255, 0, 16383, resourceRoot ) local vehjob = {} function inicio(player) if getElementType(player) ~= "player" then return end if vehjob[player] and isElement(vehjob[player]) then destroyElement(vehjob[player]) vehjob[player] = nil end vehjob[player] = createVehicle(462, 2107.9953613281, -1781.9140625, 13.388528823853) outputChatBox("#FF0000Você Aceitou O Emprego De Entregador De Pizza!", player, 255,255,255,true) outputChatBox("#FF0000Entregue As Pizzas Nos Locais Marcados Em Seu GPS!", player, 255,255,255,true) outputChatBox("#FF0000Para Cancelar Seu Emprego Digite /cancelar!", player, 255,255,255,true) createPed (297, 2067.1535644531,-1731.5858154297, 14.206628799438, 268.24844360352) warpPedIntoVehicle(player, vehjob[player]) setElementVisibleTo(marker1, player, true) setElementVisibleTo(blip1, player, true) end addEventHandler("onMarkerHit", inimarker, inicio) function inicio2(player) outputChatBox("#FF0000Teste", player, 255,255,255,true,) end addEventHandler("onMarkerHit", marker1, inicio2) Link to comment
Scripting Moderators ds1-e Posted June 21, 2019 Scripting Moderators Share Posted June 21, 2019 57 minutes ago, drhx said: so how would he use it? I did not understand very well, I'm slow. local inimarker = createMarker (2102.8264160156, -1788.5377197266, 12.5546875, "cylinder", 1.5, 255, 0, 0) local marker1 = createMarker (2067.9577636719, -1731.6177978516, 12.87615776062, "cylinder", 1.5, 255, 0, 0, 255, resourceRoot) local inicio = createBlipAttachedTo(inimarker, 42) local blip1 = createBlipAttachedTo( marker1, 41, 2, 255, 0, 0, 255, 0, 16383, resourceRoot ) local vehjob = {} function inicio(player) if getElementType(player) ~= "player" then return end if vehjob[player] and isElement(vehjob[player]) then destroyElement(vehjob[player]) vehjob[player] = nil end vehjob[player] = createVehicle(462, 2107.9953613281, -1781.9140625, 13.388528823853) outputChatBox("#FF0000Você Aceitou O Emprego De Entregador De Pizza!", player, 255,255,255,true) outputChatBox("#FF0000Entregue As Pizzas Nos Locais Marcados Em Seu GPS!", player, 255,255,255,true) outputChatBox("#FF0000Para Cancelar Seu Emprego Digite /cancelar!", player, 255,255,255,true) createPed (297, 2067.1535644531,-1731.5858154297, 14.206628799438, 268.24844360352) warpPedIntoVehicle(player, vehjob[player]) setElementVisibleTo(marker1, player, true) setElementVisibleTo(blip1, player, true) end addEventHandler("onMarkerHit", inimarker, inicio) function inicio2(player) outputChatBox("#FF0000Teste", player, 255,255,255,true,) end addEventHandler("onMarkerHit", marker1, inicio2) if isElementVisibleTo(theElement, visibleTo) then -- do something end theElement: The element you want to check the visibility of visibleTo: The player you want to check against Link to comment
drhx Posted June 21, 2019 Author Share Posted June 21, 2019 14 hours ago, majqq said: if isElementVisibleTo(theElement, visibleTo) then -- do something end theElement: The element you want to check the visibility of visibleTo: The player you want to check against even without these commands it becomes invisible more with the commands and with these commands does not change anything until now I did not realize the error Link to comment
Scripting Moderators ds1-e Posted June 22, 2019 Scripting Moderators Share Posted June 22, 2019 3 hours ago, drhx said: even without these commands it becomes invisible more with the commands and with these commands does not change anything until now I did not realize the error Send updated code. Link to comment
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