Jump to content

problem with marker


Recommended Posts

well guys i,ve made marker i want whene player hit the marker another marker apper

here is the part of my code that not working this marker not apper the other one apper

  
    function m1() 
        marker2= createMarker(-1292.881,-47.277,14.1484, "Cylinder", 1.5, 250,243,5,240) 
         blip2=createBlip (-1292.881,-47.277,14.1484) 
        end 
        addEventHandler("onClientMarkerHit",marker1,m1) 
  

Link to comment
well guys i,ve made marker i want whene player hit the marker another marker apper

here is the part of my code that not working this marker not apper the other one apper

  
    function m1() 
        marker2= createMarker(-1292.881,-47.277,14.1484, "Cylinder", 1.5, 250,243,5,240) 
         blip2=createBlip (-1292.881,-47.277,14.1484) 
        end 
        addEventHandler("onClientMarkerHit",marker1,m1) 
  

function m1() 
        marker2 = createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
         blip2 = createBlip (-1292.881,-47.277,14.1484, 15) 
      end 
addEventHandler("onClientMarkerHit",marker2,m1) 

Edited by Guest
Link to comment

Can you show us the part where you defined maker1?

  
marker1 =  ---------- ? 
function m1() 
        marker2 = createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
         blip2 = createBlip (-1292.881,-47.277,14.1484, 15)  
      end 
addEventHandler("onClientMarkerHit",marker1,m1) 
  

What is [icon no.]? what are you trying to do?

Link to comment

here is the full code clinet side

local markerA = createMarker(1999.5583,-2286.297,12.7, "Cylinder", 1.5, 250,243,5,240) 
local count 
createBlip (2003.5999755859,-2287.8000488281, 13,5) 
     
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
function guiMyCwindow(w,h,t) 
    local x,y = guiGetScreenSize() 
    return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
end 
          
windowjob = guiCreateWindow(448,172,480,418,"pilot job by Abdalbaset",false) 
guiSetAlpha(windowjob,1) 
guiWindowSetMovable(windowjob,false) 
guiWindowSetSizable(windowjob,false) 
guiSetVisible(windowjob, false) 
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
GUIEditor_Button[1] = guiCreateButton(9,332,389,77,"Take pilot job!",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(399,332,372,77,"Cancel",false,windowjob) 
GUIEditor_Memo[1] = guiCreateMemo(9,25,462,307,"this is pilot job you have to do missions to earn money ",false,windowjob) 
guiMemoSetReadOnly(GUIEditor_Memo[1],true) 
          
function SAPDjob(hitElement) 
    if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
    if not guiGetVisible(windowjob) then 
        guiSetVisible(windowjob, true) 
                      showCursor(true) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerHit", markerA, SAPDjob) 
          
        function FBIjobleave(leaveElement) 
             if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                  if guiGetVisible(windowjob) then 
                       guiSetVisible(windowjob, false) 
                       showCursor(false) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerLeave", markerA, SAPDjobleave) 
          
        function joinTeam() 
             triggerServerEvent("Assa",localPlayer) 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
             marker1= createMarker(1924.078,-2434.363,13.5391, "Cylinder", 1.5, 250,243,5,240) 
             blip1=createBlip (1924.078,-2434.363,13.5391,51) 
             
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
         
          
        function removeSAPDWindow() 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) 
     
    function m1() 
        marker2= createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
         blip2=createBlip (-1292.881,-47.277,14.1484) 
        end 
        addEventHandler("onClientMarkerHit",marker1,m1) 

Link to comment
Can you show us the part where you defined maker1?
  
marker1 =  ---------- ? 
function m1() 
        marker2 = createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
         blip2 = createBlip (-1292.881,-47.277,14.1484, 15)  
      end 
addEventHandler("onClientMarkerHit",marker1,m1) 
  

What is [icon no.]? what are you trying to do?

Im Sorry i not see the marker 1 i edit it again...

Link to comment
here is the full code clinet side
local markerA = createMarker(1999.5583,-2286.297,12.7, "Cylinder", 1.5, 250,243,5,240) 
local count 
createBlip (2003.5999755859,-2287.8000488281, 13,5) 
     
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
function guiMyCwindow(w,h,t) 
    local x,y = guiGetScreenSize() 
    return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
end 
          
