Michcio Posted January 9, 2013 Posted January 9, 2013 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
manve1 Posted January 9, 2013 Posted January 9, 2013 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
Castillo Posted January 9, 2013 Posted January 9, 2013 Where is the marker created? you should create it server side, when a player hits it, set a variable, when another hits, check that variable, and when they leave, set it to false.
MR.S3D Posted January 9, 2013 Posted January 9, 2013 as solid say where the marker? https://wiki.multitheftauto.com/wiki/CreateMarker
Michcio Posted January 9, 2013 Author Posted January 9, 2013 It's only part of my code. Marker is created at the beggining of code.
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