Jump to content

Marker visible


Recommended Posts

I'd use something like this:

Server:
 


local authSkin = 2
local marker = createMarker(1944, -1497, 2.5, "cylinder", 1, 255, 0, 0)

function checkSkin(_,newSkin)
    if source and isElement(source) and getElementType(source) == "player" then 
        iprint(source)
        if newSkin == authSkin then
            setElementAlpha(marker,255)
        else
            setElementAlpha(marker,0)
        end
    end
end
addEventHandler("onElementModelChange",root,checkSkin)

function myFunction(element,dim)
    if element and isElement(element) and getElementType(element) == "player" and getElementModel(element) == authSkin then
        outputChatBox("Hello :)",element)
    end
end
addEventHandler("onMarkerHit",marker,myFunction)

addEventHandler("onPlayerResourceStart",root,function ()
    if source and isElement(source) then
        if getElementModel(source) == authSkin then 
            setElementAlpha(marker,255)
        else
            setElementAlpha(marker,0)
        end
    end
end)

Since it is only an example, you should modify the script to your needs :).

Link to comment
Yes, that's what I thought too, it's all well and good, but I wrote a system that looks at the status of the Unit and decides based on whether it can request another one, so based on the skin, I'll send you my code on how to make it disappear.
 
 
 
function unit()
     local playerskin = getElementModel(source)
     local x, y, z = getElementPosition(source)
       if (validSkin[playerskin]) then 
	      if  (status == false) then 
	          status2 = false
              status3 = false
			  destroyElement(statusMarker1)
			  destroyElement(statusB2)
			  statusB1 = createBlipAttachedTo(source, 1)
			  statusMarker = createMarker(x, y, z)
			  attachElements(statusMarker, source)
	  		  outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikeressen megváltoztatad az egységed állapotát: #ffffff||Járőr||", source, 255, 255, 255, true)
	          status = true   
		    else
	  		outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Már ez az egységed állapota.", source, 255, 255, 255, true)
			
			
	    end
	end
end

 

Link to comment

This is a new code

 

function unit1()
  local playerskin = getElementModel(source)
  local x, y, z = getElementPosition(source)
      if (validSkin[playerskin]) then
       if not (status2) then
	    status = false
        status3 =false
       
		statusB2 = createBlipAttachedTo(source, 0, 4, 0, 0, 255)
		statusMarker1 = createMarker(x, y, z, "checkpoint", 4, 255, 0, 0)
		destroyElement(statusMarker)
		destroyElement(statusB1)       
		attachElements(statusMarker1, source)
	if not (validSkin[playerskin]) then
		setElementAlpha(statusMarker1,0)
	end
		outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikeressen megváltoztatad az egységed állapotát: #ffffff||Üldözés||", source, 255, 255, 255, 
true)
   status2 = true
	  
	else
	  outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Már ez az egységed állapota.", source, 255, 255, 255, true)
		end
	end
end

addEvent("Button2", true)
addEventHandler("Button2", root, unit1)

 

Please help!

 

@Lavi

Link to comment

the logic for creating and destroying markers and blips is :Oed up

status2 = false  -- Initialize status2

function unit1()
    local playerskin = getElementModel(source)
    local x, y, z = getElementPosition(source)
    if validSkin[playerskin] then
        if not status2 then
            statusB2 = createBlipAttachedTo(source, 0, 4, 0, 0, 255)
            statusMarker1 = createMarker(x, y, z, "checkpoint", 4, 255, 0, 0)
            attachElements(statusMarker1, source)
            if not validSkin[playerskin] then
                setElementAlpha(statusMarker1,0)  -- Hide the marker
            else
                setElementAlpha(statusMarker1,255)  -- Show the marker
            end
            outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Sikeressen megváltoztatad az egységed állapotát: #ffffff||Üldözés||", source, 255, 255, 255, 
true)
            status2 = true
        else
            outputChatBox("#898c8f<<#2c469cNeXoN Roleplay#898c8f>> #0f5720Már ez az egységed állapota.", source, 255, 255, 255, true)
        end
    end
end

addEvent("Button2", true)
addEventHandler("Button2", root, unit1)

 

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