windowjob = guiCreateWindow(448,172,480,418,"pilot job by Abdalbaset",false) 
guiSetAlpha(windowjob,1) 
guiWindowSetMovable(windowjob,false) 
guiWindowSetSizable(windowjob,false) 
guiSetVisible(windowjob, false) 
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
GUIEditor_Button[1] = guiCreateButton(9,332,389,77,"Take pilot job!",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(399,332,372,77,"Cancel",false,windowjob) 
GUIEditor_Memo[1] = guiCreateMemo(9,25,462,307,"this is pilot job you have to do missions to earn money ",false,windowjob) 
guiMemoSetReadOnly(GUIEditor_Memo[1],true) 
          
function SAPDjob(hitElement) 
    if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
    if not guiGetVisible(windowjob) then 
        guiSetVisible(windowjob, true) 
                      showCursor(true) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerHit", markerA, SAPDjob) 
          
        function FBIjobleave(leaveElement) 
             if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                  if guiGetVisible(windowjob) then 
                       guiSetVisible(windowjob, false) 
                       showCursor(false) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerLeave", markerA, SAPDjobleave) 
          
        function joinTeam() 
             triggerServerEvent("Assa",localPlayer) 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
             marker1= createMarker(1924.078,-2434.363,13.5391, "Cylinder", 1.5, 250,243,5,240) 
             blip1=createBlip (1924.078,-2434.363,13.5391,51) 
             
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
         
          
        function removeSAPDWindow() 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) 
     
    function m1() 
        marker2= createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
         blip2=createBlip (-1292.881,-47.277,14.1484) 
        end 
        addEventHandler("onClientMarkerHit",marker1,m1) 

Copy this Script if it's not work tell to me again ...

local markerA = createMarker(1999.5583,-2286.297,12.7, "cylinder", 1.5, 250,243,5,240) 
local count 
createBlip (2003.5999755859,-2287.8000488281, 13,5) 
     
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
function guiMyCwindow(w,h,t) 
    local x,y = guiGetScreenSize() 
    return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
end 
          
windowjob = guiCreateWindow(448,172,480,418,"pilot job by Abdalbaset",false) 
guiSetAlpha(windowjob,1) 
guiWindowSetMovable(windowjob,false) 
guiWindowSetSizable(windowjob,false) 
guiSetVisible(windowjob, false) 
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
GUIEditor_Button[1] = guiCreateButton(9,332,389,77,"Take pilot job!",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(399,332,372,77,"Cancel",false,windowjob) 
GUIEditor_Memo[1] = guiCreateMemo(9,25,462,307,"this is pilot job you have to do missions to earn money ",false,windowjob) 
guiMemoSetReadOnly(GUIEditor_Memo[1],true) 
          
function SAPDjob(hitElement) 
    if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
    if not guiGetVisible(windowjob) then 
        guiSetVisible(windowjob, true) 
                      showCursor(true) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerHit", markerA, SAPDjob) 
          
        function FBIjobleave(leaveElement) 
             if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                  if guiGetVisible(windowjob) then 
                       guiSetVisible(windowjob, false) 
                       showCursor(false) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerLeave", markerA, FBIjobleave) 
          
        function joinTeam() 
             triggerServerEvent("Assa",localPlayer) 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
             marker1 = createMarker(1924.078,-2434.363,13.5391, "cylinder", 1.5, 250,243,5,240) 
             blip1 = createBlip (1924.078,-2434.363,13.5391,51) 
             
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
         
          
        function removeSAPDWindow() 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) 
     
    function m1() 
        marker2 = createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
         blip2 = createBlip (-1292.881,-47.277,14.1484, 51) 
        end 
        addEventHandler("onClientMarkerHit",marker2,m1) 

Link to comment

--ClientSide

