Jump to content

Help with marker hit


Michcio

Recommended Posts

I have problem with hitting a marker. I want to do sth like only one player can open gui window at the same time.

My code:

function ukryj () 
    guiSetVisible(oknolicencja,false) 
    showCursor(false) 
    unbindKey("z","down",ukryj) 
    setElementData(marker,"wolne",false) 
    setElementData(getLocalPlayer(),"marker_prawko",false) 
end 
  
function pokaz2 (hitPlayer, matchingDimension) 
if source == marker then 
for k,v in ipairs(getElementsByType("player")) do 
    if getElementData(v,"zdaje_prawko") == false then 
    bindKey("z","down",pokaz) 
    setElementData(hitPlayer,"marker_prawko",true) 
    elseif getElementData(v,"zdaje_prawko") == true then 
    unbindKey("z","down",pokaz) 
    callServerFunction("outputChatBox","***| Gracz "..getPlayerName(v).." teraz zdaje prawko! |***",hitPlayer,255,255,255) 
    end 
end 
end 
end 
addEventHandler("onClientMarkerHit",marker,pokaz2) 
  
function pokaz () 
    guiGridListSetItemText ( glicencja, row1, kol1, "Prawko kat.B", false, false ) 
    guiGridListSetItemText ( glicencja, row1, kol2, "2000$", false, false ) 
    guiSetVisible(oknolicencja,true) 
    setElementData(gracz,"zdaje_prawko",true) 
    showCursor(true) 
    centerWindow(oknolicencja) 
    bindKey("x","down",ukryj) 
    outputChatBox("***| Aby zamknac okienko wcisnij 'x' |***",255,255,255) 
end 

Link to comment
function ukryj () 
    guiSetVisible(oknolicencja,false) 
    showCursor(false) 
    unbindKey("z","down",ukryj) 
    setElementData(marker,"wolne",false) 
    setElementData(getLocalPlayer(),"marker_prawko",false) 
end 
  
function pokaz2 (hitElement, matchingDimension) 
if (source == marker) and (hitElement) then 
for k,v in ipairs(getElementsByType("player")) do 
    if getElementData(v,"zdaje_prawko") == false then 
    bindKey("z","down",pokaz) 
    setElementData(hitElement,"marker_prawko",true) 
    elseif getElementData(v,"zdaje_prawko") == true then 
    unbindKey("z","down",pokaz) 
    callServerFunction("outputChatBox","***| Gracz "..getPlayerName(v).." teraz zdaje prawko! |***",hitElement,255,255,255) 
    end 
end 
end 
end 
addEventHandler("onClientMarkerHit",marker,pokaz2) 
  
function pokaz () 
    guiGridListSetItemText ( glicencja, row1, kol1, "Prawko kat.B", false, false ) 
    guiGridListSetItemText ( glicencja, row1, kol2, "2000$", false, false ) 
    guiSetVisible(oknolicencja,true) 
    setElementData(gracz,"zdaje_prawko",true) 
    showCursor(true) 
    centerWindow(oknolicencja) 
    bindKey("x","down",ukryj) 
    outputChatBox("***| Aby zamknac okienko wcisnij 'x' |***",255,255,255) 
end 

try this

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