Jump to content

Problem with the script (Marker)


Mauhan

Recommended Posts

(Sorry for my bad English)

The problem is this:

when I come into marker, GUI shows me and my friend on server. But the friend is not in marker. He stands next.

GUI should show only person in the marker. Please help.

A piece of code:

local marker2 = createMarker(362.10000610352,173.60000610352,1007.4000244141, 'cylinder', 1.0, 205, 248, 6, 150) 
setElementInterior(marker2, 3) 
  
GUIEditor = { 
    staticimage = {}, 
    edit = {}, 
    gridlist = {}, 
    label = {}, 
    button = {} 
} 
GUIEditor.gridlist[1] = guiCreateGridList(306, 192, 731, 450, false) 
guiSetAlpha(GUIEditor.gridlist[1], 0.96) 
  
GUIEditor.edit[1] = guiCreateEdit(69, 84, 157, 23, "", false, GUIEditor.gridlist[1]) 
GUIEditor.edit[2] = guiCreateEdit(69, 139, 157, 23, "", false, GUIEditor.gridlist[1]) 
GUIEditor.edit[3] = guiCreateEdit(69, 197, 157, 23, "", false, GUIEditor.gridlist[1]) 
GUIEditor.label[4] = guiCreateLabel(16, 84, 47, 25, "Imię:", false, GUIEditor.gridlist[1]) 
guiLabelSetHorizontalAlign(GUIEditor.label[4], "right", false) 
GUIEditor.label[5] = guiCreateLabel(6, 142, 57, 20, "Nazwisko:", false, GUIEditor.gridlist[1]) 
guiLabelSetHorizontalAlign(GUIEditor.label[5], "right", false) 
GUIEditor.label[6] = guiCreateLabel(6, 197, 57, 20, "Wiek:", false, GUIEditor.gridlist[1]) 
guiLabelSetHorizontalAlign(GUIEditor.label[6], "right", false) 
GUIEditor.button[1] = guiCreateButton(578, 404, 143, 40, "Wyrób dowód", false, GUIEditor.gridlist[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
GUIEditor.label[7] = guiCreateLabel(506, 40, 225, 237, "Formularz Dowodowy wersja BETA.\nWitaj! W tym miejscu możesz wyrobić\ndowód osobisty. Będzie on potrzebny,\ndo zidentyfikowania Twojej postaci\n przez policje.\nUWAGA! UWAGA! UWAGA! UWAGA!\nJeżeli w w tabelkach:\nImię/Nazwisko/Wiek\nWpiszesz coś durnego, dostaniesz bana.", false, GUIEditor.gridlist[1]) 
guiSetFont(GUIEditor.label[7], "default-bold-small") 
guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", false) 
GUIEditor.staticimage[1] = guiCreateStaticImage(16, 336, 274, 104, "fotki/logo1.png", false, GUIEditor.gridlist[1]) 
GUIEditor.label[8] = guiCreateLabel(15, 36, 132, 32, "Przeczytaj -->>", false, GUIEditor.gridlist[1]) 
guiSetFont(GUIEditor.label[8], "default-bold-small") 
guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", false) 
guiLabelSetVerticalAlign(GUIEditor.label[8], "center") 
  
guiSetVisible ( GUIEditor.gridlist[1], false ) 
showCursor(false) 
      ------------------ 
  
  local nick = getPlayerName(getLocalPlayer()) 
  
  function MarkerHit ( marker2, hitPlayer, matchingDimension ) 
    
   local player2 = getPlayerName(getLocalPlayer())   
  if getElementData(getPlayerFromName(player2), "dowod", true) then 
      
        outputChatBox ("Już posiadasz wyrobiony dowód!",player, 0, 255, 0, true )  
else        
       outputChatBox ( "#FF4500[Dowód]#FFFFFFAby wyjść wpisz komende #48D1CC/wyjdz", 255, 0, 0, true) 
      guiSetVisible ( GUIEditor.gridlist[1], true ) 
      showCursor(true) 
  
    function drawText() 
        dxDrawText("Forumularz Dowodowy", 306, 162, 1037, 219, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "bottom", false, false, true, false, false) 
        dxDrawLine(306, 223, 1037, 223, tocolor(255, 255, 255, 255), 1, true) 
        dxDrawLine(306, 192, 1037, 192, tocolor(255, 255, 255, 255), 1, true) 
    end 
addEventHandler("onClientRender", getRootElement(), drawText)   
end 
end 
--addEvent("marker", true) 
addEventHandler ( "onClientMarkerHit", marker2, MarkerHit ) 

Thanks for help.

Link to comment

That's because "onClientMarkerHit" is not triggered for the local player only, remote players can also trigger it, but you can make a check to see if the hit element is the local player.

local marker2 = createMarker(362.10000610352,173.60000610352,1007.4000244141, 'cylinder', 1.0, 205, 248, 6, 150) 
setElementInterior(marker2, 3) 
  
GUIEditor = { 
    staticimage = {}, 
    edit = {}, 
    gridlist = {}, 
    label = {}, 
    button = {} 
} 
GUIEditor.gridlist[1] = guiCreateGridList(306, 192, 731, 450, false) 
guiSetAlpha(GUIEditor.gridlist[1], 0.96) 
  
GUIEditor.edit[1] = guiCreateEdit(69, 84, 157, 23, "", false, GUIEditor.gridlist[1]) 
GUIEditor.edit[2] = guiCreateEdit(69, 139, 157, 23, "", false, GUIEditor.gridlist[1]) 
GUIEditor.edit[3] = guiCreateEdit(69, 197, 157, 23, "", false, GUIEditor.gridlist[1]) 
GUIEditor.label[4] = guiCreateLabel(16, 84, 47, 25, "Imie:", false, GUIEditor.gridlist[1]) 
guiLabelSetHorizontalAlign(GUIEditor.label[4], "right", false) 
GUIEditor.label[5] = guiCreateLabel(6, 142, 57, 20, "Nazwisko:", false, GUIEditor.gridlist[1]) 
guiLabelSetHorizontalAlign(GUIEditor.label[5], "right", false) 
GUIEditor.label[6] = guiCreateLabel(6, 197, 57, 20, "Wiek:", false, GUIEditor.gridlist[1]) 
guiLabelSetHorizontalAlign(GUIEditor.label[6], "right", false) 
GUIEditor.button[1] = guiCreateButton(578, 404, 143, 40, "Wyrób dowód", false, GUIEditor.gridlist[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
GUIEditor.label[7] = guiCreateLabel(506, 40, 225, 237, "Formularz Dowodowy wersja BETA.\nWitaj! W tym miejscu mozesz wyrobic\ndowód osobisty. Bedzie on potrzebny,\ndo zidentyfikowania Twojej postaci\n przez policje.\nUWAGA! UWAGA! UWAGA! UWAGA!\nJezeli w w tabelkach:\nImie/Nazwisko/Wiek\nWpiszesz cos durnego, dostaniesz bana.", false, GUIEditor.gridlist[1]) 
guiSetFont(GUIEditor.label[7], "default-bold-small") 
guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", false) 
GUIEditor.staticimage[1] = guiCreateStaticImage(16, 336, 274, 104, "fotki/logo1.png", false, GUIEditor.gridlist[1]) 
GUIEditor.label[8] = guiCreateLabel(15, 36, 132, 32, "Przeczytaj -->>", false, GUIEditor.gridlist[1]) 
guiSetFont(GUIEditor.label[8], "default-bold-small") 
guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", false) 
guiLabelSetVerticalAlign(GUIEditor.label[8], "center") 
  
guiSetVisible ( GUIEditor.gridlist[1], false ) 
showCursor(false) 
  
function MarkerHit ( hitPlayer, matchingDimension ) 
    if ( hitPlayer ~= localPlayer ) then 
        return 
    end 
  
    if getElementData(localPlayer, "dowod", true) then  
        outputChatBox ("Juz posiadasz wyrobiony dowód!",player, 0, 255, 0, true ) 
    else       
        outputChatBox ( "#FF4500[Dowód]#FFFFFFAby wyjsc wpisz komende #48D1CC/wyjdz", 255, 0, 0, true) 
        guiSetVisible ( GUIEditor.gridlist[1], true ) 
        showCursor(true) 
        addEventHandler("onClientRender", getRootElement(), drawText)   
    end 
end 
addEventHandler ( "onClientMarkerHit", marker2, MarkerHit ) 
  
function drawText() 
    dxDrawText("Forumularz Dowodowy", 306, 162, 1037, 219, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "bottom", false, false, true, false, false) 
    dxDrawLine(306, 223, 1037, 223, tocolor(255, 255, 255, 255), 1, true) 
    dxDrawLine(306, 192, 1037, 192, tocolor(255, 255, 255, 255), 1, true) 
end 

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