local markerA = createMarker(1999.5583,-2286.297,12.7, "cylinder", 1.5, 250,243,5,240) 
createBlip (2003.5999755859,-2287.8000488281, 13,5) 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
windowjob = guiCreateWindow(448,172,480,418,"pilot job by Abdalbaset",false) 
guiSetAlpha(windowjob,1) 
guiWindowSetMovable(windowjob,false) 
guiWindowSetSizable(windowjob,false) 
guiSetVisible(windowjob, false) 
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
GUIEditor_Button[1] = guiCreateButton(9,332,389,77,"Take pilot job!",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(399,332,372,77,"Cancel",false,windowjob) 
GUIEditor_Memo[1] = guiCreateMemo(9,25,462,307,"this is pilot job you have to do missions to earn money ",false,windowjob) 
guiMemoSetReadOnly(GUIEditor_Memo[1],true) 
  
addEventHandler("onClientMarkerHit", markerA, 
function ( hitElement ) 
 if getElementType( hitElement) == "player" and ( hitElement == localPlayer)  and not isPedInVehicle (hitElement) then 
 guiSetVisible(windowjob, true) 
 showCursor(true) 
  end 
end 
) 
  
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , 
function ( ) 
marker1 = createMarker(1924.078,-2434.363,13.5391, "cylinder", 1.5, 250,243,5,240) 
blip1 = createBlip (1924.078,-2434.363,13.5391,51) 
triggerServerEvent("Assa",localPlayer) 
guiSetVisible(windowjob, false) 
showCursor(false) 
  end 
) 
  
  
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , 
function ( ) 
guiSetVisible(windowjob, false) 
showCursor(false) 
end 
) 
  
 addEventHandler("onClientMarkerLeave", markerA, 
 function ( leaveElement ) 
  if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) and not isPedInVehicle (hitElement) then 
  guiSetVisible(windowjob, false) 
  showCursor(false) 
  end 
end 
) 
  
addEventHandler("onClientMarkerHit",marker1, 
function (hitElement) 
 if getElementType( hitElement) == "player" and ( hitElement == localPlayer)and not isPedInVehicle (hitElement) then 
marker2= createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
blip2=createBlip (-1292.881,-47.277,14.1484) 
 end 
end 
) 
  
  
addEventHandler ( 'onPlayerQuit', root, 
    function ( ) 
            local attached = getAttachedElements ( source ); 
            for _,v in next, attached do 
                if getElementType ( v ) == 'blip' then 
                    destroyElement ( v ); 
                end 
            end 
        end 
)         
Link to comment
  • 2 weeks later...
local markerA = createMarker(1999.5583,-2286.297,12.7, "cylinder", 1.5, 250,243,5,240) 
createBlipAttachedTo(markerA, 5) 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
windowjob = guiCreateWindow(448,172,480,418,"pilot job by Abdalbaset",false) 
guiSetAlpha(windowjob,1) 
guiWindowSetMovable(windowjob,false) 
guiWindowSetSizable(windowjob,false) 
guiSetVisible(windowjob, false) 
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
GUIEditor_Button[1] = guiCreateButton(9,332,389,77,"Take pilot job!",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(399,332,372,77,"Cancel",false,windowjob) 
GUIEditor_Memo[1] = guiCreateMemo(9,25,462,307,"this is pilot job you have to do missions to earn money ",false,windowjob) 
guiMemoSetReadOnly(GUIEditor_Memo[1],true) 
  
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , 
function() 
    marker1 = createMarker(1924.078,-2434.363,13.5391, "cylinder", 1.5, 250,243,5,240) 
    blip1 = createBlipAttachedTo(marker1, 51) 
    triggerServerEvent("Assa",localPlayer) 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end) 
  
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , 
function() 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end) 
  
addEventHandler("onClientMarkerLeave", markerA, 
function(leaveElement) 
    if leaveElement == localPlayer then 
        guiSetVisible(windowjob, false) 
        showCursor(false) 
    end 
end) 
  
addEventHandler("onClientMarkerHit",root, 
function(hitElement) 
    if hitElement == localPlayer and not isPedInVehicle(hitElement) then 
        if source == markerA then 
            guiSetVisible(windowjob, true) 
            showCursor(true) 
        elseif source == marker1 then 
            marker2 = createMarker(-1292.881,-47.277,14.1484, "cylinder", 1.5, 250,243,5,240) 
            blip2 = createBlipAttachedTo(marker2) 
        elseif source == marker2 then 
            -- code 
        end 
    end 
end) 

Link to comment
  
aircraftModels = { 592, 577, 511, 548, 512, 593, 425, 520, 417, 487, 553, 488, 497, 563, 476, 447, 519, 460, 469, 513 } 
function isAircraft(elem) 
    if getElementType(elem) == "vehicle" then 
        for q,w in pairs(aircraftModels) do 
            if tonumber(getElementModel(elem)) == tonumber(w) then 
                return true 
            end 
        end 
    end 
    return false 
end 
  

Add this code somewhere in your script, and use isAircraft(hitElement) in the if statement where you want it.

You should also delete the "and not isPedInVehicle(hitElement)" part at the start to make this work.

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